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 /src/core/SkPictureRecord.cpp | |
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 'src/core/SkPictureRecord.cpp')
-rw-r--r-- | src/core/SkPictureRecord.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 8eab63016b..5ee2e9fb35 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -538,7 +538,9 @@ void SkPictureRecord::onDrawImageNine(const SkImage* img, const SkIRect& center, void SkPictureRecord::onDrawImageLattice(const SkImage* image, const Lattice& lattice, const SkRect& dst, const SkPaint* paint) { // xCount + xDivs + yCount+ yDivs - size_t latticeSize = (1 + lattice.fXCount + 1 + lattice.fYCount) * kUInt32Size; + int flagCount = (nullptr == lattice.fFlags) ? 0 : (lattice.fXCount + 1) * (lattice.fYCount + 1); + size_t latticeSize = (1 + lattice.fXCount + 1 + lattice.fYCount + 1) * kUInt32Size + + SkAlign4(flagCount * sizeof(SkCanvas::Lattice::Flags)); // op + paint index + image index + lattice + dst rect size_t size = 3 * kUInt32Size + latticeSize + sizeof(dst); @@ -549,6 +551,8 @@ void SkPictureRecord::onDrawImageLattice(const SkImage* image, const Lattice& la fWriter.writePad(lattice.fXDivs, lattice.fXCount * kUInt32Size); this->addInt(lattice.fYCount); fWriter.writePad(lattice.fYDivs, lattice.fYCount * kUInt32Size); + this->addInt(flagCount); + fWriter.writePad(lattice.fFlags, flagCount * sizeof(SkCanvas::Lattice::Flags)); this->addRect(dst); this->validate(initialOffset, size); } |