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 bb2049ed8fb49676a7ca6e682c9adc9ed6f9b621..b9af85d4ffbe4af5cb270d687952f86a38fe17b4 100644 |
--- a/third_party/WebKit/Source/platform/DragImage.cpp |
+++ b/third_party/WebKit/Source/platform/DragImage.cpp |
@@ -36,6 +36,7 @@ |
#include "platform/graphics/BitmapImage.h" |
#include "platform/graphics/Color.h" |
#include "platform/graphics/GraphicsContext.h" |
+#include "platform/graphics/GraphicsScreen.h" |
#include "platform/graphics/Image.h" |
#include "platform/graphics/ImageBuffer.h" |
#include "platform/graphics/paint/DrawingRecorder.h" |
@@ -136,24 +137,31 @@ PassOwnPtr<DragImage> DragImage::create(Image* image, |
RespectImageOrientationEnum shouldRespectImageOrientation, float deviceScaleFactor, |
InterpolationQuality interpolationQuality, float opacity, FloatSize imageScale) |
{ |
- if (!image) |
- return nullptr; |
+ RefPtr<SkImage> skImage = image ? image->imageForCurrentFrame() : nullptr; |
- RefPtr<SkImage> skImage = image->imageForCurrentFrame(); |
- if (!skImage) |
- return nullptr; |
+ if (imageColorProfilesEnabled()) |
+ RELEASE_ASSERT(currentScreenId()); // There should be an active graphics screen. |
+ |
+ if (skImage && imageColorProfilesEnabled() && image->isBitmapImage() && toBitmapImage(image)->hasColorProfile()) { |
+ OwnPtr<ImageBuffer> buffer = ImageBuffer::create(image->size()); |
+ IntRect source = IntRect(IntPoint(), image->size()); |
+ image->draw(buffer->canvas(), SkPaint(), source, source, DoNotRespectImageOrientation, Image::ClampImageToSourceRect); |
+ skImage = buffer->newSkImageSnapshot(PreferNoAcceleration); |
+ } |
ImageOrientation orientation; |
- if (shouldRespectImageOrientation == RespectImageOrientation && image->isBitmapImage()) |
+ if (skImage && shouldRespectImageOrientation == RespectImageOrientation && image->isBitmapImage()) |
orientation = toBitmapImage(image)->currentFrameOrientation(); |
- SkBitmap bm; |
- RefPtr<SkImage> resizedImage = |
- resizeAndOrientImage(skImage.release(), orientation, imageScale, opacity, interpolationQuality); |
- if (!resizedImage || !resizedImage->asLegacyBitmap(&bm, SkImage::kRO_LegacyBitmapMode)) |
+ RefPtr<SkImage> dragImage; |
+ if (skImage) |
+ dragImage = resizeAndOrientImage(skImage.release(), orientation, imageScale, opacity, interpolationQuality); |
+ |
+ SkBitmap bitmap; |
+ if (!dragImage || !dragImage->asLegacyBitmap(&bitmap, SkImage::kRO_LegacyBitmapMode)) |
return nullptr; |
- return adoptPtr(new DragImage(bm, deviceScaleFactor, interpolationQuality)); |
+ return adoptPtr(new DragImage(bitmap, deviceScaleFactor, interpolationQuality)); |
} |
static Font deriveDragLabelFont(int size, FontWeight fontWeight, const FontDescription& systemFont) |