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

Side by Side Diff: src/core/SkCanvas.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 requested changes (more functions, added to Debug, etc) 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
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 "SkBitmapDevice.h" 8 #include "SkBitmapDevice.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasPriv.h" 10 #include "SkCanvasPriv.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 one that is at or below this level in the stack (so we know what 287 one that is at or below this level in the stack (so we know what
288 bitmap/device to draw into from this level. This value is NOT 288 bitmap/device to draw into from this level. This value is NOT
289 reference counted, since the real owner is either our fLayer field, 289 reference counted, since the real owner is either our fLayer field,
290 or a previous one in a lower level.) 290 or a previous one in a lower level.)
291 */ 291 */
292 DeviceCM* fTopLayer; 292 DeviceCM* fTopLayer;
293 SkRasterClip fRasterClip; 293 SkRasterClip fRasterClip;
294 SkMatrix fMatrix; 294 SkMatrix fMatrix;
295 int fDeferredSaveCount; 295 int fDeferredSaveCount;
296 296
297 SkScalar fCurDrawDepth;
298
297 MCRec(bool conservativeRasterClip) : fRasterClip(conservativeRasterClip) { 299 MCRec(bool conservativeRasterClip) : fRasterClip(conservativeRasterClip) {
298 fFilter = nullptr; 300 fFilter = nullptr;
299 fLayer = nullptr; 301 fLayer = nullptr;
300 fTopLayer = nullptr; 302 fTopLayer = nullptr;
301 fMatrix.reset(); 303 fMatrix.reset();
302 fDeferredSaveCount = 0; 304 fDeferredSaveCount = 0;
303 305
304 // don't bother initializing fNext 306 // don't bother initializing fNext
305 inc_rec(); 307 inc_rec();
306 } 308 }
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 void SkCanvas::setMatrix(const SkMatrix& matrix) { 1516 void SkCanvas::setMatrix(const SkMatrix& matrix) {
1515 this->checkForDeferredSave(); 1517 this->checkForDeferredSave();
1516 this->internalSetMatrix(matrix); 1518 this->internalSetMatrix(matrix);
1517 this->didSetMatrix(matrix); 1519 this->didSetMatrix(matrix);
1518 } 1520 }
1519 1521
1520 void SkCanvas::resetMatrix() { 1522 void SkCanvas::resetMatrix() {
1521 this->setMatrix(SkMatrix::I()); 1523 this->setMatrix(SkMatrix::I());
1522 } 1524 }
1523 1525
1526 void SkCanvas::setZ(SkScalar z) {
1527 this->fMCRec->fCurDrawDepth = z;
1528 this->didSetZ(z);
1529 }
1530
robertphillips 2016/07/08 17:26:43 not uint32_t
vjiaoblack 2016/07/11 18:04:42 Done.
1531 uint32_t SkCanvas::getZ() const {
1532 return this->fMCRec->fCurDrawDepth;
1533 }
1534
1535
1524 ////////////////////////////////////////////////////////////////////////////// 1536 //////////////////////////////////////////////////////////////////////////////
1525 1537
1526 void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { 1538 void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
1527 if (!fAllowSoftClip) { 1539 if (!fAllowSoftClip) {
1528 doAA = false; 1540 doAA = false;
1529 } 1541 }
1530 1542
1531 #ifdef SK_SUPPORT_PRECHECK_CLIPRECT 1543 #ifdef SK_SUPPORT_PRECHECK_CLIPRECT
1532 // Check if we can quick-accept the clip call (and do nothing) 1544 // Check if we can quick-accept the clip call (and do nothing)
1533 // 1545 //
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
3094 3106
3095 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 3107 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
3096 fCanvas->restoreToCount(fSaveCount); 3108 fCanvas->restoreToCount(fSaveCount);
3097 } 3109 }
3098 3110
3099 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API 3111 #ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
3100 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) { 3112 SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* p rops) {
3101 return this->makeSurface(info, props).release(); 3113 return this->makeSurface(info, props).release();
3102 } 3114 }
3103 #endif 3115 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698