summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2013-06-28 11:15:02 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-06-28 11:15:02 -0700
commitc36fe2fc5354fadc140c898f59d47859cbdeac67 (patch)
treea238c4eb527573da5ecbc3ac4c31a240a4a1eb3c /libs/hwui
parent1e09cfaa689cff21d3d00883d38af5c296859fdb (diff)
parent55e789dbc782be0dcaf1d4bae5f32e9e2f674152 (diff)
downloadframeworks_base-c36fe2fc5354fadc140c898f59d47859cbdeac67.zip
frameworks_base-c36fe2fc5354fadc140c898f59d47859cbdeac67.tar.gz
frameworks_base-c36fe2fc5354fadc140c898f59d47859cbdeac67.tar.bz2
am 55e789db: am ed96349a: am 3d1b158e: Merge "Fix out of range glCopyTexImage2D Bug #9425270" into jb-mr2-dev
* commit '55e789dbc782be0dcaf1d4bae5f32e9e2f674152': Fix out of range glCopyTexImage2D Bug #9425270
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 73c0453..7c0f3ad 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -930,15 +930,18 @@ bool OpenGLRenderer::createLayer(float left, float top, float right, float botto
layer->bindTexture();
if (!bounds.isEmpty()) {
if (layer->isEmpty()) {
- glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
- bounds.left, mSnapshot->height - bounds.bottom,
- layer->getWidth(), layer->getHeight(), 0);
+ // Workaround for some GL drivers. When reading pixels lying outside
+ // of the window we should get undefined values for those pixels.
+ // Unfortunately some drivers will turn the entire target texture black
+ // when reading outside of the window.
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, layer->getWidth(), layer->getHeight(),
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
layer->setEmpty(false);
- } else {
- glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left,
- mSnapshot->height - bounds.bottom, bounds.getWidth(), bounds.getHeight());
}
+ glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, bounds.left,
+ mSnapshot->height - bounds.bottom, bounds.getWidth(), bounds.getHeight());
+
// Enqueue the buffer coordinates to clear the corresponding region later
mLayers.push(new Rect(bounds));
}