Index: src/core/SkCanvas.cpp |
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
index ce90275047a6466cf9217e32bc0e9505ed8eff36..2f5774634ecdac4f5825a797a174fa1b89dcba2f 100644 |
--- a/src/core/SkCanvas.cpp |
+++ b/src/core/SkCanvas.cpp |
@@ -294,17 +294,21 @@ public: |
SkMatrix fMatrix; |
int fDeferredSaveCount; |
robertphillips
2016/07/12 15:34:32
// This is the current cumulative depth (aggregati
vjiaoblack
2016/07/12 16:03:33
Done.
|
+ SkScalar fCurDrawDepth; |
+ |
MCRec(bool conservativeRasterClip) : fRasterClip(conservativeRasterClip) { |
fFilter = nullptr; |
fLayer = nullptr; |
fTopLayer = nullptr; |
fMatrix.reset(); |
fDeferredSaveCount = 0; |
+ fCurDrawDepth = 0; |
// don't bother initializing fNext |
inc_rec(); |
} |
- MCRec(const MCRec& prev) : fRasterClip(prev.fRasterClip), fMatrix(prev.fMatrix) { |
+ MCRec(const MCRec& prev) : fRasterClip(prev.fRasterClip), fMatrix(prev.fMatrix), |
+ fCurDrawDepth(prev.fCurDrawDepth) { |
fFilter = SkSafeRef(prev.fFilter); |
fLayer = nullptr; |
fTopLayer = prev.fTopLayer; |
@@ -1521,6 +1525,16 @@ void SkCanvas::resetMatrix() { |
this->setMatrix(SkMatrix::I()); |
} |
+void SkCanvas::translateZ(SkScalar z) { |
+ this->checkForDeferredSave(); |
+ this->fMCRec->fCurDrawDepth += z; |
+ this->didTranslateZ(z); |
+} |
+ |
+SkScalar SkCanvas::getZ() const { |
+ return this->fMCRec->fCurDrawDepth; |
+} |
+ |
////////////////////////////////////////////////////////////////////////////// |
void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { |