Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1820)

Unified Diff: gm/pictureimagefilter.cpp

Issue 787073003: Adding an option for pixelated rendering in SkPictureImageFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: filter level Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/core/SkPicture.h » ('j') | src/effects/SkPictureImageFilter.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/pictureimagefilter.cpp
diff --git a/gm/pictureimagefilter.cpp b/gm/pictureimagefilter.cpp
index 712e059a6dfc2b78fef1827524bc27b7bb9e5bac..bae94f58f5f9edd6ef7697045a45e6802521ecae 100644
--- a/gm/pictureimagefilter.cpp
+++ b/gm/pictureimagefilter.cpp
@@ -36,7 +36,7 @@ protected:
fPicture.reset(recorder.endRecording());
}
- virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(400, 300); }
+ virtual SkISize onISize() SK_OVERRIDE { return SkISize::Make(600, 300); }
virtual void onOnceBeforeDraw() SK_OVERRIDE {
this->makePicture();
@@ -64,7 +64,11 @@ protected:
SkAutoTUnref<SkPictureImageFilter> pictureSourceEmptyRect(
SkPictureImageFilter::Create(fPicture, emptyRect));
SkAutoTUnref<SkPictureImageFilter> pictureSourceResampled(
- SkPictureImageFilter::CreateForLocalSpace(fPicture, fPicture->cullRect()));
+ SkPictureImageFilter::CreateForLocalSpace(fPicture, fPicture->cullRect(),
+ SkPaint::kLow_FilterLevel));
+ SkAutoTUnref<SkPictureImageFilter> pictureSourcePixelated(
+ SkPictureImageFilter::CreateForLocalSpace(fPicture, fPicture->cullRect(),
+ SkPaint::kNone_FilterLevel));
canvas->save();
// Draw the picture unscaled.
@@ -90,6 +94,10 @@ protected:
// Draw the picture scaled, but rasterized at original resolution
canvas->translate(srcRect.width(), 0);
fillRectFiltered(canvas, srcRect, pictureSourceResampled);
+
+ // Draw the picture scaled, pixelated
+ canvas->translate(srcRect.width(), 0);
+ fillRectFiltered(canvas, srcRect, pictureSourcePixelated);
}
}
« no previous file with comments | « no previous file | include/core/SkPicture.h » ('j') | src/effects/SkPictureImageFilter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698