diff options
author | Romain Guy <romainguy@google.com> | 2013-02-27 11:53:12 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2013-02-27 11:53:12 -0800 |
commit | 758724fd09a1599f2c55130f81953cfa6c17c300 (patch) | |
tree | ca84f352115851317bf012534a69d748def6092e /libs/hwui/OpenGLRenderer.cpp | |
parent | c0e55bd3cfe1d7be2276e4f528fee2231763a5c1 (diff) | |
download | frameworks_base-758724fd09a1599f2c55130f81953cfa6c17c300.zip frameworks_base-758724fd09a1599f2c55130f81953cfa6c17c300.tar.gz frameworks_base-758724fd09a1599f2c55130f81953cfa6c17c300.tar.bz2 |
Don't increment the paint's generation ID when drawing bitmaps
When the renderer draws a bitmap as part of a display list with an
alpha < 1.0f, the paint is temporarily modified to alter the opacity
of the bitmap. This has the side effect of increasing the paint's
generation ID counter which can break paint caching.
Change-Id: I5055d059ad1639829fa50af3d946e296c4dab877
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 34d1c98..9df0c58 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -2942,8 +2942,14 @@ void OpenGLRenderer::setupPaintFilter(int clearBits, int setBits) { mDrawModifiers.mPaintFilterSetBits = setBits & SkPaint::kAllFlags; } -SkPaint* OpenGLRenderer::filterPaint(SkPaint* paint) { - if (CC_LIKELY(!mDrawModifiers.mHasDrawFilter || !paint)) return paint; +SkPaint* OpenGLRenderer::filterPaint(SkPaint* paint, bool alwaysCopy) { + if (CC_LIKELY(!mDrawModifiers.mHasDrawFilter || !paint)) { + if (CC_UNLIKELY(alwaysCopy)) { + mFilteredPaint = *paint; + return &mFilteredPaint; + } + return paint; + } uint32_t flags = paint->getFlags(); |