Index: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
index f7081603b2a7f3199c101bbd63c343ca5d329dcf..246b1e59e258c9a6a7396396f76a71e56194cd33 100644 |
--- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp |
@@ -28,9 +28,11 @@ |
#include "SkImageFilter.h" |
#include "SkMatrix44.h" |
+#include "platform/DragImage.h" |
#include "platform/TraceEvent.h" |
#include "platform/geometry/FloatRect.h" |
#include "platform/geometry/LayoutRect.h" |
+#include "platform/graphics/BitmapImage.h" |
#include "platform/graphics/FirstPaintInvalidationTracking.h" |
#include "platform/graphics/GraphicsContext.h" |
#include "platform/graphics/GraphicsLayerFactory.h" |
@@ -1043,7 +1045,7 @@ void GraphicsLayer::setContentsRect(const IntRect& rect) |
updateContentsRect(); |
} |
-void GraphicsLayer::setContentsToImage(Image* image) |
+void GraphicsLayer::setContentsToImage(Image* image, RespectImageOrientationEnum respectImageOrientation) |
{ |
RefPtr<SkImage> skImage = image ? image->imageForCurrentFrame() : nullptr; |
if (image && skImage) { |
@@ -1051,6 +1053,12 @@ void GraphicsLayer::setContentsToImage(Image* image) |
m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->createImageLayer()); |
registerContentsLayer(m_imageLayer->layer()); |
} |
+ if (respectImageOrientation == RespectImageOrientation && image->isBitmapImage()) { |
+ ImageOrientation imageOrientation = toBitmapImage(image)->currentFrameOrientation(); |
+ bool usesWidthAsHeight = imageOrientation.usesWidthAsHeight(); |
+ IntSize size = usesWidthAsHeight ? image->size().transposedSize() : image->size(); |
+ skImage = adjustedImage(skImage.release(), size, imageOrientation.transformFromDefault(size), 1.0f); |
+ } |
m_imageLayer->setImage(skImage.get()); |
m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque()); |
updateContentsRect(); |