aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
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 /include
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 'include')
-rw-r--r--include/core/SkCanvas.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 15ee8721cd..f5f32f8267 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1760,12 +1760,19 @@ public:
*/
struct Lattice {
- /** \enum SkCanvas::Lattice::Flags
- Optional setting per rectangular grid entry to make it transparent.
+ /** \enum SkCanvas::Lattice::RectType
+ Optional setting per rectangular grid entry.
*/
- enum Flags : uint8_t {
+ enum RectType : uint8_t {
+ kDefault = 0,
+
/** Set to skip lattice rectangle by making it transparent. */
- kTransparent_Flags = 1 << 0,
+ kTransparent,
+
+ /** The lattice rectangle is a fixed color. The color value is stored
+ in fColors.
+ */
+ kFixedColor,
};
/** Array of x-coordinates that divide the bitmap vertically.
@@ -1784,13 +1791,13 @@ public:
*/
const int* fYDivs;
- /** Optional array of flags, one per rectangular grid entry:
+ /** Optional array of rectangle types, one per rectangular grid entry:
array length must be (fXCount + 1) * (fYCount + 1).
Array entries correspond to the rectangular grid entries, ascending
left to right and then top to bottom.
*/
- const Flags* fFlags;
+ const RectType* fRectTypes;
/** Number of entries in fXDivs array; one less than the number of
horizontal divisions.
@@ -1807,6 +1814,15 @@ public:
*/
const SkIRect* fBounds;
+
+ /** Optional array of colors, one per rectangular grid entry:
+ array length must be (fXCount + 1) * (fYCount + 1).
+
+ Array entries correspond to the rectangular grid entries, ascending
+ left to right and then top to bottom.
+ */
+ const SkColor* fColors;
+
};
/** Draw SkBitmap bitmap stretched proportionally to fit into SkRect dst.