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

Unified Diff: src/core/SkCanvas.cpp

Issue 1391333004: remove internalDrawBitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 3a289566cb398ac584e64aa098d64bb125dede2b..4952ae25811378f19178585dcd3708b2dfdc7f25 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1285,35 +1285,6 @@ bool SkAutoROCanvasPixels::asROBitmap(SkBitmap* bitmap) const {
}
/////////////////////////////////////////////////////////////////////////////
-void SkCanvas::internalDrawBitmap(const SkBitmap& bitmap,
- const SkMatrix& matrix, const SkPaint* paint) {
- if (bitmap.drawsNothing()) {
- return;
- }
-
- SkLazyPaint lazy;
- if (nullptr == paint) {
- paint = lazy.init();
- }
-
- SkDEBUGCODE(bitmap.validate();)
-
- SkRect storage;
- const SkRect* bounds = nullptr;
- if (paint && paint->canComputeFastBounds()) {
- bitmap.getBounds(&storage);
- matrix.mapRect(&storage);
- bounds = &paint->computeFastBounds(storage, &storage);
- }
-
- LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, bounds)
-
- while (iter.next()) {
- iter.fDevice->drawBitmap(iter, bitmap, matrix, looper.paint());
- }
-
- LOOPER_END
-}
void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, int x, int y,
const SkPaint* paint, bool deviceIsBitmapDevice) {
@@ -2196,23 +2167,35 @@ void SkCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, cons
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()");
SkDEBUGCODE(bitmap.validate();)
- if (nullptr == paint || paint->canComputeFastBounds()) {
- SkRect bounds = {
- x, y,
- x + SkIntToScalar(bitmap.width()),
- y + SkIntToScalar(bitmap.height())
- };
- if (paint) {
- (void)paint->computeFastBounds(bounds, &bounds);
- }
- if (this->quickReject(bounds)) {
+ if (bitmap.drawsNothing()) {
+ return;
+ }
+
+ SkLazyPaint lazy;
+ if (nullptr == paint) {
+ paint = lazy.init();
+ }
+
+ const SkMatrix matrix = SkMatrix::MakeTrans(x, y);
+
+ SkRect storage;
+ const SkRect* bounds = nullptr;
+ if (paint->canComputeFastBounds()) {
+ bitmap.getBounds(&storage);
+ matrix.mapRect(&storage);
+ bounds = &paint->computeFastBounds(storage, &storage);
+ if (this->quickReject(*bounds)) {
return;
}
}
- SkMatrix matrix;
- matrix.setTranslate(x, y);
- this->internalDrawBitmap(bitmap, matrix, paint);
+ LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, bounds)
+
+ while (iter.next()) {
+ iter.fDevice->drawBitmap(iter, bitmap, matrix, looper.paint());
+ }
+
+ LOOPER_END
}
// this one is non-virtual, so it can be called safely by other canvas apis
« no previous file with comments | « include/core/SkCanvas.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698