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 7b2dad8b0ac680ed1f0ec6d61f3d3078bb5758f7..2f219304aa3bb0904f776be7a6f33269fb4e0006 100644 |
--- a/third_party/WebKit/Source/platform/DragImage.cpp |
+++ b/third_party/WebKit/Source/platform/DragImage.cpp |
@@ -37,6 +37,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" |
@@ -137,24 +138,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) |