diff options
author | Brian Osman <brianosman@google.com> | 2018-12-26 12:16:44 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-12-27 13:58:33 +0000 |
commit | 0b5370363df31a4a358221cd0a1828138fa40ba7 (patch) | |
tree | b71606d74f6129f7361c170cae35056afd2c77ee /gm | |
parent | 568bec7a1deb2998cfa02d28e3d76d91dc8ee5b1 (diff) | |
download | skqp-0b5370363df31a4a358221cd0a1828138fa40ba7.tar.gz |
Support wide color in GrLatticeOp
Like other image drawing, paint color is only used when drawing alpha
images, so I had to add a new GM to trigger the relevant code path.
That GM previously drew wrong (clipped color) in glenarrow, and now
draws correctly (matching enarrow).
Bug: skia:
Change-Id: I12c19c2afba29d5176b3ac60ef840d849107bb17
Reviewed-on: https://skia-review.googlesource.com/c/179987
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'gm')
-rw-r--r-- | gm/lattice.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/gm/lattice.cpp b/gm/lattice.cpp index eec3c64830..5c2bd5036d 100644 --- a/gm/lattice.cpp +++ b/gm/lattice.cpp @@ -337,5 +337,25 @@ private: }; DEF_GM( return new LatticeGM2; ) +// Code paths that incorporate the paint color when drawing the lattice (using an alpha image) +DEF_SIMPLE_GM_BG(lattice_alpha, canvas, 120, 120, SK_ColorWHITE) { + auto surface = sk_tool_utils::makeSurface(canvas, SkImageInfo::MakeA8(100, 100)); + surface->getCanvas()->clear(0); + surface->getCanvas()->drawCircle(50, 50, 50, SkPaint()); + auto image = surface->makeImageSnapshot(); + + int divs[] = { 20, 40, 60, 80 }; + + SkCanvas::Lattice lattice; + lattice.fXCount = 4; + lattice.fXDivs = divs; + lattice.fYCount = 4; + lattice.fYDivs = divs; + lattice.fRectTypes = nullptr; + lattice.fColors = nullptr; + lattice.fBounds = nullptr; - + SkPaint paint; + paint.setColor(SK_ColorMAGENTA); + canvas->drawImageLattice(image.get(), lattice, SkRect::MakeWH(120, 120), &paint); +} |