aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PictureTest.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-08-02 08:05:56 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-02 08:05:56 -0700
commitc573a40ed5024b463e47088d307e3164a486dba5 (patch)
tree17969315cf64ce827395c4b8ad9273cc6f96886d /tests/PictureTest.cpp
parent7d0e3bc785fc5aaf2ed0aa8f37a2bc85c2f82da0 (diff)
Add drawImageLattice() and drawBitmapLattice() APIs
The specified image/bitmap is divided into rects, which can be draw stretched, shrunk, or at a fixed size. Will be used by Android to draw 9patch (which are acutally N-patch) images. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1992283002 Review-Url: https://codereview.chromium.org/1992283002
Diffstat (limited to 'tests/PictureTest.cpp')
-rw-r--r--tests/PictureTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index b02491661e..8f5ebd3f3b 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -994,12 +994,17 @@ static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) {
const SkPaint paint;
const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f };
const SkIRect irect = { 2, 2, 3, 3 };
+ int divs[] = { 2, 3 };
+ SkCanvas::Lattice lattice;
+ lattice.fXCount = lattice.fYCount = 2;
+ lattice.fXDivs = lattice.fYDivs = divs;
// Don't care what these record, as long as they're legal.
canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint);
canvas->drawBitmapRect(bitmap, rect, rect, &paint, SkCanvas::kStrict_SrcRectConstraint);
canvas->drawBitmapNine(bitmap, irect, rect, &paint);
canvas->drawBitmap(bitmap, 1, 1); // drawSprite
+ canvas->drawBitmapLattice(bitmap, lattice, rect, &paint);
}
static void test_draw_bitmaps(SkCanvas* canvas) {