| 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 "SkImage_Base.h" | 9 #include "SkImage_Base.h" |
| 10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); | 665 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); |
| 666 size += m.writeToMemory(nullptr) + kUInt32Size; // matrix + paint | 666 size += m.writeToMemory(nullptr) + kUInt32Size; // matrix + paint |
| 667 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size); | 667 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size); |
| 668 this->addPaintPtr(paint); | 668 this->addPaintPtr(paint); |
| 669 this->addMatrix(m); | 669 this->addMatrix(m); |
| 670 this->addPicture(picture); | 670 this->addPicture(picture); |
| 671 } | 671 } |
| 672 this->validate(initialOffset, size); | 672 this->validate(initialOffset, size); |
| 673 } | 673 } |
| 674 | 674 |
| 675 void SkPictureRecord::onDrawShadowedPicture(const SkPicture* picture, |
| 676 const SkMatrix* matrix, |
| 677 const SkPaint* paint) { |
| 678 // op + picture index |
| 679 size_t size = 2 * kUInt32Size; |
| 680 size_t initialOffset; |
| 681 |
| 682 if (nullptr == matrix && nullptr == paint) { |
| 683 initialOffset = this->addDraw(DRAW_PICTURE, &size); |
| 684 this->addPicture(picture); |
| 685 } else { |
| 686 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); |
| 687 size += m.writeToMemory(nullptr) + kUInt32Size; // matrix + paint |
| 688 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size); |
| 689 this->addPaintPtr(paint); |
| 690 this->addMatrix(m); |
| 691 this->addPicture(picture); |
| 692 } |
| 693 this->validate(initialOffset, size); |
| 694 } |
| 695 |
| 675 void SkPictureRecord::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matri
x) { | 696 void SkPictureRecord::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matri
x) { |
| 676 // op + drawable index | 697 // op + drawable index |
| 677 size_t size = 2 * kUInt32Size; | 698 size_t size = 2 * kUInt32Size; |
| 678 size_t initialOffset; | 699 size_t initialOffset; |
| 679 | 700 |
| 680 if (nullptr == matrix) { | 701 if (nullptr == matrix) { |
| 681 initialOffset = this->addDraw(DRAW_DRAWABLE, &size); | 702 initialOffset = this->addDraw(DRAW_DRAWABLE, &size); |
| 682 this->addDrawable(drawable); | 703 this->addDrawable(drawable); |
| 683 } else { | 704 } else { |
| 684 size += matrix->writeToMemory(nullptr); // matrix | 705 size += matrix->writeToMemory(nullptr); // matrix |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 | 1051 |
| 1031 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 1052 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
| 1032 int index = fTextBlobRefs.count(); | 1053 int index = fTextBlobRefs.count(); |
| 1033 *fTextBlobRefs.append() = blob; | 1054 *fTextBlobRefs.append() = blob; |
| 1034 blob->ref(); | 1055 blob->ref(); |
| 1035 // follow the convention of recording a 1-based index | 1056 // follow the convention of recording a 1-based index |
| 1036 this->addInt(index + 1); | 1057 this->addInt(index + 1); |
| 1037 } | 1058 } |
| 1038 | 1059 |
| 1039 /////////////////////////////////////////////////////////////////////////////// | 1060 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |