aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pipe
diff options
context:
space:
mode:
authorGravatar Stan Iliev <stani@google.com>2017-12-11 13:01:58 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-11 18:26:18 +0000
commitca8c0953e8da1def5e6c12dde6d4368b4bf16077 (patch)
treec7c0dabde70dbebfedba579f6f9d803652201943 /src/pipe
parent51493ee8488e29499a1a0a678a50aeca44ebf718 (diff)
Implement a fast path for solid color lattice rectangle
Add a flag that hints, which lattice rectangles are solid colors. Draw solid rectangles and 1x1 rectangles with drawRect. Test: Measured performance of a ninepatch drawn by HWUI Bug: b/69796044 Change-Id: Ib3b00ca608da42fa9f2d2038cc126a978421ec7c Reviewed-on: https://skia-review.googlesource.com/79821 Commit-Queue: Stan Iliev <stani@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
Diffstat (limited to 'src/pipe')
-rw-r--r--src/pipe/SkPipeCanvas.cpp7
-rw-r--r--src/pipe/SkPipeReader.cpp6
2 files changed, 8 insertions, 5 deletions
diff --git a/src/pipe/SkPipeCanvas.cpp b/src/pipe/SkPipeCanvas.cpp
index b9fcd2d4b5..d53e40d83c 100644
--- a/src/pipe/SkPipeCanvas.cpp
+++ b/src/pipe/SkPipeCanvas.cpp
@@ -556,7 +556,7 @@ void SkPipeCanvas::onDrawImageLattice(const SkImage* image, const Lattice& latti
if (paint) {
extra |= kHasPaint_DrawImageLatticeMask;
}
- if (lattice.fFlags) {
+ if (lattice.fRectTypes) {
extra |= kHasFlags_DrawImageLatticeMask;
}
if (lattice.fXCount >= kCount_DrawImageLatticeMask) {
@@ -583,10 +583,11 @@ void SkPipeCanvas::onDrawImageLattice(const SkImage* image, const Lattice& latti
// so we can store them smaller.
writer.write(lattice.fXDivs, lattice.fXCount * sizeof(int32_t));
writer.write(lattice.fYDivs, lattice.fYCount * sizeof(int32_t));
- if (lattice.fFlags) {
+ if (lattice.fRectTypes) {
int32_t count = (lattice.fXCount + 1) * (lattice.fYCount + 1);
SkASSERT(count > 0);
- write_pad(&writer, lattice.fFlags, count);
+ write_pad(&writer, lattice.fRectTypes, count);
+ write_pad(&writer, lattice.fColors, count*sizeof(SkColor));
}
SkASSERT(lattice.fBounds);
writer.write(&lattice.fBounds, sizeof(*lattice.fBounds));
diff --git a/src/pipe/SkPipeReader.cpp b/src/pipe/SkPipeReader.cpp
index 593c8b3ce9..3afb22e3bf 100644
--- a/src/pipe/SkPipeReader.cpp
+++ b/src/pipe/SkPipeReader.cpp
@@ -560,9 +560,11 @@ static void drawImageLattice_handler(SkPipeReader& reader, uint32_t packedVerb,
if (packedVerb & kHasFlags_DrawImageLatticeMask) {
int32_t count = (lattice.fXCount + 1) * (lattice.fYCount + 1);
SkASSERT(count > 0);
- lattice.fFlags = skip<SkCanvas::Lattice::Flags>(reader, SkAlign4(count));
+ lattice.fRectTypes = skip<SkCanvas::Lattice::RectType>(reader, SkAlign4(count));
+ lattice.fColors = skip<SkColor>(reader, SkAlign4(count));
} else {
- lattice.fFlags = nullptr;
+ lattice.fRectTypes = nullptr;
+ lattice.fColors = nullptr;
}
lattice.fBounds = skip<SkIRect>(reader);
const SkRect* dst = skip<SkRect>(reader);