Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: src/core/SkPictureRecord.cpp

Issue 2127233002: Added the framework for having canvas/recorder/picture record depth_set's. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: updated tests to be more rigorous about translateZ in playback Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // op + scalar
224 size_t size = 1 * kUInt32Size + 1 * sizeof(SkScalar);
225 size_t initialOffset = this->addDraw(TRANSLATE_Z, &size);
226 this->addScalar(z);
227 this->validate(initialOffset, size);
228 this->INHERITED::didTranslateZ(z);
229 }
230
221 static bool regionOpExpands(SkRegion::Op op) { 231 static bool regionOpExpands(SkRegion::Op op) {
222 switch (op) { 232 switch (op) {
223 case SkRegion::kUnion_Op: 233 case SkRegion::kUnion_Op:
224 case SkRegion::kXOR_Op: 234 case SkRegion::kXOR_Op:
225 case SkRegion::kReverseDifference_Op: 235 case SkRegion::kReverseDifference_Op:
226 case SkRegion::kReplace_Op: 236 case SkRegion::kReplace_Op:
227 return true; 237 return true;
228 case SkRegion::kIntersect_Op: 238 case SkRegion::kIntersect_Op:
229 case SkRegion::kDifference_Op: 239 case SkRegion::kDifference_Op:
230 return false; 240 return false;
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 1006
997 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { 1007 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) {
998 int index = fTextBlobRefs.count(); 1008 int index = fTextBlobRefs.count();
999 *fTextBlobRefs.append() = blob; 1009 *fTextBlobRefs.append() = blob;
1000 blob->ref(); 1010 blob->ref();
1001 // follow the convention of recording a 1-based index 1011 // follow the convention of recording a 1-based index
1002 this->addInt(index + 1); 1012 this->addInt(index + 1);
1003 } 1013 }
1004 1014
1005 /////////////////////////////////////////////////////////////////////////////// 1015 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.h ('k') | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698