Implement SkPictureImageFilter bounds computation.
SkPictureImageFilter::onFilterBounds() was unimplemented, causing
incorrect results for SVG filters and impl-side painting (see Chrome
bug https://code.google.com/p/chromium/issues/detail?id=375162).
BUG=skia:
R=reed@google.com
Review URL: https://codereview.chromium.org/306733003
git-svn-id: http://skia.googlecode.com/svn/trunk@15003 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 48e86dd..35585ac 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -25,6 +25,7 @@
#include "SkMorphologyImageFilter.h"
#include "SkOffsetImageFilter.h"
#include "SkPicture.h"
+#include "SkPictureImageFilter.h"
#include "SkPictureRecorder.h"
#include "SkRect.h"
#include "SkTileImageFilter.h"
@@ -307,6 +308,16 @@
matrix.setTranslate(SK_Scalar1, SK_Scalar1);
matrix.postRotate(SkIntToScalar(45), SK_Scalar1, SK_Scalar1);
+ SkRTreeFactory factory;
+ SkPictureRecorder recorder;
+ SkCanvas* recordingCanvas = recorder.beginRecording(64, 64, &factory, 0);
+
+ SkPaint greenPaint;
+ greenPaint.setColor(SK_ColorGREEN);
+ recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 30, 20)), greenPaint);
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording());
+ SkAutoTUnref<SkImageFilter> pictureFilter(SkPictureImageFilter::Create(picture.get()));
+
struct {
const char* fName;
SkImageFilter* fFilter;
@@ -335,6 +346,7 @@
SkRect::MakeXYWH(0, 0, 100, 100), NULL) },
{ "matrix", SkMatrixImageFilter::Create(matrix, SkPaint::kLow_FilterLevel) },
{ "blur and offset", SkOffsetImageFilter::Create(five, five, blur.get()) },
+ { "picture and blur", SkBlurImageFilter::Create(five, five, pictureFilter.get()) },
};
SkBitmap untiledResult, tiledResult;