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_DEPRECATED_JAN_2016: { | 486 case SAVE_LAYER_SAVELAYERFLAGS: { |
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; | |
509 case SCALE: { | 491 case SCALE: { |
510 SkScalar sx = reader->readScalar(); | 492 SkScalar sx = reader->readScalar(); |
511 SkScalar sy = reader->readScalar(); | 493 SkScalar sy = reader->readScalar(); |
512 canvas->scale(sx, sy); | 494 canvas->scale(sx, sy); |
513 } break; | 495 } break; |
514 case SET_MATRIX: { | 496 case SET_MATRIX: { |
515 SkMatrix matrix; | 497 SkMatrix matrix; |
516 reader->readMatrix(&matrix); | 498 reader->readMatrix(&matrix); |
517 matrix.postConcat(initialMatrix); | 499 matrix.postConcat(initialMatrix); |
518 canvas->setMatrix(matrix); | 500 canvas->setMatrix(matrix); |
519 } break; | 501 } break; |
520 case SKEW: { | 502 case SKEW: { |
521 SkScalar sx = reader->readScalar(); | 503 SkScalar sx = reader->readScalar(); |
522 SkScalar sy = reader->readScalar(); | 504 SkScalar sy = reader->readScalar(); |
523 canvas->skew(sx, sy); | 505 canvas->skew(sx, sy); |
524 } break; | 506 } break; |
525 case TRANSLATE: { | 507 case TRANSLATE: { |
526 SkScalar dx = reader->readScalar(); | 508 SkScalar dx = reader->readScalar(); |
527 SkScalar dy = reader->readScalar(); | 509 SkScalar dy = reader->readScalar(); |
528 canvas->translate(dx, dy); | 510 canvas->translate(dx, dy); |
529 } break; | 511 } break; |
530 default: | 512 default: |
531 SkASSERTF(false, "Unknown draw type: %d", op); | 513 SkASSERTF(false, "Unknown draw type: %d", op); |
532 } | 514 } |
533 } | 515 } |
534 | 516 |
OLD | NEW |