diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-19 20:44:15 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-19 20:44:15 +0000 |
commit | 8ac3658dbf07c25fc204a45c63100274213069cc (patch) | |
tree | d49a643f72f0c8a75137d52be6ff723a100d5e4a /skia | |
parent | 3064e4ca875687c7051c7f7575aecbedeeba8dfd (diff) | |
download | chromium_src-8ac3658dbf07c25fc204a45c63100274213069cc.zip chromium_src-8ac3658dbf07c25fc204a45c63100274213069cc.tar.gz chromium_src-8ac3658dbf07c25fc204a45c63100274213069cc.tar.bz2 |
Check for image filter in analysis canvas.
Without this check, the analysis canvas assumes a solid color rect with
a filter remains a solid color rect.
BUG=354029
R=reveman@chromium.org
Review URL: https://codereview.chromium.org/200923004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258082 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/analysis_canvas.cc | 1 | ||||
-rw-r--r-- | skia/ext/analysis_canvas_unittest.cc | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/skia/ext/analysis_canvas.cc b/skia/ext/analysis_canvas.cc index 6595077..2cd74d8 100644 --- a/skia/ext/analysis_canvas.cc +++ b/skia/ext/analysis_canvas.cc @@ -31,6 +31,7 @@ bool IsSolidColorPaint(const SkPaint& paint) { !paint.getLooper() && !paint.getMaskFilter() && !paint.getColorFilter() && + !paint.getImageFilter() && paint.getStyle() == SkPaint::kFill_Style && (xfermode == SkXfermode::kSrc_Mode || xfermode == SkXfermode::kSrcOver_Mode)); diff --git a/skia/ext/analysis_canvas_unittest.cc b/skia/ext/analysis_canvas_unittest.cc index c4b8de4..bc74053 100644 --- a/skia/ext/analysis_canvas_unittest.cc +++ b/skia/ext/analysis_canvas_unittest.cc @@ -4,8 +4,10 @@ #include "base/compiler_specific.h" #include "skia/ext/analysis_canvas.h" +#include "skia/ext/refptr.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkShader.h" +#include "third_party/skia/include/effects/SkOffsetImageFilter.h" namespace { @@ -177,6 +179,18 @@ TEST(AnalysisCanvasTest, SimpleDrawRect) { EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor)); } +TEST(AnalysisCanvasTest, FilterPaint) { + skia::AnalysisCanvas canvas(255, 255); + SkPaint paint; + + skia::RefPtr<SkImageFilter> filter = skia::AdoptRef(SkOffsetImageFilter::Create(10, 10)); + paint.setImageFilter(filter.get()); + canvas.drawRect(SkRect::MakeWH(255, 255), paint); + + SkColor outputColor; + EXPECT_FALSE(canvas.GetColorIfSolid(&outputColor)); +} + TEST(AnalysisCanvasTest, ClipPath) { skia::AnalysisCanvas canvas(255, 255); |