aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkLatticeIter.h
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/core/SkLatticeIter.h
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/core/SkLatticeIter.h')
-rw-r--r--src/core/SkLatticeIter.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/SkLatticeIter.h b/src/core/SkLatticeIter.h
index aad39824d5..08cdd5a965 100644
--- a/src/core/SkLatticeIter.h
+++ b/src/core/SkLatticeIter.h
@@ -30,9 +30,12 @@ public:
SkLatticeIter(int imageWidth, int imageHeight, const SkIRect& center, const SkRect& dst);
/**
- * While it returns true, use src/dst to draw the image/bitmap
+ * While it returns true, use src/dst to draw the image/bitmap. Optional parameters
+ * isFixedColor and fixedColor specify if the rectangle is filled with a fixed color.
+ * If (*isFixedColor) is true, then (*fixedColor) contains the rectangle color.
*/
- bool next(SkRect* src, SkRect* dst);
+ bool next(SkRect* src, SkRect* dst, bool* isFixedColor = nullptr,
+ SkColor* fixedColor = nullptr);
/**
* Apply a matrix to the dst points.
@@ -51,7 +54,8 @@ private:
SkTArray<SkScalar> fSrcY;
SkTArray<SkScalar> fDstX;
SkTArray<SkScalar> fDstY;
- SkTArray<SkCanvas::Lattice::Flags> fFlags;
+ SkTArray<SkCanvas::Lattice::RectType> fRectTypes;
+ SkTArray<SkColor> fColors;
int fCurrX;
int fCurrY;