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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 | 996 |
1006 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 997 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
1007 int index = fTextBlobRefs.count(); | 998 int index = fTextBlobRefs.count(); |
1008 *fTextBlobRefs.append() = blob; | 999 *fTextBlobRefs.append() = blob; |
1009 blob->ref(); | 1000 blob->ref(); |
1010 // follow the convention of recording a 1-based index | 1001 // follow the convention of recording a 1-based index |
1011 this->addInt(index + 1); | 1002 this->addInt(index + 1); |
1012 } | 1003 } |
1013 | 1004 |
1014 /////////////////////////////////////////////////////////////////////////////// | 1005 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |