summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libs/hwui/LayerRenderer.cpp7
-rw-r--r--libs/hwui/OpenGLRenderer.cpp48
2 files changed, 29 insertions, 26 deletions
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index a167429..1c89577 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -29,6 +29,10 @@ namespace uirenderer {
void LayerRenderer::prepare(bool opaque) {
LAYER_RENDERER_LOGD("Rendering into layer, fbo = %d", mLayer->fbo);
+#if RENDER_LAYERS_AS_REGIONS
+ mLayer->region.clear();
+#endif
+
glBindFramebuffer(GL_FRAMEBUFFER, mLayer->fbo);
OpenGLRenderer::prepare(opaque);
@@ -79,7 +83,6 @@ void LayerRenderer::generateMesh() {
mLayer->meshIndices = NULL;
mLayer->meshElementCount = 0;
}
- mLayer->region.clear();
return;
}
@@ -131,8 +134,6 @@ void LayerRenderer::generateMesh() {
indices[index + 4] = quad + 1; // top-right
indices[index + 5] = quad + 3; // bottom-right
}
-
- mLayer->region.clear();
#endif
}
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index b06bbd0..92aa4bd 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -1568,29 +1568,31 @@ void OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) {
#if RENDER_LAYERS_AS_REGIONS
- if (layer->region.isRect()) {
- const Rect r(x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight());
- composeLayerRect(layer, r);
- } else if (!layer->region.isEmpty() && layer->mesh) {
- const Rect& rect = layer->layer;
-
- setupDraw();
- setupDrawWithTexture();
- setupDrawColor(alpha, alpha, alpha, alpha);
- setupDrawColorFilter();
- setupDrawBlending(layer->blend || layer->alpha < 255, layer->mode, false);
- setupDrawProgram();
- setupDrawDirtyRegionsDisabled();
- setupDrawPureColorUniforms();
- setupDrawColorFilterUniforms();
- setupDrawTexture(layer->texture);
- setupDrawModelViewTranslate(rect.left, rect.top, rect.right, rect.bottom);
- setupDrawMesh(&layer->mesh[0].position[0], &layer->mesh[0].texture[0]);
-
- glDrawElements(GL_TRIANGLES, layer->meshElementCount,
- GL_UNSIGNED_SHORT, layer->meshIndices);
-
- finishDrawTexture();
+ if (!layer->region.isEmpty()) {
+ if (layer->region.isRect()) {
+ const Rect r(x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight());
+ composeLayerRect(layer, r);
+ } else if (layer->mesh) {
+ const Rect& rect = layer->layer;
+
+ setupDraw();
+ setupDrawWithTexture();
+ setupDrawColor(alpha, alpha, alpha, alpha);
+ setupDrawColorFilter();
+ setupDrawBlending(layer->blend || layer->alpha < 255, layer->mode, false);
+ setupDrawProgram();
+ setupDrawDirtyRegionsDisabled();
+ setupDrawPureColorUniforms();
+ setupDrawColorFilterUniforms();
+ setupDrawTexture(layer->texture);
+ setupDrawModelViewTranslate(rect.left, rect.top, rect.right, rect.bottom);
+ setupDrawMesh(&layer->mesh[0].position[0], &layer->mesh[0].texture[0]);
+
+ glDrawElements(GL_TRIANGLES, layer->meshElementCount,
+ GL_UNSIGNED_SHORT, layer->meshIndices);
+
+ finishDrawTexture();
+ }
}
#else
const Rect r(x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight());