diff options
author | mtklein <mtklein@google.com> | 2014-11-11 12:13:16 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-11 12:13:16 -0800 |
commit | c71ffd4e76d1abcd28ac74463349970f60a3350f (patch) | |
tree | 877cd0e3f16471ca0096a2526852a205107bc379 | |
parent | d5688c509293a450c058e0cc1f4673be2931bb5c (diff) |
Revert of modify nothingToDraw to notice filters (patchset #1 id:1 of https://codereview.chromium.org/717753002/)
Reason for revert:
modecolorfilters, perhaps more changed
Original issue's description:
> modify nothingToDraw to notice filters
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/d5688c509293a450c058e0cc1f4673be2931bb5c
TBR=djsollen@google.com,reed@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/717813002
-rw-r--r-- | src/core/SkPaint.cpp | 17 | ||||
-rw-r--r-- | tests/PaintTest.cpp | 27 |
2 files changed, 1 insertions, 43 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 4ccfce235a..ebdc866d65 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -2377,18 +2377,6 @@ bool SkTextToPathIter::next(const SkPath** path, SkScalar* xpos) { /////////////////////////////////////////////////////////////////////////////// -// return true if the filter exists, and may affect alpha -static bool affects_alpha(const SkColorFilter* cf) { - return cf && !(cf->getFlags() & SkColorFilter::kAlphaUnchanged_Flag); -} - -// return true if the filter exists, and may affect alpha -static bool affects_alpha(const SkImageFilter* imf) { - // TODO: check if we should allow imagefilters to broadcast that they don't affect alpha - // ala colorfilters - return imf != NULL; -} - bool SkPaint::nothingToDraw() const { if (fLooper) { return false; @@ -2401,10 +2389,7 @@ bool SkPaint::nothingToDraw() const { case SkXfermode::kDstOut_Mode: case SkXfermode::kDstOver_Mode: case SkXfermode::kPlus_Mode: - if (0 == this->getAlpha()) { - return !affects_alpha(fColorFilter) && !affects_alpha(fImageFilter); - } - break; + return 0 == this->getAlpha(); case SkXfermode::kDst_Mode: return true; default: diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp index c307aa94bc..4c45eed761 100644 --- a/tests/PaintTest.cpp +++ b/tests/PaintTest.cpp @@ -344,30 +344,3 @@ DEF_TEST(Paint_getHash, r) { paint.setHinting(SkPaint::kNormal_Hinting); REPORTER_ASSERT(r, paint.getHash() == defaultHash); } - -#include "SkColorMatrixFilter.h" - -DEF_TEST(Paint_nothingToDraw, r) { - SkPaint paint; - - REPORTER_ASSERT(r, !paint.nothingToDraw()); - paint.setAlpha(0); - REPORTER_ASSERT(r, paint.nothingToDraw()); - - paint.setAlpha(0xFF); - paint.setXfermodeMode(SkXfermode::kDst_Mode); - REPORTER_ASSERT(r, paint.nothingToDraw()); - - paint.setAlpha(0); - paint.setXfermodeMode(SkXfermode::kSrcOver_Mode); - - SkColorMatrix cm; - cm.setIdentity(); // does not change alpha - paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); - REPORTER_ASSERT(r, paint.nothingToDraw()); - - cm.postTranslate(0, 0, 0, 1); // wacks alpha - paint.setColorFilter(SkColorMatrixFilter::Create(cm))->unref(); - REPORTER_ASSERT(r, !paint.nothingToDraw()); -} - |