Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: third_party/WebKit/Source/platform/DragImage.cpp

Issue 1331533002: [poc] curve-filter Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix CanvasRenderingContext2D::createPattern crash for #40 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..bd5a3cbcd6383cffb4af4021723ae047c2b94a28 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,26 @@ 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;
+ RELEASE_ASSERT(currentScreenId()); // There should be an active graphics screen.
+
+ if (skImage && imageColorProfilesEnabled() && image->isBitmapImage() && toBitmapImage(image)->hasColorProfile())
+ skImage = toBitmapImage(image)->pictureForCurrentFrame();
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)

Powered by Google App Engine
This is Rietveld 408576698