From c573a40ed5024b463e47088d307e3164a486dba5 Mon Sep 17 00:00:00 2001 From: msarett Date: Tue, 2 Aug 2016 08:05:56 -0700 Subject: 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 --- tests/PictureTest.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/PictureTest.cpp') 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) { -- cgit v1.2.3