OSDN Git Service

Fix blending behavior with first draw op
authorChris Craik <ccraik@google.com>
Fri, 1 Sep 2017 00:28:20 +0000 (17:28 -0700)
committerChris Craik <ccraik@google.com>
Fri, 1 Sep 2017 00:45:39 +0000 (17:45 -0700)
commite47aadd9b8e34601e8b1665865ad111224fe2018
tree6a1175b4fdafb0d7b345e84cb7711f5a4044ebc5
parent530a2b44d9a4b40d028c912ade858da73081ed85
Fix blending behavior with first draw op

Bug: 65077146
Test: Manual - uirendering tests don't allow test draw content
to be displayed first.

It's not always valid to disable blending on the first draw to the framebuffer,
since some blend modes affect the framebuffer in different ways. We now only
disable blending if the op is SRC_OVER to be safe.

For example:

    canvas.drawColor(0xfeff0000, PorterDuff.Mode.CLEAR);
    canvas.drawColor(Color.BLUE, PorterDuff.Mode.DST_OVER);

The BLUE should always be seen - the other draw should just clear the buffer.
Prior to this fix, the above code (put in a window background) would draw black.

In addition, this removes the disable behavior in drawRects(), since that should
never benefit from the optimization - that decoration is always drawn at the end
of a frame.

Change-Id: I34e8d9d62d6e1dfa00e9301f44c277475f2940a8
libs/hwui/BakedOpRenderer.cpp