summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-10-07 14:51:16 -0700
committerJamie Gennis <jgennis@google.com>2011-10-07 17:53:37 -0700
commit9575f60722f7a4f54384fe0be6938a8de48dc23a (patch)
tree3f3f2c7ca822b0306730a79fc985f7d89d8c5a03 /services/surfaceflinger/Layer.cpp
parentfdacaf930bfecc1768d63a9fb7625bf96b0e30e3 (diff)
downloadframeworks_native-9575f60722f7a4f54384fe0be6938a8de48dc23a.zip
frameworks_native-9575f60722f7a4f54384fe0be6938a8de48dc23a.tar.gz
frameworks_native-9575f60722f7a4f54384fe0be6938a8de48dc23a.tar.bz2
SurfaceFlinger: screenshots w/ protected buffers
This change modifies SurfaceFlinger's screenshot behavior when a layer with a protected buffer is visible. The previous behavior was to simply fail the screenshot. The new behavior is to render the screenshot using a placeholder texture where the protected buffer would have been. Change-Id: I5e50cb2f3b31b2ea81cfe291c9b4a42e9ee71874
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 41d7a90..feb2c52 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -280,20 +280,29 @@ void Layer::onDraw(const Region& clip) const
return;
}
- const GLenum target = GL_TEXTURE_EXTERNAL_OES;
- glBindTexture(target, mTextureName);
- 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);
+ GLenum target = GL_TEXTURE_EXTERNAL_OES;
+ if (!isProtected()) {
+ glBindTexture(target, mTextureName);
+ 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);
+ }
+ glEnable(target);
+ glMatrixMode(GL_TEXTURE);
+ glLoadMatrixf(mTextureMatrix);
+ glMatrixMode(GL_MODELVIEW);
} else {
- glTexParameterx(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameterx(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ target = GL_TEXTURE_2D;
+ glBindTexture(target, mFlinger->getProtectedTexName());
+ glEnable(target);
+ glMatrixMode(GL_TEXTURE);
+ glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
}
- glEnable(target);
- glMatrixMode(GL_TEXTURE);
- glLoadMatrixf(mTextureMatrix);
- glMatrixMode(GL_MODELVIEW);
drawWithOpenGL(clip);