diff options
author | Romain Guy <romainguy@google.com> | 2010-11-03 19:58:32 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-11-03 19:58:32 -0700 |
commit | e45362cad94c014d8b3765cb102db0f8c0d92500 (patch) | |
tree | 184c8a507c06f077668e294203ae370823fcb5e5 /libs/hwui/OpenGLRenderer.cpp | |
parent | 5ec9924d24495822b589f1a17996655d66273b30 (diff) | |
download | frameworks_base-e45362cad94c014d8b3765cb102db0f8c0d92500.zip frameworks_base-e45362cad94c014d8b3765cb102db0f8c0d92500.tar.gz frameworks_base-e45362cad94c014d8b3765cb102db0f8c0d92500.tar.bz2 |
Fix rendering bug with saveLayerAlpha/drawColor.
drawColor() was not calling quickReject because it fills the clip region
and thus always passes the test. However, quickReject also checks whether
the current layer is invisible. drawColor() now performs the same check
and avoid drawing inside an invisible layer.
Change-Id: I63d0e9a8a9c0fba774f0f5c3870d58e6ed96fbd1
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 855a4e0..09e01f6 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -260,25 +260,25 @@ int OpenGLRenderer::saveLayer(float left, float top, float right, float bottom, const GLuint previousFbo = mSnapshot->fbo; const int count = saveSnapshot(flags); - int alpha = 255; - SkXfermode::Mode mode; - - if (p) { - alpha = p->getAlpha(); - if (!mCaches.extensions.hasFramebufferFetch()) { - const bool isMode = SkXfermode::IsMode(p->getXfermode(), &mode); - if (!isMode) { - // Assume SRC_OVER - mode = SkXfermode::kSrcOver_Mode; + if (!mSnapshot->invisible) { + int alpha = 255; + SkXfermode::Mode mode; + + if (p) { + alpha = p->getAlpha(); + if (!mCaches.extensions.hasFramebufferFetch()) { + const bool isMode = SkXfermode::IsMode(p->getXfermode(), &mode); + if (!isMode) { + // Assume SRC_OVER + mode = SkXfermode::kSrcOver_Mode; + } + } else { + mode = getXfermode(p->getXfermode()); } } else { - mode = getXfermode(p->getXfermode()); + mode = SkXfermode::kSrcOver_Mode; } - } else { - mode = SkXfermode::kSrcOver_Mode; - } - if (!mSnapshot->previous->invisible) { createLayer(mSnapshot, left, top, right, bottom, alpha, mode, flags, previousFbo); } @@ -379,8 +379,7 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top, bounds.getHeight() > mCaches.maxTextureSize) { snapshot->invisible = true; } else { - snapshot->invisible = snapshot->previous->invisible || - (alpha <= ALPHA_THRESHOLD && fboLayer); + snapshot->invisible = snapshot->invisible || (alpha <= ALPHA_THRESHOLD && fboLayer); } // Bail out if we won't draw in this snapshot @@ -1011,6 +1010,9 @@ void OpenGLRenderer::drawLines(float* points, int count, SkPaint* paint) { } void OpenGLRenderer::drawColor(int color, SkXfermode::Mode mode) { + // No need to check against the clip, we fill the clip region + if (mSnapshot->invisible) return; + Rect& clip(*mSnapshot->clipRect); clip.snapToPixelBoundaries(); drawColorRect(clip.left, clip.top, clip.right, clip.bottom, color, mode, true); |