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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 reader->readInt(); | 476 reader->readInt(); |
477 } | 477 } |
478 canvas->save(); | 478 canvas->save(); |
479 break; | 479 break; |
480 case SAVE_LAYER_SAVEFLAGS_DEPRECATED: { | 480 case SAVE_LAYER_SAVEFLAGS_DEPRECATED: { |
481 const SkRect* boundsPtr = get_rect_ptr(reader); | 481 const SkRect* boundsPtr = get_rect_ptr(reader); |
482 const SkPaint* paint = fPictureData->getPaint(reader); | 482 const SkPaint* paint = fPictureData->getPaint(reader); |
483 auto flags = SkCanvas::LegacySaveFlagsToSaveLayerFlags(reader->readI
nt()); | 483 auto flags = SkCanvas::LegacySaveFlagsToSaveLayerFlags(reader->readI
nt()); |
484 canvas->saveLayer(SkCanvas::SaveLayerRec(boundsPtr, paint, flags)); | 484 canvas->saveLayer(SkCanvas::SaveLayerRec(boundsPtr, paint, flags)); |
485 } break; | 485 } break; |
486 case SAVE_LAYER_SAVELAYERFLAGS: { | 486 case SAVE_LAYER_SAVELAYERFLAGS_DEPRECATED_JAN_2016: { |
487 const SkRect* boundsPtr = get_rect_ptr(reader); | 487 const SkRect* boundsPtr = get_rect_ptr(reader); |
488 const SkPaint* paint = fPictureData->getPaint(reader); | 488 const SkPaint* paint = fPictureData->getPaint(reader); |
489 canvas->saveLayer(SkCanvas::SaveLayerRec(boundsPtr, paint, reader->r
eadInt())); | 489 canvas->saveLayer(SkCanvas::SaveLayerRec(boundsPtr, paint, reader->r
eadInt())); |
490 } break; | 490 } break; |
| 491 case SAVE_LAYER_SAVELAYERREC: { |
| 492 SkCanvas::SaveLayerRec rec(nullptr, nullptr, nullptr, 0); |
| 493 const uint32_t flatFlags = reader->readInt(); |
| 494 if (flatFlags & SAVELAYERREC_HAS_BOUNDS) { |
| 495 rec.fBounds = &reader->skipT<SkRect>(); |
| 496 } |
| 497 if (flatFlags & SAVELAYERREC_HAS_PAINT) { |
| 498 rec.fPaint = fPictureData->getPaint(reader); |
| 499 } |
| 500 if (flatFlags & SAVELAYERREC_HAS_BACKDROP) { |
| 501 const SkPaint* paint = fPictureData->getPaint(reader); |
| 502 rec.fBackdrop = paint->getImageFilter(); |
| 503 } |
| 504 if (flatFlags & SAVELAYERREC_HAS_FLAGS) { |
| 505 rec.fSaveLayerFlags = reader->readInt(); |
| 506 } |
| 507 canvas->saveLayer(rec); |
| 508 } break; |
491 case SCALE: { | 509 case SCALE: { |
492 SkScalar sx = reader->readScalar(); | 510 SkScalar sx = reader->readScalar(); |
493 SkScalar sy = reader->readScalar(); | 511 SkScalar sy = reader->readScalar(); |
494 canvas->scale(sx, sy); | 512 canvas->scale(sx, sy); |
495 } break; | 513 } break; |
496 case SET_MATRIX: { | 514 case SET_MATRIX: { |
497 SkMatrix matrix; | 515 SkMatrix matrix; |
498 reader->readMatrix(&matrix); | 516 reader->readMatrix(&matrix); |
499 matrix.postConcat(initialMatrix); | 517 matrix.postConcat(initialMatrix); |
500 canvas->setMatrix(matrix); | 518 canvas->setMatrix(matrix); |
501 } break; | 519 } break; |
502 case SKEW: { | 520 case SKEW: { |
503 SkScalar sx = reader->readScalar(); | 521 SkScalar sx = reader->readScalar(); |
504 SkScalar sy = reader->readScalar(); | 522 SkScalar sy = reader->readScalar(); |
505 canvas->skew(sx, sy); | 523 canvas->skew(sx, sy); |
506 } break; | 524 } break; |
507 case TRANSLATE: { | 525 case TRANSLATE: { |
508 SkScalar dx = reader->readScalar(); | 526 SkScalar dx = reader->readScalar(); |
509 SkScalar dy = reader->readScalar(); | 527 SkScalar dy = reader->readScalar(); |
510 canvas->translate(dx, dy); | 528 canvas->translate(dx, dy); |
511 } break; | 529 } break; |
512 default: | 530 default: |
513 SkASSERTF(false, "Unknown draw type: %d", op); | 531 SkASSERTF(false, "Unknown draw type: %d", op); |
514 } | 532 } |
515 } | 533 } |
516 | 534 |
OLD | NEW |