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

Side by Side Diff: src/core/SkPicture.cpp

Issue 168983003: change PictureRecord (and its private subclasses) to take size instead of device (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkBBoxRecord.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkPictureFlat.h" 10 #include "SkPictureFlat.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 SkCanvas* SkPicture::beginRecording(int width, int height, 187 SkCanvas* SkPicture::beginRecording(int width, int height,
188 uint32_t recordingFlags) { 188 uint32_t recordingFlags) {
189 if (fPlayback) { 189 if (fPlayback) {
190 SkDELETE(fPlayback); 190 SkDELETE(fPlayback);
191 fPlayback = NULL; 191 fPlayback = NULL;
192 } 192 }
193 193
194 SkSafeSetNull(fRecord); 194 SkSafeSetNull(fRecord);
195 195
196 SkBitmap bm;
197 bm.setConfig(SkBitmap::kNo_Config, width, height);
198 SkAutoTUnref<SkBaseDevice> dev(SkNEW_ARGS(SkBitmapDevice, (bm)));
199
200 // Must be set before calling createBBoxHierarchy 196 // Must be set before calling createBBoxHierarchy
201 fWidth = width; 197 fWidth = width;
202 fHeight = height; 198 fHeight = height;
203 199
200 const SkISize size = SkISize::Make(width, height);
201
204 if (recordingFlags & kOptimizeForClippedPlayback_RecordingFlag) { 202 if (recordingFlags & kOptimizeForClippedPlayback_RecordingFlag) {
205 SkBBoxHierarchy* tree = this->createBBoxHierarchy(); 203 SkBBoxHierarchy* tree = this->createBBoxHierarchy();
206 SkASSERT(NULL != tree); 204 SkASSERT(NULL != tree);
207 fRecord = SkNEW_ARGS(SkBBoxHierarchyRecord, (recordingFlags, tree, dev)) ; 205 fRecord = SkNEW_ARGS(SkBBoxHierarchyRecord, (size, recordingFlags, tree) );
208 tree->unref(); 206 tree->unref();
209 } else { 207 } else {
210 fRecord = SkNEW_ARGS(SkPictureRecord, (recordingFlags, dev)); 208 fRecord = SkNEW_ARGS(SkPictureRecord, (size, recordingFlags));
211 } 209 }
212 fRecord->beginRecording(); 210 fRecord->beginRecording();
213 211
214 return fRecord; 212 return fRecord;
215 } 213 }
216 214
217 SkBBoxHierarchy* SkPicture::createBBoxHierarchy() const { 215 SkBBoxHierarchy* SkPicture::createBBoxHierarchy() const {
218 // These values were empirically determined to produce reasonable 216 // These values were empirically determined to produce reasonable
219 // performance in most cases. 217 // performance in most cases.
220 static const int kRTreeMinChildren = 6; 218 static const int kRTreeMinChildren = 6;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 424 }
427 425
428 #ifdef SK_BUILD_FOR_ANDROID 426 #ifdef SK_BUILD_FOR_ANDROID
429 void SkPicture::abortPlayback() { 427 void SkPicture::abortPlayback() {
430 if (NULL == fPlayback) { 428 if (NULL == fPlayback) {
431 return; 429 return;
432 } 430 }
433 fPlayback->abort(); 431 fPlayback->abort();
434 } 432 }
435 #endif 433 #endif
OLDNEW
« no previous file with comments | « src/core/SkBBoxRecord.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698