diff options
| author | 2011-10-07 14:51:16 -0700 | |
|---|---|---|
| committer | 2011-10-07 17:53:37 -0700 | |
| commit | 830d083bf75f1dfe3753f9565f0c90b1dbcc264f (patch) | |
| tree | d9c664db2e4ff4fe849347e8680e774066ef75fb /services/surfaceflinger/Layer.cpp | |
| parent | ba8ecd206cc6f175767f952d380c88f70ece04cf (diff) | |
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.cpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 41d7a90978ad..feb2c5272dbd 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); |