summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-10-18 14:49:27 -0700
committerMathias Agopian <mathias@google.com>2011-10-18 15:32:57 -0700
commitc492e67810814bf86301abffe1d31598b775cf45 (patch)
tree208d45461bc10139d381f9eccf6c134a24969efe /services/surfaceflinger/Layer.cpp
parent5884e9eb26262b619a4823a36f264ea84d7ceae3 (diff)
downloadframeworks_native-c492e67810814bf86301abffe1d31598b775cf45.zip
frameworks_native-c492e67810814bf86301abffe1d31598b775cf45.tar.gz
frameworks_native-c492e67810814bf86301abffe1d31598b775cf45.tar.bz2
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/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index feb2c52..34a0d73 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -280,33 +280,33 @@ void Layer::onDraw(const Region& clip) const
return;
}
- GLenum target = GL_TEXTURE_EXTERNAL_OES;
if (!isProtected()) {
- glBindTexture(target, mTextureName);
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureName);
+ GLenum filter = GL_NEAREST;
if (getFiltering() || needsFiltering() || isFixedSize() || isCropped()) {
// TODO: we could be more subtle with isFixedSize()
- glTexParameterx(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterx(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- } else {
- glTexParameterx(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterx(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ filter = GL_LINEAR;
}
- glEnable(target);
+ glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, filter);
+ glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, filter);
glMatrixMode(GL_TEXTURE);
glLoadMatrixf(mTextureMatrix);
glMatrixMode(GL_MODELVIEW);
+ glEnable(GL_TEXTURE_EXTERNAL_OES);
+ glDisable(GL_TEXTURE_2D);
} else {
- target = GL_TEXTURE_2D;
- glBindTexture(target, mFlinger->getProtectedTexName());
- glEnable(target);
+ glBindTexture(GL_TEXTURE_2D, mFlinger->getProtectedTexName());
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
+ glDisable(GL_TEXTURE_EXTERNAL_OES);
+ glEnable(GL_TEXTURE_2D);
}
drawWithOpenGL(clip);
- glDisable(target);
+ glDisable(GL_TEXTURE_EXTERNAL_OES);
+ glDisable(GL_TEXTURE_2D);
}
// As documented in libhardware header, formats in the range