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 --- src/core/SkRecorder.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/core/SkRecorder.cpp') diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp index c822fdba87..7ffb1f4c44 100644 --- a/src/core/SkRecorder.cpp +++ b/src/core/SkRecorder.cpp @@ -211,6 +211,16 @@ void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top, APPEND(DrawImage, this->copy(paint), sk_ref_sp(image), left, top); } +void SkRecorder::onDrawImageLattice(const SkImage* image, + const Lattice& lattice, + const SkRect& dst, + const SkPaint* paint) { + APPEND(DrawImageLattice, this->copy(paint), sk_ref_sp(image), + lattice.fXCount, this->copy(lattice.fXDivs, lattice.fXCount), + lattice.fYCount, this->copy(lattice.fYDivs, lattice.fYCount), dst); +} + + void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst, const SkPaint* paint, SrcRectConstraint constraint) { APPEND(DrawImageRect, this->copy(paint), sk_ref_sp(image), this->copy(src), dst, constraint); -- cgit v1.2.3