Index: gm/offsetimagefilter.cpp |
diff --git a/gm/offsetimagefilter.cpp b/gm/offsetimagefilter.cpp |
index 4c8242a4b22741cdd09fa64e46f2cd1292e1f20f..bb2eae19d534d5f948789c8b05af2904639e679c 100644 |
--- a/gm/offsetimagefilter.cpp |
+++ b/gm/offsetimagefilter.cpp |
@@ -114,7 +114,7 @@ protected: |
return SkString("simple-offsetimagefilter"); |
} |
- SkISize onISize() override { return SkISize::Make(140, 60); } |
+ SkISize onISize() override { return SkISize::Make(640, 200); } |
void doDraw(SkCanvas* canvas, const SkRect& r, SkImageFilter* imgf, |
const SkRect* clipR = NULL) { |
@@ -155,33 +155,55 @@ protected: |
} |
void onDraw(SkCanvas* canvas) override { |
- const SkRect r = SkRect::MakeWH(10, 10); |
+ const SkRect r = SkRect::MakeWH(40, 40); |
SkImageFilter::CropRect cr0(r); |
- SkImageFilter::CropRect cr1(SkRect::MakeWH(5, 5)); |
- const SkRect r2 = SkRect::MakeXYWH(10, 0, 10, 10); |
+ SkImageFilter::CropRect cr1(SkRect::MakeWH(20, 20)); |
+ const SkRect r2 = SkRect::MakeXYWH(40, 0, 40, 40); |
SkImageFilter::CropRect cr2(r2); |
- canvas->translate(20, 20); |
- this->doDraw(canvas, r, NULL); |
+ canvas->translate(40, 40); |
- canvas->translate(20, 0); |
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(5, 5)); |
+ canvas->save(); |
robertphillips
2015/06/24 16:23:53
// 0,0: rect draw - no offset
?
|
+ this->doDraw(canvas, r, NULL); |
robertphillips
2015/06/24 16:23:53
// 1,0: offset rect draw
?
|
- canvas->translate(20, 0); |
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(5, 5, NULL, &cr0)); |
+ canvas->translate(100, 0); |
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20)); |
robertphillips
2015/06/24 16:23:53
// 2,0: offset rect draw with crop rect - 3/4 of t
|
- canvas->translate(20, 0); |
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(5, 5), &r); |
+ canvas->translate(100, 0); |
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, &cr0)); |
- canvas->translate(20, 0); |
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(5, 5, NULL, &cr1)); |
+ canvas->translate(100, 0); |
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20), &r); |
- SkRect clipR = SkRect::MakeXYWH(10, 10, 10, 10); |
- canvas->translate(20, 0); |
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(5, 5, NULL, NULL), &clipR); |
+ canvas->translate(100, 0); |
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, &cr1)); |
- canvas->translate(20, 0); |
- this->doDraw(canvas, r, SkOffsetImageFilter::Create(10, 0, NULL, &cr2), NULL); |
+ SkRect clipR = SkRect::MakeXYWH(40, 40, 40, 40); |
+ canvas->translate(100, 0); |
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(20, 20, NULL, NULL), &clipR); |
+ canvas->restore(); |
+ |
+ // 2nd row |
+ canvas->translate(0, 80); |
+ |
+ /* |
+ * combos of clip and crop rects that align with src and dst |
+ */ |
+ |
+ // crop==clip==src |
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr0), &r); |
+ |
+ // crop==src, clip==dst |
+ canvas->translate(100, 0); |
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr0), &r2); |
+ |
+ // crop==dst, clip==src |
+ canvas->translate(100, 0); |
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr2), &r); |
+ |
+ // crop==clip==dst |
+ canvas->translate(100, 0); |
+ this->doDraw(canvas, r, SkOffsetImageFilter::Create(40, 0, NULL, &cr2), &r2); |
} |
private: |