From b4c2819671757044857ec477156699163025a353 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Wed, 5 Sep 2012 23:14:07 +0000 Subject: [PATCH] Record the initial matrix when we begin picture-playback, and concat with that if we see a setMatrix command. In this way we can respect the caller's overall playback matrix environment. Review URL: https://codereview.appspot.com/6495092 git-svn-id: http://skia.googlecode.com/svn/trunk@5409 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkPicturePlayback.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index bcad616..cf3484b 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -561,6 +561,9 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { SkReader32 reader(fOpData->bytes(), fOpData->size()); TextContainer text; + // Record this, so we can concat w/ it if we encounter a setMatrix() + SkMatrix initialMatrix = canvas.getTotalMatrix(); + while (!reader.eof()) { switch (reader.readInt()) { case CLIP_PATH: { @@ -786,9 +789,11 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { SkScalar sy = reader.readScalar(); canvas.scale(sx, sy); } break; - case SET_MATRIX: - canvas.setMatrix(*getMatrix(reader)); - break; + case SET_MATRIX: { + SkMatrix matrix; + matrix.setConcat(initialMatrix, *getMatrix(reader)); + canvas.setMatrix(matrix); + } break; case SKEW: { SkScalar sx = reader.readScalar(); SkScalar sy = reader.readScalar(); -- 2.7.4