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

Unified Diff: gm/gmmain.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/gmmain.cpp
===================================================================
--- gm/gmmain.cpp (revision 14159)
+++ gm/gmmain.cpp (working copy)
@@ -1008,29 +1008,25 @@
static SkPicture* generate_new_picture(GM* gm, BbhType bbhType, uint32_t recordFlags,
SkScalar scale = SK_Scalar1) {
- // Pictures are refcounted so must be on heap
- SkPicture* pict;
int width = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().width()), scale));
int height = SkScalarCeilToInt(SkScalarMul(SkIntToScalar(gm->getISize().height()), scale));
+ SkAutoTUnref<SkPictureFactory> factory;
if (kTileGrid_BbhType == bbhType) {
SkTileGridPicture::TileGridInfo info;
info.fMargin.setEmpty();
info.fOffset.setZero();
info.fTileInterval.set(16, 16);
- pict = new SkTileGridPicture(width, height, info);
- } else {
- pict = new SkPicture;
+ factory.reset(SkNEW_ARGS(SkTileGridPictureFactory, (info)));
}
if (kNone_BbhType != bbhType) {
recordFlags |= SkPicture::kOptimizeForClippedPlayback_RecordingFlag;
}
- SkCanvas* cv = pict->beginRecording(width, height, recordFlags);
+ SkPictureRecorder recorder(factory);
+ SkCanvas* cv = recorder.beginRecording(width, height, recordFlags);
cv->scale(scale, scale);
invokeGM(gm, cv, false, false);
- pict->endRecording();
-
- return pict;
+ return recorder.endRecording();
}
static SkPicture* stream_to_new_picture(const SkPicture& src) {
« no previous file with comments | « gm/distantclip.cpp ('k') | gm/optimizations.cpp » ('j') | samplecode/SampleTiling.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698