diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-19 15:15:24 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-19 15:15:24 +0000 |
commit | 0a98d870448f66ea0df7c37a47b38cf2d3b734e5 (patch) | |
tree | dbb7d62f7226e2bc050e7277d2f5e5623adae175 /src/record | |
parent | 71db88225d4e26303b5c3ad2c44305f6a5660754 (diff) |
Don't clobber initial transform with SetMatrix.
BUG=skia:2378
R=reed@google.com, mtklein@google.com, robertphillips@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/290883004
git-svn-id: http://skia.googlecode.com/svn/trunk@14778 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/record')
-rw-r--r-- | src/record/SkRecordDraw.cpp | 8 | ||||
-rw-r--r-- | src/record/SkRecordDraw.h | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/record/SkRecordDraw.cpp b/src/record/SkRecordDraw.cpp index 324946e5d7..5df1650a5e 100644 --- a/src/record/SkRecordDraw.cpp +++ b/src/record/SkRecordDraw.cpp @@ -38,7 +38,13 @@ DRAW(PopCull, popCull()); DRAW(PushCull, pushCull(r.rect)); DRAW(Clear, clear(r.color)); DRAW(Concat, concat(r.matrix)); -DRAW(SetMatrix, setMatrix(r.matrix)); + +// We can't clobber the canvas' initial CTM when calling setMatrix. +template <> void Draw::draw(const SetMatrix& r) { + SkMatrix ctm; + ctm.setConcat(fInitialCTM, r.matrix); + fCanvas->setMatrix(ctm); +} DRAW(ClipPath, clipPath(r.path, r.op, r.doAA)); DRAW(ClipRRect, clipRRect(r.rrect, r.op, r.doAA)); diff --git a/src/record/SkRecordDraw.h b/src/record/SkRecordDraw.h index 4ec6e68e92..359679a6d7 100644 --- a/src/record/SkRecordDraw.h +++ b/src/record/SkRecordDraw.h @@ -19,7 +19,8 @@ namespace SkRecords { // This is an SkRecord visitor that will draw that SkRecord to an SkCanvas. class Draw : SkNoncopyable { public: - explicit Draw(SkCanvas* canvas) : fCanvas(canvas), fIndex(0) {} + explicit Draw(SkCanvas* canvas) + : fInitialCTM(canvas->getTotalMatrix()), fCanvas(canvas), fIndex(0) {} unsigned index() const { return fIndex; } void next() { ++fIndex; } @@ -44,6 +45,7 @@ private: bool skip(const PairedPushCull&); bool skip(const BoundedDrawPosTextH&); + const SkMatrix fInitialCTM; SkCanvas* fCanvas; unsigned fIndex; }; |