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

Unified Diff: samplecode/SampleFilterFuzz.cpp

Issue 143163005: Revert of Revert "Serialization of SkPictureImageFilter" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months 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 | « include/effects/SkPictureImageFilter.h ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleFilterFuzz.cpp
diff --git a/samplecode/SampleFilterFuzz.cpp b/samplecode/SampleFilterFuzz.cpp
index f77f3b814de8099401f92daf30e2a17ee6b521cd..4ef7d4033a897b0ed4cffa29a092f3d437991db5 100644
--- a/samplecode/SampleFilterFuzz.cpp
+++ b/samplecode/SampleFilterFuzz.cpp
@@ -184,6 +184,30 @@
return bitmap[R(2)];
}
+#ifdef SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION
+static void drawSomething(SkCanvas* canvas) {
+ SkPaint paint;
+
+ canvas->save();
+ canvas->scale(0.5f, 0.5f);
+ canvas->drawBitmap(make_bitmap(), 0, 0, NULL);
+ canvas->restore();
+
+ const char beforeStr[] = "before circle";
+ const char afterStr[] = "after circle";
+
+ paint.setAntiAlias(true);
+
+ paint.setColor(SK_ColorRED);
+ canvas->drawData(beforeStr, sizeof(beforeStr));
+ canvas->drawCircle(SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/3), paint);
+ canvas->drawData(afterStr, sizeof(afterStr));
+ paint.setColor(SK_ColorBLACK);
+ paint.setTextSize(SkIntToScalar(kBitmapSize/3));
+ canvas->drawText("Picture", 7, SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/4), paint);
+}
+#endif
+
static SkImageFilter* make_image_filter(bool canBeNull = true) {
SkImageFilter* filter = 0;
@@ -294,7 +318,16 @@
filter = new SkTileImageFilter(make_rect(), make_rect(), make_image_filter(false));
break;
case PICTURE:
- filter = new SkPictureImageFilter(NULL, make_rect());
+ {
+ SkPicture* pict = NULL;
+#ifdef SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION
+ pict = new SkPicture;
+ SkAutoUnref aur(pict);
+ drawSomething(pict->beginRecording(kBitmapSize, kBitmapSize));
+ pict->endRecording();
+#endif
+ filter = new SkPictureImageFilter(pict, make_rect());
+ }
break;
default:
break;
« no previous file with comments | « include/effects/SkPictureImageFilter.h ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698