Change drawBitmapRect to take a float-src-rect instead of integer-src-rect. This
allows the client more control over the scaling. Because of virtual overrides
and wanting to keep the old call-sites up and running, this CL renames the
virtual entry-point to drawBitmapRectToRect, and downgrades drawBitmapRect to
a non-virtual helper function.
The implementation is to use the float-rect for computing the matrix, but still
cons-up an integer rect for the purposes of subsetting the original bitmap. We
do this by calling float_src->roundOut(&int_src) so that we include all
(partially) covered src pixels.
No change needed on SkDevice, since that signature is explicitly passed the
computed matrix.
Review URL: https://codereview.appspot.com/6501140
git-svn-id: http://skia.googlecode.com/svn/trunk@5578 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/utils/SkDeferredCanvas.h b/include/utils/SkDeferredCanvas.h
index 8779df9..5e89200 100644
--- a/include/utils/SkDeferredCanvas.h
+++ b/include/utils/SkDeferredCanvas.h
@@ -138,7 +138,7 @@
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left,
SkScalar top, const SkPaint* paint)
SK_OVERRIDE;
- virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
+ virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst, const SkPaint* paint)
SK_OVERRIDE;
diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h
index bae84c6..4eb1f25 100644
--- a/include/utils/SkDumpCanvas.h
+++ b/include/utils/SkDumpCanvas.h
@@ -87,7 +87,7 @@
virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
const SkPaint* paint) SK_OVERRIDE;
- virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
+ virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst, const SkPaint* paint) SK_OVERRIDE;
virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
const SkPaint* paint) SK_OVERRIDE;
diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h
index dbf4a58..065adf0 100644
--- a/include/utils/SkNWayCanvas.h
+++ b/include/utils/SkNWayCanvas.h
@@ -45,7 +45,7 @@
virtual void drawPath(const SkPath& path, const SkPaint&) SK_OVERRIDE;
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
const SkPaint*) SK_OVERRIDE;
- virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
+ virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst, const SkPaint*) SK_OVERRIDE;
virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
const SkPaint*) SK_OVERRIDE;
diff --git a/include/utils/SkProxyCanvas.h b/include/utils/SkProxyCanvas.h
index 720436b..aa47085 100644
--- a/include/utils/SkProxyCanvas.h
+++ b/include/utils/SkProxyCanvas.h
@@ -50,7 +50,7 @@
virtual void drawPath(const SkPath& path, const SkPaint& paint) SK_OVERRIDE;
virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
const SkPaint* paint = NULL) SK_OVERRIDE;
- virtual void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
+ virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst, const SkPaint* paint = NULL) SK_OVERRIDE;
virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
const SkPaint* paint = NULL) SK_OVERRIDE;