Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(630)

Unified Diff: src/core/SkCanvas.cpp

Issue 1992283002: Add drawBitmapLattice() API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add implementation for SkRecorder and SkPictureRecord Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 3067772c8ad87db06b7ac588f14c61afd141239a..59cf2177a83e954f52ed523e3c136d9842e97e41 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2036,6 +2036,17 @@ void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
this->onDrawBitmapNine(bitmap, center, dst, paint);
}
+void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const NinePatchDivs& divs, const SkRect& dst,
+ const SkPaint* paint) {
+ if (bitmap.drawsNothing() || dst.isEmpty()) {
+ return;
+ }
+ if (!SkNinePatchIter::Valid(bitmap.width(), bitmap.height(), divs)) {
+ this->drawBitmapRect(bitmap, dst, paint);
+ }
+ this->onDrawBitmapNine(bitmap, divs, dst, paint);
+}
+
void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
const SkColor colors[], int count, SkXfermode::Mode mode,
const SkRect* cull, const SkPaint* paint) {
@@ -2516,6 +2527,31 @@ void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, c
LOOPER_END
}
+void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const NinePatchDivs& divs,
+ const SkRect& dst, const SkPaint* paint) {
+ SkDEBUGCODE(bitmap.validate();)
+
+ if (nullptr == paint || paint->canComputeFastBounds()) {
+ SkRect storage;
+ if (this->quickReject(paint ? paint->computeFastBounds(dst, &storage) : dst)) {
+ return;
+ }
+ }
+
+ SkLazyPaint lazy;
+ if (nullptr == paint) {
+ paint = lazy.init();
+ }
+
+ LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &dst)
+
+ while (iter.next()) {
+ iter.fDevice->drawBitmapNine(iter, bitmap, divs, dst, looper.paint());
+ }
+
+ LOOPER_END
+}
+
class SkDeviceFilteredPaint {
public:
SkDeviceFilteredPaint(SkBaseDevice* device, const SkPaint& paint) {

Powered by Google App Engine
This is Rietveld 408576698