diff options
author | 2014-12-08 11:13:27 -0800 | |
---|---|---|
committer | 2014-12-08 11:13:27 -0800 | |
commit | a2bd24fd15378d0a25d79b4aa2d76dddc4cf564c (patch) | |
tree | 7a503f1cffb0e8026a5845798b53fc5a70d15e4e /src/core/SkPictureShader.cpp | |
parent | cf56009d9058d25933d9840bf6cf9fdf6a80f647 (diff) |
Tweak SkPictureShader's tile semantics.
Currently, the tile offset is added when drawing the picture. This might
have made a tiny bit of sense when the picture was always positioned at
origin, but with a picture cull rect offset things looks really strange.
For example, to specify a tile == the picture cull rect we have to pass
in [-cullrect.x, -cullrect.y, cullrect.width, cullrect.height]. Yikes.
(there's also a bug when not passing a tile, as we use a default tile
== cullrect but don't compensate for the above oddity)
This changes the semantics of the tile offset: it is now subtracted when
drawing the picture tile. As a consequence, one can pass in a tile equal
to the cull rect and get the expected behavior (same when not passing
a tile).
This will require a minor Blink change with the roll, as one client
works around the current behavior:
https://codereview.chromium.org/789503003
R=reed@google.com,robertphillips@google.com
BUG=440046
Review URL: https://codereview.chromium.org/733203005
Diffstat (limited to 'src/core/SkPictureShader.cpp')
-rw-r--r-- | src/core/SkPictureShader.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp index 5fded935cc..198a2a9e49 100644 --- a/src/core/SkPictureShader.cpp +++ b/src/core/SkPictureShader.cpp @@ -185,7 +185,7 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri SkCanvas canvas(bm); canvas.scale(tileScale.width(), tileScale.height()); - canvas.translate(fTile.x(), fTile.y()); + canvas.translate(-fTile.x(), -fTile.y()); canvas.drawPicture(fPicture); SkMatrix shaderMatrix = this->getLocalMatrix(); |