diff options
author | msarett <msarett@google.com> | 2016-09-02 11:24:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-02 11:24:30 -0700 |
commit | 0764efe6a9ae65ad83992f614f57ca9db5b1f191 (patch) | |
tree | 0093acd4cd619336ccd5f6b06748e9928af438ef /gm | |
parent | 005327b9ddbf0bb2890c7d563b3d9a8ea8a284f6 (diff) |
Add option to skip rects to drawImageLattice()
HWUI skips transparent rects when drawing.
When skia draws using bilerp, we will blend
transparent rects with neighboring rects and might
draw a bit of a smudge.
This CL adds the option to skip rects, allowing us
to have compatible behavior with the framework.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2305433002
Review-Url: https://codereview.chromium.org/2305433002
Diffstat (limited to 'gm')
-rw-r--r-- | gm/lattice.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gm/lattice.cpp b/gm/lattice.cpp index 63de2a66b4..919fb3588e 100644 --- a/gm/lattice.cpp +++ b/gm/lattice.cpp @@ -113,6 +113,7 @@ protected: lattice.fXDivs = xDivs + 1; lattice.fYCount = 4; lattice.fYDivs = yDivs + 1; + lattice.fFlags = nullptr; for (int iy = 0; iy < 2; ++iy) { for (int ix = 0; ix < 2; ++ix) { @@ -130,6 +131,15 @@ protected: lattice.fYCount = 5; lattice.fYDivs = yDivs; + // Let's skip a few rects. + SkCanvas::Lattice::Flags flags[36]; + sk_bzero(flags, 36 * sizeof(SkCanvas::Lattice::Flags)); + flags[4] = SkCanvas::Lattice::kTransparent_Flags; + flags[9] = SkCanvas::Lattice::kTransparent_Flags; + flags[12] = SkCanvas::Lattice::kTransparent_Flags; + flags[19] = SkCanvas::Lattice::kTransparent_Flags; + lattice.fFlags = flags; + canvas->translate(400, 0); for (int iy = 0; iy < 2; ++iy) { for (int ix = 0; ix < 2; ++ix) { |