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

Unified Diff: gm/distantclip.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
« no previous file with comments | « dm/DMUtil.cpp ('k') | gm/gmmain.cpp » ('j') | samplecode/SampleTiling.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/distantclip.cpp
===================================================================
--- gm/distantclip.cpp (revision 14159)
+++ gm/distantclip.cpp (working copy)
@@ -29,11 +29,11 @@
int offset = 35000;
int extents = 1000;
+ SkPictureRecorder recorder;
// We record a picture of huge vertical extents in which we clear the canvas to red, create
// a 'extents' by 'extents' round rect clip at a vertical offset of 'offset', then draw
// green into that.
- SkPicture pict;
- SkCanvas* rec = pict.beginRecording(100, offset + extents);
+ SkCanvas* rec = recorder.beginRecording(100, offset + extents);
rec->drawColor(0xffff0000);
rec->save();
SkRect r = {
@@ -47,18 +47,17 @@
rec->clipPath(p, SkRegion::kIntersect_Op, true);
rec->drawColor(0xff00ff00);
rec->restore();
- pict.endRecording();
+ SkAutoTUnref<SkPicture> pict(recorder.endRecording());
// Next we play that picture into another picture of the same size.
- SkPicture pict2;
- pict.draw(pict2.beginRecording(100, offset + extents));
- pict2.endRecording();
+ pict->draw(recorder.beginRecording(100, offset + extents));
+ SkAutoTUnref<SkPicture> pict2(recorder.endRecording());
// Finally we play the part of that second picture that should be green into the canvas.
canvas->save();
canvas->translate(SkIntToScalar(extents / 2),
SkIntToScalar(-(offset - extents / 2)));
- pict2.draw(canvas);
+ pict2->draw(canvas);
canvas->restore();
// If the image is red, we erroneously decided the clipPath was empty and didn't record
« no previous file with comments | « dm/DMUtil.cpp ('k') | gm/gmmain.cpp » ('j') | samplecode/SampleTiling.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698