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

Unified Diff: samplecode/SampleFilterFuzz.cpp

Issue 311443003: Allow SkPictureImageFilter to be serialized when not run cross-process. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix comment Created 6 years, 7 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 | « no previous file | src/effects/SkPictureImageFilter.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 0cba43c2669b5b0d526d98c21b3ca10395c12b24..7f4c2474fcefc704c583d612bffec14ad5cba801 100644
--- a/samplecode/SampleFilterFuzz.cpp
+++ b/samplecode/SampleFilterFuzz.cpp
@@ -27,6 +27,7 @@
#include "SkOffsetImageFilter.h"
#include "SkPerlinNoiseShader.h"
#include "SkPictureImageFilter.h"
+#include "SkPictureRecorder.h"
#include "SkRandom.h"
#include "SkRectShaderImageFilter.h"
#include "SkTestImageFilters.h"
@@ -206,7 +207,6 @@ static const SkBitmap& make_bitmap() {
return bitmap[R(2)];
}
-#ifdef SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION
static void drawSomething(SkCanvas* canvas) {
SkPaint paint;
@@ -228,7 +228,6 @@ static void drawSomething(SkCanvas* canvas) {
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;
@@ -376,14 +375,12 @@ static SkImageFilter* make_image_filter(bool canBeNull = true) {
break;
case PICTURE:
{
- SkPicture* pict = NULL;
-#ifdef SK_ALLOW_PICTUREIMAGEFILTER_SERIALIZATION
- pict = new SkPicture;
- SkAutoUnref aur(pict);
- drawSomething(pict->beginRecording(kBitmapSize, kBitmapSize));
- pict->endRecording();
-#endif
- filter = SkPictureImageFilter::Create(pict, make_rect());
+ SkRTreeFactory factory;
+ SkPictureRecorder recorder;
+ SkCanvas* recordingCanvas = recorder.beginRecording(kBitmapSize, kBitmapSize, &factory, 0);
+ drawSomething(recordingCanvas);
+ SkAutoTUnref<SkPicture> pict(recorder.endRecording());
+ filter = SkPictureImageFilter::Create(pict.get(), make_rect());
}
break;
default:
« no previous file with comments | « no previous file | src/effects/SkPictureImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698