diff options
author | 2017-12-04 14:48:27 -0500 | |
---|---|---|
committer | 2017-12-11 18:22:17 +0000 | |
commit | e12d7315dd921301a18935d4c78119716753c30f (patch) | |
tree | b77c0cb3eb367b09aab531c2a12ee1bee8c889a9 /libs/hwui/SkiaCanvas.cpp | |
parent | 1f397705eb58ccb7fd341144e98400a7bb5f3432 (diff) |
Enable fast drawing for solid color nine patch rectangles
Pass a hint to Skia, about which lattice rectangles are solid
color rectangles.
Bug: 69796044
Test: Measured ninepatch performance using sample app from the bug
Change-Id: Ib07b1b64c78ab16195f9af88a989d28682084565
Diffstat (limited to 'libs/hwui/SkiaCanvas.cpp')
-rw-r--r-- | libs/hwui/SkiaCanvas.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp index eb0d161d71d1..13e1ebec943e 100644 --- a/libs/hwui/SkiaCanvas.cpp +++ b/libs/hwui/SkiaCanvas.cpp @@ -699,7 +699,8 @@ void SkiaCanvas::drawNinePatch(Bitmap& bitmap, const Res_png_9patch& chunk, floa SkCanvas::Lattice lattice; NinePatchUtils::SetLatticeDivs(&lattice, chunk, bitmap.width(), bitmap.height()); - lattice.fFlags = nullptr; + lattice.fRectTypes = nullptr; + lattice.fColors = nullptr; int numFlags = 0; if (chunk.numColors > 0 && chunk.numColors == NinePatchUtils::NumDistinctRects(lattice)) { // We can expect the framework to give us a color for every distinct rect. @@ -707,9 +708,10 @@ void SkiaCanvas::drawNinePatch(Bitmap& bitmap, const Res_png_9patch& chunk, floa numFlags = (lattice.fXCount + 1) * (lattice.fYCount + 1); } - SkAutoSTMalloc<25, SkCanvas::Lattice::Flags> flags(numFlags); + SkAutoSTMalloc<25, SkCanvas::Lattice::RectType> flags(numFlags); + SkAutoSTMalloc<25, SkColor> colors(numFlags); if (numFlags > 0) { - NinePatchUtils::SetLatticeFlags(&lattice, flags.get(), numFlags, chunk); + NinePatchUtils::SetLatticeFlags(&lattice, flags.get(), numFlags, chunk, colors.get()); } lattice.fBounds = nullptr; |