Skip to content

Commit 7e45fc0

Browse files
chethaaseAndroid (Google) Code Review
authored andcommitted
Merge "Fix layer blending bug"
2 parents f6584a7 + a23eed8 commit 7e45fc0

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

libs/hwui/DisplayListRenderer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,10 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, uint32_t width,
818818
indent[i] = ' ';
819819
}
820820
indent[count] = '\0';
821-
DISPLAY_LIST_LOGD("%sStart display list (%p, %s)", (char*) indent + 2, this, mName.string());
821+
Rect* clipRect = renderer.getClipRect();
822+
DISPLAY_LIST_LOGD("%sStart display list (%p, %s), clipRect: %.0f, %.f, %.0f, %.0f",
823+
(char*) indent + 2, this, mName.string(), clipRect->left, clipRect->top,
824+
clipRect->right, clipRect->bottom);
822825
#endif
823826

824827
renderer.startMark(mName.string());

libs/hwui/OpenGLRenderer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
520520
layer->texCoords.set(0.0f, bounds.getHeight() / float(layer->getHeight()),
521521
bounds.getWidth() / float(layer->getWidth()), 0.0f);
522522
layer->setColorFilter(mColorFilter);
523+
layer->setBlend(true);
523524

524525
// Save the layer in the snapshot
525526
snapshot->flags |= Snapshot::kFlagIsLayer;
@@ -1058,6 +1059,10 @@ bool OpenGLRenderer::clipRect(float left, float top, float right, float bottom,
10581059
return !mSnapshot->clipRect->isEmpty();
10591060
}
10601061

1062+
Rect* OpenGLRenderer::getClipRect() {
1063+
return mSnapshot->clipRect;
1064+
}
1065+
10611066
///////////////////////////////////////////////////////////////////////////////
10621067
// Drawing commands
10631068
///////////////////////////////////////////////////////////////////////////////

libs/hwui/OpenGLRenderer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class OpenGLRenderer {
101101
ANDROID_API const Rect& getClipBounds();
102102
ANDROID_API bool quickReject(float left, float top, float right, float bottom);
103103
virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
104+
virtual Rect* getClipRect();
104105

105106
virtual status_t drawDisplayList(DisplayList* displayList, uint32_t width, uint32_t height,
106107
Rect& dirty, int32_t flags, uint32_t level = 0);

0 commit comments

Comments
 (0)