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

Unified Diff: gm/optimizations.cpp

Issue 214953003: split SkPictureRecorder out of SkPicture (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: update to ToT (again) Created 6 years, 8 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
Index: gm/optimizations.cpp
===================================================================
--- gm/optimizations.cpp (revision 14159)
+++ gm/optimizations.cpp (working copy)
@@ -79,11 +79,11 @@
(*postOptPattern)[6] = RESTORE;
}
- SkPicture* result = new SkPicture;
+ SkPictureRecorder recorder;
+ SkCanvas* canvas = recorder.beginRecording(100, 100);
// have to disable the optimizations while generating the picture
- SkCanvas* canvas = result->beginRecording(100, 100);
- result->internalOnly_EnableOpts(false);
+ recorder.internalOnly_EnableOpts(false);
SkPaint saveLayerPaint;
saveLayerPaint.setColor(0xCC000000);
@@ -112,9 +112,7 @@
}
canvas->restore();
- result->endRecording();
-
- return result;
+ return recorder.endRecording();
}
// straight-ahead version that is seen in the skps
@@ -215,11 +213,11 @@
(*postOptPattern)[9] = RESTORE;
}
- SkPicture* result = new SkPicture;
+ SkPictureRecorder recorder;
+ SkCanvas* canvas = recorder.beginRecording(100, 100);
// have to disable the optimizations while generating the picture
- SkCanvas* canvas = result->beginRecording(100, 100);
- result->internalOnly_EnableOpts(false);
+ recorder.internalOnly_EnableOpts(false);
SkPaint saveLayerPaint;
saveLayerPaint.setColor(0xCC000000);
@@ -252,9 +250,7 @@
canvas->restore();
canvas->restore();
- result->endRecording();
-
- return result;
+ return recorder.endRecording();
}
// straight-ahead version that is seen in the skps
@@ -360,13 +356,13 @@
canvas->restore();
// re-render the 'pre' picture and thus 'apply' the optimization
- SkAutoTUnref<SkPicture> post(new SkPicture);
+ SkPictureRecorder recorder;
- SkCanvas* recordCanvas = post->beginRecording(pre->width(), pre->height());
+ SkCanvas* recordCanvas = recorder.beginRecording(pre->width(), pre->height());
pre->draw(recordCanvas);
- post->endRecording();
+ SkAutoTUnref<SkPicture> post(recorder.endRecording());
if (!(check_pattern(*post, postPattern))) {
WARN("Post optimization pattern mismatch");
« no previous file with comments | « gm/gmmain.cpp ('k') | gm/pathopsskpclip.cpp » ('j') | samplecode/SampleTiling.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698