summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2011-10-18 14:49:27 -0700
committer Mathias Agopian <mathias@google.com> 2011-10-18 15:32:57 -0700
commit9044ef05d542a4f99b4be7ecefbe5e676bd3ea7f (patch)
treebdd0b1be4d282566ab3232943f15a9ed2dc3ec8a /services/surfaceflinger/SurfaceFlinger.cpp
parentf522e095e69406a5c6039b406237e9b30781a355 (diff)
Make sure set GL state properly
when taking a screenshot, in particular, we could end up with stale GL state when drawing LayerDim which resulted in incortect rendering. Bug: 5467587 Change-Id: Id9fbed2843481d31063620f3662b364c7e3ac781
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 7c0cd9bdcb5b..3c48b7e270cb 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1029,8 +1029,9 @@ void SurfaceFlinger::debugFlashRegions()
composeSurfaces(repaint);
}
+ glDisable(GL_TEXTURE_EXTERNAL_OES);
+ glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
- glDisable(GL_DITHER);
glDisable(GL_SCISSOR_TEST);
static int toggle = 0;
@@ -1073,9 +1074,6 @@ void SurfaceFlinger::drawWormhole() const
const int32_t width = hw.getWidth();
const int32_t height = hw.getHeight();
- glDisable(GL_BLEND);
- glDisable(GL_DITHER);
-
if (LIKELY(!mDebugBackground)) {
glClearColor(0,0,0,0);
Region::const_iterator it = region.begin();
@@ -1090,19 +1088,20 @@ void SurfaceFlinger::drawWormhole() const
const GLshort vertices[][2] = { { 0, 0 }, { width, 0 },
{ width, height }, { 0, height } };
const GLshort tcoords[][2] = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 } };
+
glVertexPointer(2, GL_SHORT, 0, vertices);
glTexCoordPointer(2, GL_SHORT, 0, tcoords);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-#if defined(GL_OES_EGL_image_external)
- if (GLExtensions::getInstance().haveTextureExternal()) {
- glDisable(GL_TEXTURE_EXTERNAL_OES);
- }
-#endif
+
+ glDisable(GL_TEXTURE_EXTERNAL_OES);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, mWormholeTexName);
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
+
+ glDisable(GL_BLEND);
+
glScalef(width*(1.0f/32.0f), height*(1.0f/32.0f), 1);
Region::const_iterator it = region.begin();
Region::const_iterator const end = region.end();
@@ -1813,6 +1812,8 @@ status_t SurfaceFlinger::renderScreenToTextureLocked(DisplayID dpy,
GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, tname, 0);
// redraw the screen entirely...
+ glDisable(GL_TEXTURE_EXTERNAL_OES);
+ glDisable(GL_TEXTURE_2D);
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
@@ -2004,6 +2005,7 @@ status_t SurfaceFlinger::electronBeamOffAnimationImplLocked()
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDeleteTextures(1, &tname);
glDisable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
return NO_ERROR;
}
@@ -2148,6 +2150,7 @@ status_t SurfaceFlinger::electronBeamOnAnimationImplLocked()
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDeleteTextures(1, &tname);
glDisable(GL_TEXTURE_2D);
+ glDisable(GL_BLEND);
return NO_ERROR;
}