OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkPatchUtils.h" | 9 #include "SkPatchUtils.h" |
10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } break; | 536 } break; |
537 case RESTORE: | 537 case RESTORE: |
538 canvas->restore(); | 538 canvas->restore(); |
539 break; | 539 break; |
540 case ROTATE: | 540 case ROTATE: |
541 canvas->rotate(reader->readScalar()); | 541 canvas->rotate(reader->readScalar()); |
542 break; | 542 break; |
543 case SAVE: | 543 case SAVE: |
544 // SKPs with version < 29 also store a SaveFlags param. | 544 // SKPs with version < 29 also store a SaveFlags param. |
545 if (size > 4) { | 545 if (size > 4) { |
546 SkASSERT(8 == size); | 546 if (reader->validate(8 == size)) { |
547 reader->readInt(); | 547 reader->readInt(); |
| 548 } |
548 } | 549 } |
549 canvas->save(); | 550 canvas->save(); |
550 break; | 551 break; |
551 case SAVE_LAYER_SAVEFLAGS_DEPRECATED: { | 552 case SAVE_LAYER_SAVEFLAGS_DEPRECATED: { |
552 SkRect storage; | 553 SkRect storage; |
553 const SkRect* boundsPtr = get_rect_ptr(reader, &storage); | 554 const SkRect* boundsPtr = get_rect_ptr(reader, &storage); |
554 const SkPaint* paint = fPictureData->getPaint(reader); | 555 const SkPaint* paint = fPictureData->getPaint(reader); |
555 auto flags = SkCanvas::LegacySaveFlagsToSaveLayerFlags(reader->readI
nt()); | 556 auto flags = SkCanvas::LegacySaveFlagsToSaveLayerFlags(reader->readI
nt()); |
556 canvas->saveLayer(SkCanvas::SaveLayerRec(boundsPtr, paint, flags)); | 557 canvas->saveLayer(SkCanvas::SaveLayerRec(boundsPtr, paint, flags)); |
557 } break; | 558 } break; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 } break; | 600 } break; |
600 case TRANSLATE: { | 601 case TRANSLATE: { |
601 SkScalar dx = reader->readScalar(); | 602 SkScalar dx = reader->readScalar(); |
602 SkScalar dy = reader->readScalar(); | 603 SkScalar dy = reader->readScalar(); |
603 canvas->translate(dx, dy); | 604 canvas->translate(dx, dy); |
604 } break; | 605 } break; |
605 default: | 606 default: |
606 SkASSERTF(false, "Unknown draw type: %d", op); | 607 SkASSERTF(false, "Unknown draw type: %d", op); |
607 } | 608 } |
608 } | 609 } |
OLD | NEW |