From: reed@google.com Date: Wed, 5 Sep 2012 23:14:07 +0000 (+0000) Subject: Record the initial matrix when we begin picture-playback, and concat with X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~14940 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4c2819671757044857ec477156699163025a353;p=platform%2Fupstream%2FlibSkiaSharp.git 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 --- 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();