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

Side by Side Diff: samplecode/SamplePictFile.cpp

Issue 540963002: Change SkPicture::draw to playback (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkDumpCanvas.h" 9 #include "SkDumpCanvas.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 if (false) { 139 if (false) {
140 SkSurface* surf = SkSurface::NewRasterPMColor(SkScalarCeilToInt( pic->cullRect().width()), 140 SkSurface* surf = SkSurface::NewRasterPMColor(SkScalarCeilToInt( pic->cullRect().width()),
141 SkScalarCeilToInt( pic->cullRect().height())); 141 SkScalarCeilToInt( pic->cullRect().height()));
142 surf->getCanvas()->drawPicture(pic); 142 surf->getCanvas()->drawPicture(pic);
143 surf->unref(); 143 surf->unref();
144 } 144 }
145 if (false) { // re-record 145 if (false) { // re-record
146 SkPictureRecorder recorder; 146 SkPictureRecorder recorder;
147 pic->draw(recorder.beginRecording(pic->cullRect().width(), 147 pic->playback(recorder.beginRecording(pic->cullRect().width(),
148 pic->cullRect().height(), 148 pic->cullRect().height(),
149 NULL, 0)); 149 NULL, 0));
150 SkAutoTUnref<SkPicture> p2(recorder.endRecording()); 150 SkAutoTUnref<SkPicture> p2(recorder.endRecording());
151 151
152 SkString path2(path); 152 SkString path2(path);
153 path2.append(".new.skp"); 153 path2.append(".new.skp");
154 SkFILEWStream writer(path2.c_str()); 154 SkFILEWStream writer(path2.c_str());
155 p2->serialize(&writer); 155 p2->serialize(&writer);
156 } 156 }
157 } 157 }
158 158
159 if (NULL == pic) { 159 if (NULL == pic) {
(...skipping 15 matching lines...) Expand all
175 gridInfo.fOffset = SkIPoint::Make(0, 0); 175 gridInfo.fOffset = SkIPoint::Make(0, 0);
176 gridInfo.fTileInterval = fTileSize.toRound(); 176 gridInfo.fTileInterval = fTileSize.toRound();
177 factory.reset(SkNEW_ARGS(SkTileGridFactory, (gridInfo))); 177 factory.reset(SkNEW_ARGS(SkTileGridFactory, (gridInfo)));
178 break; 178 break;
179 } 179 }
180 default: 180 default:
181 SkASSERT(false); 181 SkASSERT(false);
182 } 182 }
183 183
184 SkPictureRecorder recorder; 184 SkPictureRecorder recorder;
185 pic->draw(recorder.beginRecording(pic->cullRect().width(), 185 pic->playback(recorder.beginRecording(pic->cullRect().width(),
186 pic->cullRect().height(), 186 pic->cullRect().height(),
187 factory.get(), 0)); 187 factory.get(), 0));
188 return recorder.endRecording(); 188 return recorder.endRecording();
189 } 189 }
190 190
191 typedef SampleView INHERITED; 191 typedef SampleView INHERITED;
192 }; 192 };
193 193
194 SampleView* CreateSamplePictFileView(const char filename[]); 194 SampleView* CreateSamplePictFileView(const char filename[]);
195 SampleView* CreateSamplePictFileView(const char filename[]) { 195 SampleView* CreateSamplePictFileView(const char filename[]) {
196 return new PictFileView(filename); 196 return new PictFileView(filename);
197 } 197 }
198 198
199 ////////////////////////////////////////////////////////////////////////////// 199 //////////////////////////////////////////////////////////////////////////////
200 200
201 #if 0 201 #if 0
202 static SkView* MyFactory() { return new PictFileView; } 202 static SkView* MyFactory() { return new PictFileView; }
203 static SkViewRegister reg(MyFactory); 203 static SkViewRegister reg(MyFactory);
204 #endif 204 #endif
OLDNEW
« include/core/SkPicture.h ('K') | « samplecode/SampleApp.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698