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

Unified Diff: src/utils/SkDeferredCanvas.cpp

Issue 613673005: Override SkCanvas::drawImage() in SkDeferredCanvas and SkGPipe (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase master Created 6 years, 2 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
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkDeferredCanvas.cpp
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 06f7bb089ab07ebebfd9ad7a99c9f8af0a5e11d9..c20aa62b0099bca8514d045b9f4c2075b912198f 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -866,6 +866,43 @@ void SkDeferredCanvas::drawBitmapNine(const SkBitmap& bitmap,
this->recordedDrawCommand();
}
+void SkDeferredCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top,
+ const SkPaint* paint) {
+ SkRect imageRect = SkRect::MakeXYWH(left, top,
+ SkIntToScalar(image->width()), SkIntToScalar(image->height()));
+ bool isImageOpaque = image->isOpaque();
+ SkPaintBitmapOpacity pct = isImageOpaque
+ ? kOpaque_SkPaintBitmapOpacity : kUnknown_SkPaintBitmapOpacity;
+
+ if (fDeferredDrawing &&
+ this->isFullFrame(&imageRect, paint) &&
+ (isImageOpaque ||isPaintOpaque(paint, pct))) {
+ this->getDeferredDevice()->skipPendingCommands();
+ }
+
+ AutoImmediateDrawIfNeeded autoDraw(*this, paint);
+ this->drawingCanvas()->drawImage(image, left, top, paint);
+ this->recordedDrawCommand();
+}
+
+void SkDeferredCanvas::drawImageRect(const SkImage* image, const SkRect* src,
+ const SkRect& dst,
+ const SkPaint* paint) {
+ bool isImageOpaque = image->isOpaque();
+ SkPaintBitmapOpacity pct = isImageOpaque
+ ? kOpaque_SkPaintBitmapOpacity : kUnknown_SkPaintBitmapOpacity;
+
+ if (fDeferredDrawing &&
+ this->isFullFrame(&dst, paint) &&
+ (isImageOpaque || isPaintOpaque(paint, pct))) {
+ this->getDeferredDevice()->skipPendingCommands();
+ }
+
+ AutoImmediateDrawIfNeeded autoDraw(*this, paint);
+ this->drawingCanvas()->drawImageRect(image, src, dst, paint);
+ this->recordedDrawCommand();
+}
+
void SkDeferredCanvas::drawSprite(const SkBitmap& bitmap, int left, int top,
const SkPaint* paint) {
SkRect bitmapRect = SkRect::MakeXYWH(
« no previous file with comments | « src/pipe/SkGPipeWrite.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698