diff options
author | Chris Craik <ccraik@google.com> | 2014-09-11 19:43:51 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-11 19:43:52 +0000 |
commit | 5be52c11d98ba85c559634bc9be96368332ac78c (patch) | |
tree | 843bd03a402433742f984e850066462d63a01a9b /libs | |
parent | cde5bb45cc86d181d96ee69da1832e6132162871 (diff) | |
parent | 591be6c7af512a7dbae5a7f0cc9890b82af74e58 (diff) | |
download | frameworks_base-5be52c11d98ba85c559634bc9be96368332ac78c.zip frameworks_base-5be52c11d98ba85c559634bc9be96368332ac78c.tar.gz frameworks_base-5be52c11d98ba85c559634bc9be96368332ac78c.tar.bz2 |
Merge "Update HWUI paint filter to understand new location of skia bitmap filter preference" into lmp-dev
Diffstat (limited to 'libs')
-rwxr-xr-x | libs/hwui/OpenGLRenderer.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index dbd273d..31cc1c8 100755 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -54,10 +54,6 @@ namespace android { namespace uirenderer { -/////////////////////////////////////////////////////////////////////////////// -// Defines -/////////////////////////////////////////////////////////////////////////////// - static GLenum getFilter(const SkPaint* paint) { if (!paint || paint->getFilterLevel() != SkPaint::kNone_FilterLevel) { return GL_LINEAR; @@ -3044,21 +3040,35 @@ void OpenGLRenderer::resetPaintFilter() { } void OpenGLRenderer::setupPaintFilter(int clearBits, int setBits) { + // TODO: don't bother with boolean, it's redundant with clear/set bits mDrawModifiers.mHasDrawFilter = true; mDrawModifiers.mPaintFilterClearBits = clearBits & SkPaint::kAllFlags; mDrawModifiers.mPaintFilterSetBits = setBits & SkPaint::kAllFlags; } const SkPaint* OpenGLRenderer::filterPaint(const SkPaint* paint) { + // TODO: use CompatFlagsDrawFilter here, and combine logic with android/graphics/DrawFilter.cpp + // to avoid clobbering 0x02 paint flag + + // Equivalent to the Java Paint's FILTER_BITMAP_FLAG. + static const uint32_t sFilterBitmapFlag = 0x02; + if (CC_LIKELY(!mDrawModifiers.mHasDrawFilter || !paint)) { return paint; } - uint32_t flags = paint->getFlags(); + const uint32_t clearBits = mDrawModifiers.mPaintFilterClearBits; + const uint32_t setBits = mDrawModifiers.mPaintFilterSetBits; + const uint32_t flags = (paint->getFlags() & ~clearBits) | setBits; mFilteredPaint = *paint; - mFilteredPaint.setFlags((flags & ~mDrawModifiers.mPaintFilterClearBits) | - mDrawModifiers.mPaintFilterSetBits); + mFilteredPaint.setFlags(flags); + + // check if paint filter trying to override bitmap filter + if ((clearBits | setBits) & sFilterBitmapFlag) { + mFilteredPaint.setFilterLevel(flags & sFilterBitmapFlag + ? SkPaint::kLow_FilterLevel : SkPaint::kNone_FilterLevel); + } return &mFilteredPaint; } |