| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 void SkPictureRecord::didSetMatrix(const SkMatrix& matrix) { | 211 void SkPictureRecord::didSetMatrix(const SkMatrix& matrix) { |
| 212 this->validate(fWriter.bytesWritten(), 0); | 212 this->validate(fWriter.bytesWritten(), 0); |
| 213 // op + matrix | 213 // op + matrix |
| 214 size_t size = kUInt32Size + matrix.writeToMemory(nullptr); | 214 size_t size = kUInt32Size + matrix.writeToMemory(nullptr); |
| 215 size_t initialOffset = this->addDraw(SET_MATRIX, &size); | 215 size_t initialOffset = this->addDraw(SET_MATRIX, &size); |
| 216 this->addMatrix(matrix); | 216 this->addMatrix(matrix); |
| 217 this->validate(initialOffset, size); | 217 this->validate(initialOffset, size); |
| 218 this->INHERITED::didSetMatrix(matrix); | 218 this->INHERITED::didSetMatrix(matrix); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void SkPictureRecord::didTranslateZ(SkScalar z) { | |
| 222 this->validate(fWriter.bytesWritten(), 0); | |
| 223 // set Z | |
| 224 size_t size = sizeof(SkScalar); | |
| 225 size_t initialOffset = this->addDraw(TRANSLATE_Z, &size); | |
| 226 | |
| 227 this->validate(initialOffset, size); | |
| 228 } | |
| 229 | |
| 230 static bool regionOpExpands(SkRegion::Op op) { | 221 static bool regionOpExpands(SkRegion::Op op) { |
| 231 switch (op) { | 222 switch (op) { |
| 232 case SkRegion::kUnion_Op: | 223 case SkRegion::kUnion_Op: |
| 233 case SkRegion::kXOR_Op: | 224 case SkRegion::kXOR_Op: |
| 234 case SkRegion::kReverseDifference_Op: | 225 case SkRegion::kReverseDifference_Op: |
| 235 case SkRegion::kReplace_Op: | 226 case SkRegion::kReplace_Op: |
| 236 return true; | 227 return true; |
| 237 case SkRegion::kIntersect_Op: | 228 case SkRegion::kIntersect_Op: |
| 238 case SkRegion::kDifference_Op: | 229 case SkRegion::kDifference_Op: |
| 239 return false; | 230 return false; |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 | 1020 |
| 1030 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 1021 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
| 1031 int index = fTextBlobRefs.count(); | 1022 int index = fTextBlobRefs.count(); |
| 1032 *fTextBlobRefs.append() = blob; | 1023 *fTextBlobRefs.append() = blob; |
| 1033 blob->ref(); | 1024 blob->ref(); |
| 1034 // follow the convention of recording a 1-based index | 1025 // follow the convention of recording a 1-based index |
| 1035 this->addInt(index + 1); | 1026 this->addInt(index + 1); |
| 1036 } | 1027 } |
| 1037 | 1028 |
| 1038 /////////////////////////////////////////////////////////////////////////////// | 1029 /////////////////////////////////////////////////////////////////////////////// |
| OLD | NEW |