| 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 "SkTSearch.h" | 9 #include "SkTSearch.h" |
| 10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 offset = -offset; | 504 offset = -offset; |
| 505 uint32_t opSize; | 505 uint32_t opSize; |
| 506 DrawType op = peek_op_and_size(writer, offset, &opSize); | 506 DrawType op = peek_op_and_size(writer, offset, &opSize); |
| 507 if (SAVE_LAYER == op) { | 507 if (SAVE_LAYER == op) { |
| 508 // not ready to cull these out yet (mrr) | 508 // not ready to cull these out yet (mrr) |
| 509 return false; | 509 return false; |
| 510 } | 510 } |
| 511 SkASSERT(SAVE == op); | 511 SkASSERT(SAVE == op); |
| 512 SkASSERT(kSaveSize == opSize); | 512 SkASSERT(kSaveSize == opSize); |
| 513 | 513 |
| 514 #ifdef SK_SUPPORT_LEGACY_SAVEFLAGS |
| 514 // get the save flag (last 4-bytes of the space allocated for the opSize) | 515 // get the save flag (last 4-bytes of the space allocated for the opSize) |
| 515 SkCanvas::SaveFlags saveFlags = (SkCanvas::SaveFlags) writer->readTAt<uint32
_t>(offset + 4); | 516 SkCanvas::SaveFlags saveFlags = (SkCanvas::SaveFlags) writer->readTAt<uint32
_t>(offset + 4); |
| 516 if (SkCanvas::kMatrixClip_SaveFlag != saveFlags) { | 517 if (SkCanvas::kMatrixClip_SaveFlag != saveFlags) { |
| 517 // This function's optimization is only correct for kMatrixClip style sa
ves. | 518 // This function's optimization is only correct for kMatrixClip style sa
ves. |
| 518 // TODO: set checkMatrix & checkClip booleans here and then check for th
e | 519 // TODO: set checkMatrix & checkClip booleans here and then check for th
e |
| 519 // offending operations in the following loop. | 520 // offending operations in the following loop. |
| 520 return false; | 521 return false; |
| 521 } | 522 } |
| 523 #endif |
| 522 | 524 |
| 523 // Walk forward until we get back to either a draw-verb (abort) or we hit | 525 // Walk forward until we get back to either a draw-verb (abort) or we hit |
| 524 // our restore (success). | 526 // our restore (success). |
| 525 int32_t saveOffset = offset; | 527 int32_t saveOffset = offset; |
| 526 | 528 |
| 527 offset += opSize; | 529 offset += opSize; |
| 528 while (offset < restoreOffset) { | 530 while (offset < restoreOffset) { |
| 529 op = peek_op_and_size(writer, offset, &opSize); | 531 op = peek_op_and_size(writer, offset, &opSize); |
| 530 if (is_drawing_op(op) || (SAVE_LAYER == op)) { | 532 if (is_drawing_op(op) || (SAVE_LAYER == op)) { |
| 531 // drawing verb, abort | 533 // drawing verb, abort |
| (...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 void SkPictureRecord::validateRegions() const { | 1809 void SkPictureRecord::validateRegions() const { |
| 1808 int count = fRegions.count(); | 1810 int count = fRegions.count(); |
| 1809 SkASSERT((unsigned) count < 0x1000); | 1811 SkASSERT((unsigned) count < 0x1000); |
| 1810 for (int index = 0; index < count; index++) { | 1812 for (int index = 0; index < count; index++) { |
| 1811 const SkFlatData* region = fRegions[index]; | 1813 const SkFlatData* region = fRegions[index]; |
| 1812 SkASSERT(region); | 1814 SkASSERT(region); |
| 1813 // region->validate(); | 1815 // region->validate(); |
| 1814 } | 1816 } |
| 1815 } | 1817 } |
| 1816 #endif | 1818 #endif |
| OLD | NEW |