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

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

Issue 767333002: Defer saves() until they're needed (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update tests Created 6 years 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
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | tests/PictureBBHTest.cpp » ('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 * 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 "SkPictureRecord.h" 8 #include "SkPictureRecord.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 void SkPictureRecord::fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffset) { 318 void SkPictureRecord::fillRestoreOffsetPlaceholdersForCurrentStackLevel(uint32_t restoreOffset) {
319 int32_t offset = fRestoreOffsetStack.top(); 319 int32_t offset = fRestoreOffsetStack.top();
320 while (offset > 0) { 320 while (offset > 0) {
321 uint32_t peek = fWriter.readTAt<uint32_t>(offset); 321 uint32_t peek = fWriter.readTAt<uint32_t>(offset);
322 fWriter.overwriteTAt(offset, restoreOffset); 322 fWriter.overwriteTAt(offset, restoreOffset);
323 offset = peek; 323 offset = peek;
324 } 324 }
325 325
326 #ifdef SK_DEBUG 326 #ifdef SK_DEBUG
327 // assert that the final offset value points to a save verb 327 // offset of 0 has been disabled, so we skip it
328 uint32_t opSize; 328 if (offset > 0) {
329 DrawType drawOp = peek_op_and_size(&fWriter, -offset, &opSize); 329 // assert that the final offset value points to a save verb
330 SkASSERT(SAVE == drawOp || SAVE_LAYER == drawOp); 330 uint32_t opSize;
331 DrawType drawOp = peek_op_and_size(&fWriter, -offset, &opSize);
332 SkASSERT(SAVE == drawOp || SAVE_LAYER == drawOp);
333 }
331 #endif 334 #endif
332 } 335 }
333 336
334 void SkPictureRecord::beginRecording() { 337 void SkPictureRecord::beginRecording() {
335 // we have to call this *after* our constructor, to ensure that it gets 338 // we have to call this *after* our constructor, to ensure that it gets
336 // recorded. This is balanced by restoreToCount() call from endRecording, 339 // recorded. This is balanced by restoreToCount() call from endRecording,
337 // which in-turn calls our overridden restore(), so those get recorded too. 340 // which in-turn calls our overridden restore(), so those get recorded too.
338 fInitialSaveCount = this->save(); 341 fInitialSaveCount = this->save();
339 } 342 }
340 343
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { 1043 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) {
1041 int index = fTextBlobRefs.count(); 1044 int index = fTextBlobRefs.count();
1042 *fTextBlobRefs.append() = blob; 1045 *fTextBlobRefs.append() = blob;
1043 blob->ref(); 1046 blob->ref();
1044 // follow the convention of recording a 1-based index 1047 // follow the convention of recording a 1-based index
1045 this->addInt(index + 1); 1048 this->addInt(index + 1);
1046 } 1049 }
1047 1050
1048 /////////////////////////////////////////////////////////////////////////////// 1051 ///////////////////////////////////////////////////////////////////////////////
1049 1052
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | tests/PictureBBHTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698