Index: third_party/WebKit/Source/platform/DragImage.cpp |
diff --git a/third_party/WebKit/Source/platform/DragImage.cpp b/third_party/WebKit/Source/platform/DragImage.cpp |
index be1b995eb8d560f7f8c384bd07ad110ece9ac7dd..f64d0d465a2e5dc5a6d072c0025080d7c1740f94 100644 |
--- a/third_party/WebKit/Source/platform/DragImage.cpp |
+++ b/third_party/WebKit/Source/platform/DragImage.cpp |
@@ -72,6 +72,8 @@ const float kMaxDragLabelStringWidth = (kMaxDragLabelWidth - 2 * kDragLabelBorde |
const float kDragLinkLabelFontSize = 11; |
const float kDragLinkUrlFontSize = 10; |
+} // anonymous namespace |
+ |
PassRefPtr<SkImage> adjustedImage(PassRefPtr<SkImage> image, const IntSize& size, |
const AffineTransform& transform, float opacity, InterpolationQuality interpolationQuality) |
{ |
@@ -100,15 +102,13 @@ PassRefPtr<SkImage> adjustedImage(PassRefPtr<SkImage> image, const IntSize& size |
return adoptRef(surface->newImageSnapshot()); |
} |
-} // anonymous namespace |
- |
-FloatSize DragImage::clampedImageScale(const Image& image, const IntSize& size, |
+FloatSize DragImage::clampedImageScale(const IntSize& imageSize, const IntSize& size, |
const IntSize& maxSize) |
{ |
// Non-uniform scaling for size mapping. |
FloatSize imageScale( |
- static_cast<float>(size.width()) / image.width(), |
- static_cast<float>(size.height()) / image.height()); |
+ static_cast<float>(size.width()) / imageSize.width(), |
+ static_cast<float>(size.height()) / imageSize.height()); |
// Uniform scaling for clamping. |
const float clampScaleX = size.width() > maxSize.width() |
@@ -122,7 +122,7 @@ FloatSize DragImage::clampedImageScale(const Image& image, const IntSize& size, |
PassOwnPtr<DragImage> DragImage::create(Image* image, |
RespectImageOrientationEnum shouldRespectImageOrientation, float deviceScaleFactor, |
- InterpolationQuality interpolationQuality, float opacity, const FloatSize& imageScale) |
+ InterpolationQuality interpolationQuality, float opacity, FloatSize imageScale) |
{ |
if (!image) |
return nullptr; |
@@ -137,22 +137,17 @@ PassOwnPtr<DragImage> DragImage::create(Image* image, |
return nullptr; |
AffineTransform transform; |
- transform.scaleNonUniform(imageScale.width(), imageScale.height()); |
- |
if (shouldRespectImageOrientation == RespectImageOrientation && image->isBitmapImage()) { |
BitmapImage* bitmapImage = toBitmapImage(image); |
ImageOrientation orientation = bitmapImage->currentFrameOrientation(); |
if (orientation != DefaultImageOrientation) { |
size = bitmapImage->sizeRespectingOrientation(); |
- if (orientation.usesWidthAsHeight()) |
- size.scale(imageScale.height(), imageScale.width()); |
- else |
- size.scale(imageScale.width(), imageScale.height()); |
- |
+ size.scale(imageScale.width(), imageScale.height()); |
transform *= orientation.transformFromDefault(size); |
} |
} |
+ transform.scaleNonUniform(imageScale.width(), imageScale.height()); |
SkBitmap bm; |
RefPtr<SkImage> resizedImage = |