diff options
author | Stan Iliev <stani@google.com> | 2017-12-11 13:01:58 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-11 18:26:18 +0000 |
commit | ca8c0953e8da1def5e6c12dde6d4368b4bf16077 (patch) | |
tree | c7c0dabde70dbebfedba579f6f9d803652201943 /src/gpu | |
parent | 51493ee8488e29499a1a0a678a50aeca44ebf718 (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/gpu')
-rw-r--r-- | src/gpu/ops/GrLatticeOp.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp index d91151c65e..7438eb2c0a 100644 --- a/src/gpu/ops/GrLatticeOp.cpp +++ b/src/gpu/ops/GrLatticeOp.cpp @@ -244,7 +244,8 @@ GR_DRAW_OP_TEST_DEFINE(NonAALatticeOp) { // edge of the image subset, respectively. std::unique_ptr<int[]> xdivs; std::unique_ptr<int[]> ydivs; - std::unique_ptr<SkCanvas::Lattice::Flags[]> flags; + std::unique_ptr<SkCanvas::Lattice::RectType[]> flags; + std::unique_ptr<SkColor[]> colors; SkIRect subset; do { imgW = random->nextRangeU(1, 1000); @@ -271,14 +272,17 @@ GR_DRAW_OP_TEST_DEFINE(NonAALatticeOp) { bool hasFlags = random->nextBool(); if (hasFlags) { int n = (lattice.fXCount + 1) * (lattice.fYCount + 1); - flags.reset(new SkCanvas::Lattice::Flags[n]); + flags.reset(new SkCanvas::Lattice::RectType[n]); + colors.reset(new SkColor[n]); for (int i = 0; i < n; ++i) { - flags[i] = random->nextBool() ? SkCanvas::Lattice::kTransparent_Flags - : (SkCanvas::Lattice::Flags)0; + flags[i] = random->nextBool() ? SkCanvas::Lattice::kTransparent + : SkCanvas::Lattice::kDefault; } - lattice.fFlags = flags.get(); + lattice.fRectTypes = flags.get(); + lattice.fColors = colors.get(); } else { - lattice.fFlags = nullptr; + lattice.fRectTypes = nullptr; + lattice.fColors = nullptr; } } while (!SkLatticeIter::Valid(imgW, imgH, lattice)); |