| Index: ui/gfx/canvas.cc
|
| diff --git a/ui/gfx/canvas.cc b/ui/gfx/canvas.cc
|
| index 883a7ce175bd748529807ef6f037a7c8e7dd7672..288d19256652b4f53ed2a00a3f1e8ffc76ea2a09 100644
|
| --- a/ui/gfx/canvas.cc
|
| +++ b/ui/gfx/canvas.cc
|
| @@ -278,6 +278,18 @@ void Canvas::DrawBitmapInt(const SkBitmap& bitmap,
|
| int dest_x, int dest_y, int dest_w, int dest_h,
|
| bool filter,
|
| const SkPaint& paint) {
|
| + DrawBitmapFloat(bitmap, static_cast<float>(src_x), static_cast<float>(src_y),
|
| + static_cast<float>(src_w), static_cast<float>(src_h),
|
| + static_cast<float>(dest_x), static_cast<float>(dest_y),
|
| + static_cast<float>(dest_w), static_cast<float>(dest_h),
|
| + filter, paint);
|
| +}
|
| +
|
| +void Canvas::DrawBitmapFloat(const SkBitmap& bitmap,
|
| + float src_x, float src_y, float src_w, float src_h,
|
| + float dest_x, float dest_y, float dest_w, float dest_h,
|
| + bool filter,
|
| + const SkPaint& paint) {
|
| DLOG_ASSERT(src_x + src_w < std::numeric_limits<int16_t>::max() &&
|
| src_y + src_h < std::numeric_limits<int16_t>::max());
|
| if (src_w <= 0 || src_h <= 0) {
|
| @@ -288,10 +300,10 @@ void Canvas::DrawBitmapInt(const SkBitmap& bitmap,
|
| if (!IntersectsClipRectInt(dest_x, dest_y, dest_w, dest_h))
|
| return;
|
|
|
| - SkRect dest_rect = { SkIntToScalar(dest_x),
|
| - SkIntToScalar(dest_y),
|
| - SkIntToScalar(dest_x + dest_w),
|
| - SkIntToScalar(dest_y + dest_h) };
|
| + SkRect dest_rect = { SkFloatToScalar(dest_x),
|
| + SkFloatToScalar(dest_y),
|
| + SkFloatToScalar(dest_x + dest_w),
|
| + SkFloatToScalar(dest_y + dest_h) };
|
|
|
| if (src_w == dest_w && src_h == dest_h) {
|
| // Workaround for apparent bug in Skia that causes image to occasionally
|
| @@ -309,10 +321,10 @@ void Canvas::DrawBitmapInt(const SkBitmap& bitmap,
|
| SkShader::kRepeat_TileMode,
|
| SkShader::kRepeat_TileMode);
|
| SkMatrix shader_scale;
|
| - shader_scale.setScale(SkFloatToScalar(static_cast<float>(dest_w) / src_w),
|
| - SkFloatToScalar(static_cast<float>(dest_h) / src_h));
|
| - shader_scale.preTranslate(SkIntToScalar(-src_x), SkIntToScalar(-src_y));
|
| - shader_scale.postTranslate(SkIntToScalar(dest_x), SkIntToScalar(dest_y));
|
| + shader_scale.setScale(SkFloatToScalar(dest_w / src_w),
|
| + SkFloatToScalar(dest_h / src_h));
|
| + shader_scale.preTranslate(SkFloatToScalar(-src_x), SkFloatToScalar(-src_y));
|
| + shader_scale.postTranslate(SkFloatToScalar(dest_x), SkFloatToScalar(dest_y));
|
| shader->setLocalMatrix(shader_scale);
|
|
|
| // Set up our paint to use the shader & release our reference (now just owned
|
|
|