| OLD | NEW |
| 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 Loading... |
| 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 // offset of 0 has been disabled, so we skip it | 327 // assert that the final offset value points to a save verb |
| 328 if (offset > 0) { | 328 uint32_t opSize; |
| 329 // assert that the final offset value points to a save verb | 329 DrawType drawOp = peek_op_and_size(&fWriter, -offset, &opSize); |
| 330 uint32_t opSize; | 330 SkASSERT(SAVE == drawOp || SAVE_LAYER == drawOp); |
| 331 DrawType drawOp = peek_op_and_size(&fWriter, -offset, &opSize); | |
| 332 SkASSERT(SAVE == drawOp || SAVE_LAYER == drawOp); | |
| 333 } | |
| 334 #endif | 331 #endif |
| 335 } | 332 } |
| 336 | 333 |
| 337 void SkPictureRecord::beginRecording() { | 334 void SkPictureRecord::beginRecording() { |
| 338 // we have to call this *after* our constructor, to ensure that it gets | 335 // we have to call this *after* our constructor, to ensure that it gets |
| 339 // recorded. This is balanced by restoreToCount() call from endRecording, | 336 // recorded. This is balanced by restoreToCount() call from endRecording, |
| 340 // which in-turn calls our overridden restore(), so those get recorded too. | 337 // which in-turn calls our overridden restore(), so those get recorded too. |
| 341 fInitialSaveCount = this->save(); | 338 fInitialSaveCount = this->save(); |
| 342 } | 339 } |
| 343 | 340 |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 1040 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
| 1044 int index = fTextBlobRefs.count(); | 1041 int index = fTextBlobRefs.count(); |
| 1045 *fTextBlobRefs.append() = blob; | 1042 *fTextBlobRefs.append() = blob; |
| 1046 blob->ref(); | 1043 blob->ref(); |
| 1047 // follow the convention of recording a 1-based index | 1044 // follow the convention of recording a 1-based index |
| 1048 this->addInt(index + 1); | 1045 this->addInt(index + 1); |
| 1049 } | 1046 } |
| 1050 | 1047 |
| 1051 /////////////////////////////////////////////////////////////////////////////// | 1048 /////////////////////////////////////////////////////////////////////////////// |
| 1052 | 1049 |
| OLD | NEW |