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::didSetZ(const SkScalar z) { |
| 222 this->validate(fWriter.bytesWritten(), 0); |
| 223 // set Z |
| 224 size_t size = sizeof(SkScalar); |
| 225 size_t initialOffset = this->addDraw(SET_Z, &size); |
| 226 |
| 227 this->validate(initialOffset, size); |
| 228 } |
| 229 |
221 static bool regionOpExpands(SkRegion::Op op) { | 230 static bool regionOpExpands(SkRegion::Op op) { |
222 switch (op) { | 231 switch (op) { |
223 case SkRegion::kUnion_Op: | 232 case SkRegion::kUnion_Op: |
224 case SkRegion::kXOR_Op: | 233 case SkRegion::kXOR_Op: |
225 case SkRegion::kReverseDifference_Op: | 234 case SkRegion::kReverseDifference_Op: |
226 case SkRegion::kReplace_Op: | 235 case SkRegion::kReplace_Op: |
227 return true; | 236 return true; |
228 case SkRegion::kIntersect_Op: | 237 case SkRegion::kIntersect_Op: |
229 case SkRegion::kDifference_Op: | 238 case SkRegion::kDifference_Op: |
230 return false; | 239 return false; |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 | 1005 |
997 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 1006 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
998 int index = fTextBlobRefs.count(); | 1007 int index = fTextBlobRefs.count(); |
999 *fTextBlobRefs.append() = blob; | 1008 *fTextBlobRefs.append() = blob; |
1000 blob->ref(); | 1009 blob->ref(); |
1001 // follow the convention of recording a 1-based index | 1010 // follow the convention of recording a 1-based index |
1002 this->addInt(index + 1); | 1011 this->addInt(index + 1); |
1003 } | 1012 } |
1004 | 1013 |
1005 /////////////////////////////////////////////////////////////////////////////// | 1014 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |