| 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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size); | 687 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size); |
| 688 this->addPaintPtr(paint); | 688 this->addPaintPtr(paint); |
| 689 this->addMatrix(m); | 689 this->addMatrix(m); |
| 690 this->addPicture(picture); | 690 this->addPicture(picture); |
| 691 } | 691 } |
| 692 this->validate(initialOffset, size); | 692 this->validate(initialOffset, size); |
| 693 } | 693 } |
| 694 | 694 |
| 695 void SkPictureRecord::onDrawShadowedPicture(const SkPicture* picture, | 695 void SkPictureRecord::onDrawShadowedPicture(const SkPicture* picture, |
| 696 const SkMatrix* matrix, | 696 const SkMatrix* matrix, |
| 697 const SkPaint* paint) { | 697 const SkPaint* paint, |
| 698 SkShadowType sType) { |
| 698 // op + picture index | 699 // op + picture index |
| 699 size_t size = 2 * kUInt32Size; | 700 size_t size = 2 * kUInt32Size; |
| 700 size_t initialOffset; | 701 size_t initialOffset; |
| 701 | 702 |
| 702 if (nullptr == matrix && nullptr == paint) { | 703 if (nullptr == matrix && nullptr == paint) { |
| 703 initialOffset = this->addDraw(DRAW_PICTURE, &size); | 704 initialOffset = this->addDraw(DRAW_PICTURE, &size); |
| 704 this->addPicture(picture); | 705 this->addPicture(picture); |
| 705 } else { | 706 } else { |
| 706 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); | 707 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); |
| 707 size += m.writeToMemory(nullptr) + kUInt32Size; // matrix + paint | 708 size += m.writeToMemory(nullptr) + kUInt32Size; // matrix + paint |
| 708 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size); | 709 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size); |
| 709 this->addPaintPtr(paint); | 710 this->addPaintPtr(paint); |
| 710 this->addMatrix(m); | 711 this->addMatrix(m); |
| 711 this->addPicture(picture); | 712 this->addPicture(picture); |
| 712 } | 713 } |
| 714 |
| 715 size += sizeof(sType); |
| 713 this->validate(initialOffset, size); | 716 this->validate(initialOffset, size); |
| 714 } | 717 } |
| 715 | 718 |
| 716 void SkPictureRecord::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matri
x) { | 719 void SkPictureRecord::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matri
x) { |
| 717 // op + drawable index | 720 // op + drawable index |
| 718 size_t size = 2 * kUInt32Size; | 721 size_t size = 2 * kUInt32Size; |
| 719 size_t initialOffset; | 722 size_t initialOffset; |
| 720 | 723 |
| 721 if (nullptr == matrix) { | 724 if (nullptr == matrix) { |
| 722 initialOffset = this->addDraw(DRAW_DRAWABLE, &size); | 725 initialOffset = this->addDraw(DRAW_DRAWABLE, &size); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 | 1074 |
| 1072 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 1075 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
| 1073 int index = fTextBlobRefs.count(); | 1076 int index = fTextBlobRefs.count(); |
| 1074 *fTextBlobRefs.append() = blob; | 1077 *fTextBlobRefs.append() = blob; |
| 1075 blob->ref(); | 1078 blob->ref(); |
| 1076 // follow the convention of recording a 1-based index | 1079 // follow the convention of recording a 1-based index |
| 1077 this->addInt(index + 1); | 1080 this->addInt(index + 1); |
| 1078 } | 1081 } |
| 1079 | 1082 |
| 1080 /////////////////////////////////////////////////////////////////////////////// | 1083 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |