aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/SkCanvas.cpp41
1 files changed, 16 insertions, 25 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index ce4a624ec7..0bf0614264 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1113,33 +1113,24 @@ void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect* src,
}
SkMatrix matrix;
-#if 0
- SkScalar width = SkIntToScalar(bitmapPtr->width());
- SkScalar height = SkIntToScalar(bitmapPtr->height());
- if (dst.width() == width && dst.height() == height) {
- matrix.setTranslate(dst.fLeft, dst.fTop);
- } else
-#endif
- {
- SkRect tmpSrc;
- if (src) {
- tmpSrc.set(*src);
- // if the extract process clipped off the top or left of the
- // original, we adjust for that here to get the position right.
- if (tmpSrc.fLeft > 0) {
- tmpSrc.fRight -= tmpSrc.fLeft;
- tmpSrc.fLeft = 0;
- }
- if (tmpSrc.fTop > 0) {
- tmpSrc.fBottom -= tmpSrc.fTop;
- tmpSrc.fTop = 0;
- }
- } else {
- tmpSrc.set(0, 0, SkIntToScalar(bitmap.width()),
- SkIntToScalar(bitmap.height()));
+ SkRect tmpSrc;
+ if (src) {
+ tmpSrc.set(*src);
+ // if the extract process clipped off the top or left of the
+ // original, we adjust for that here to get the position right.
+ if (tmpSrc.fLeft > 0) {
+ tmpSrc.fRight -= tmpSrc.fLeft;
+ tmpSrc.fLeft = 0;
}
- matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit);
+ if (tmpSrc.fTop > 0) {
+ tmpSrc.fBottom -= tmpSrc.fTop;
+ tmpSrc.fTop = 0;
+ }
+ } else {
+ tmpSrc.set(0, 0, SkIntToScalar(bitmap.width()),
+ SkIntToScalar(bitmap.height()));
}
+ matrix.setRectToRect(tmpSrc, dst, SkMatrix::kFill_ScaleToFit);
this->internalDrawBitmap(*bitmapPtr, matrix, paint);
}