diff options
Diffstat (limited to 'gm')
-rw-r--r-- | gm/imagefilterscropped.cpp | 5 | ||||
-rw-r--r-- | gm/lighting.cpp | 6 | ||||
-rw-r--r-- | gm/morphology.cpp | 6 | ||||
-rw-r--r-- | gm/offsetimagefilter.cpp | 7 | ||||
-rw-r--r-- | gm/xfermodeimagefilter.cpp | 7 |
5 files changed, 27 insertions, 4 deletions
diff --git a/gm/imagefilterscropped.cpp b/gm/imagefilterscropped.cpp index 767973d07d..bdf925cc44 100644 --- a/gm/imagefilterscropped.cpp +++ b/gm/imagefilterscropped.cpp @@ -133,8 +133,13 @@ protected: SkAutoTUnref<SkColorFilter> cf( SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode)); +#ifdef SK_CROP_RECT_IS_INT SkIRect cropRect = SkIRect::MakeXYWH(10, 10, 44, 44); SkIRect bogusRect = SkIRect::MakeXYWH(-100, -100, 10, 10); +#else + SkImageFilter::CropRect cropRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 44, 44)), SkImageFilter::CropRect::kHasAll_CropEdge); + SkImageFilter::CropRect bogusRect(SkRect::Make(SkIRect::MakeXYWH(-100, -100, 10, 10)), SkImageFilter::CropRect::kHasAll_CropEdge); +#endif SkAutoTUnref<SkImageFilter> offset(new SkOffsetImageFilter( SkIntToScalar(-10), SkIntToScalar(-10))); diff --git a/gm/lighting.cpp b/gm/lighting.cpp index 891d63a5e4..50dceb44e1 100644 --- a/gm/lighting.cpp +++ b/gm/lighting.cpp @@ -85,11 +85,15 @@ protected: SkColor white(0xFFFFFFFF); SkPaint paint; +#ifdef SK_CROP_RECT_IS_INT SkIRect cropRect = SkIRect::MakeXYWH(20, 10, 60, 65); +#else + SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 10, 60, 65)); +#endif int y = 0; for (int i = 0; i < 2; i++) { - const SkIRect* cr = (i == 0) ? NULL : &cropRect; + const SkImageFilter::CropRect* cr = (i == 0) ? NULL : &cropRect; paint.setImageFilter(SkLightingImageFilter::CreatePointLitDiffuse(pointLocation, white, surfaceScale, kd, NULL, cr))->unref(); drawClippedBitmap(canvas, paint, 0, y); diff --git a/gm/morphology.cpp b/gm/morphology.cpp index 2150689b87..9e67bfaa73 100644 --- a/gm/morphology.cpp +++ b/gm/morphology.cpp @@ -70,11 +70,15 @@ protected: { 24, 24, 25, 25 }, }; SkPaint paint; +#ifdef SK_CROP_RECT_IS_INT SkIRect cropRect = SkIRect::MakeXYWH(25, 20, 100, 80); +#else + SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(25, 20, 100, 80)); +#endif for (unsigned j = 0; j < 4; ++j) { for (unsigned i = 0; i < SK_ARRAY_COUNT(samples); ++i) { - const SkIRect* cr = j & 0x02 ? &cropRect : NULL; + const SkImageFilter::CropRect* cr = j & 0x02 ? &cropRect : NULL; if (j & 0x01) { paint.setImageFilter(new SkErodeImageFilter( samples[i].fRadiusX, diff --git a/gm/offsetimagefilter.cpp b/gm/offsetimagefilter.cpp index ee4ae35b43..52a8b817f2 100644 --- a/gm/offsetimagefilter.cpp +++ b/gm/offsetimagefilter.cpp @@ -92,11 +92,16 @@ protected: y + i * 8, bitmap->width() - i * 8, bitmap->height() - i * 12); +#ifdef SK_CROP_RECT_IS_INT + SkIRect rect = cropRect; +#else + SkImageFilter::CropRect rect(SkRect::Make(cropRect)); +#endif SkAutoTUnref<SkImageFilter> tileInput(SkNEW_ARGS(SkBitmapSource, (*bitmap))); SkScalar dx = SkIntToScalar(i*5); SkScalar dy = SkIntToScalar(i*10); SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS( - SkOffsetImageFilter, (dx, dy, tileInput, &cropRect))); + SkOffsetImageFilter, (dx, dy, tileInput, &rect))); paint.setImageFilter(filter); drawClippedBitmap(canvas, *bitmap, paint, SkIntToScalar(x), SkIntToScalar(y)); x += bitmap->width() + MARGIN; diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp index ef2958a0c3..1e9e4d87da 100644 --- a/gm/xfermodeimagefilter.cpp +++ b/gm/xfermodeimagefilter.cpp @@ -207,9 +207,14 @@ protected: y + offsets[i][1], fBitmap.width() + offsets[i][2], fBitmap.height() + offsets[i][3]); +#ifdef SK_CROP_RECT_IS_INT + SkIRect rect = cropRect; +#else + SkImageFilter::CropRect rect(SkRect::Make(cropRect)); +#endif mode.reset(SkXfermode::Create(sampledModes[i])); filter.reset(SkNEW_ARGS(SkXfermodeImageFilter, - (mode, offsetBackground, offsetForeground, &cropRect))); + (mode, offsetBackground, offsetForeground, &rect))); paint.setImageFilter(filter); canvas->save(); canvas->clipRect(SkRect::MakeXYWH(SkIntToScalar(x), |