summaryrefslogtreecommitdiffstats
path: root/libs/hwui/LayerRenderer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/LayerRenderer.cpp')
-rw-r--r--libs/hwui/LayerRenderer.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index f2e7f66..3484d41 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -18,6 +18,8 @@
#include <ui/Rect.h>
+#include <private/hwui/DrawGlInfo.h>
+
#include "LayerCache.h"
#include "LayerRenderer.h"
#include "Matrix.h"
@@ -41,7 +43,8 @@ void LayerRenderer::setViewport(int width, int height) {
initViewport(width, height);
}
-int LayerRenderer::prepareDirty(float left, float top, float right, float bottom, bool opaque) {
+status_t LayerRenderer::prepareDirty(float left, float top, float right, float bottom,
+ bool opaque) {
LAYER_RENDERER_LOGD("Rendering into layer, fbo = %d", mLayer->getFbo());
glBindFramebuffer(GL_FRAMEBUFFER, mLayer->getFbo());
@@ -63,6 +66,20 @@ int LayerRenderer::prepareDirty(float left, float top, float right, float bottom
return OpenGLRenderer::prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, opaque);
}
+status_t LayerRenderer::clear(float left, float top, float right, float bottom, bool opaque) {
+ if (mLayer->isDirty()) {
+ getCaches().disableScissor();
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ getCaches().resetScissor();
+ mLayer->setDirty(false);
+
+ return DrawGlInfo::kStatusDone;
+ }
+
+ return OpenGLRenderer::clear(left, top, right, bottom, opaque);
+}
+
void LayerRenderer::finish() {
OpenGLRenderer::finish();
@@ -201,6 +218,7 @@ Layer* LayerRenderer::createLayer(uint32_t width, uint32_t height, bool isOpaque
layer->setAlpha(255, SkXfermode::kSrcOver_Mode);
layer->setBlend(!isOpaque);
layer->setColorFilter(NULL);
+ layer->setDirty(true);
layer->region.clear();
GLuint previousFbo;
@@ -229,9 +247,6 @@ Layer* LayerRenderer::createLayer(uint32_t width, uint32_t height, bool isOpaque
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
layer->getTexture(), 0);
- caches.disableScissor();
- glClear(GL_COLOR_BUFFER_BIT);
-
glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
return layer;