summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2011-02-10 15:52:54 -0800
committer Romain Guy <romainguy@google.com> 2011-02-10 15:52:54 -0800
commitb18d2d0079b4dbf5675ab79b7111b3dfb3cc1ad0 (patch)
tree36e09ec065df8e1855c6ca3d809dbd59dea935ff /libs/hwui/OpenGLRenderer.cpp
parent83a7b963f0070022d98853ea1fb4fa5c81cc5e79 (diff)
Dirty layers in the area covered by a drawBitmapMesh() call
Bug #3410827 Change-Id: Ic8b4f6201af94497bba86c75819588c78debddc2
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 8ee7ec3f60cd..68b54febf956 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1110,6 +1110,17 @@ void OpenGLRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHei
const uint32_t count = meshWidth * meshHeight * 6;
+ float left = FLT_MAX;
+ float top = FLT_MAX;
+ float right = FLT_MIN;
+ float bottom = FLT_MIN;
+
+#if RENDER_LAYERS_AS_REGIONS
+ bool hasActiveLayer = hasLayer();
+#else
+ bool hasActiveLayer = false;
+#endif
+
// TODO: Support the colors array
TextureVertex mesh[count];
TextureVertex* vertex = mesh;
@@ -1138,12 +1149,28 @@ void OpenGLRenderer::drawBitmapMesh(SkBitmap* bitmap, int meshWidth, int meshHei
TextureVertex::set(vertex++, vertices[ax], vertices[ay], u1, v2);
TextureVertex::set(vertex++, vertices[cx], vertices[cy], u2, v1);
TextureVertex::set(vertex++, vertices[dx], vertices[dy], u2, v2);
+
+#if RENDER_LAYERS_AS_REGIONS
+ if (hasActiveLayer) {
+ // TODO: This could be optimized to avoid unnecessary ops
+ left = fminf(left, fminf(vertices[ax], fminf(vertices[bx], vertices[cx])));
+ top = fminf(top, fminf(vertices[ay], fminf(vertices[by], vertices[cy])));
+ right = fmaxf(right, fmaxf(vertices[ax], fmaxf(vertices[bx], vertices[cx])));
+ bottom = fmaxf(bottom, fmaxf(vertices[ay], fmaxf(vertices[by], vertices[cy])));
+ }
+#endif
}
}
+#if RENDER_LAYERS_AS_REGIONS
+ if (hasActiveLayer) {
+ dirtyLayer(left, top, right, bottom, *mSnapshot->transform);
+ }
+#endif
+
drawTextureMesh(0.0f, 0.0f, 1.0f, 1.0f, texture->id, alpha / 255.0f,
mode, texture->blend, &mesh[0].position[0], &mesh[0].texture[0],
- GL_TRIANGLES, count);
+ GL_TRIANGLES, count, false, false, 0, false, false);
}
void OpenGLRenderer::drawBitmap(SkBitmap* bitmap,