diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-13 19:09:42 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-13 19:09:42 +0000 |
commit | 84b18c7e3e042bf206e1ace3d1b6ea5bb929fe51 (patch) | |
tree | 7b46e74e6212283d9efe62a7b6feaad2c009972b /gm/distantclip.cpp | |
parent | c202ea7cc69476a20ad898d6c76bcdbcb18adf74 (diff) |
split SkPictureRecorder out of SkPicture
https://codereview.chromium.org/214953003/
git-svn-id: http://skia.googlecode.com/svn/trunk@14171 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/distantclip.cpp')
-rw-r--r-- | gm/distantclip.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gm/distantclip.cpp b/gm/distantclip.cpp index 6fd14206c4..0f78dbd3ee 100644 --- a/gm/distantclip.cpp +++ b/gm/distantclip.cpp @@ -29,11 +29,11 @@ protected: 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 @@ protected: 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 |