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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp

Issue 1361413004: Fix directly composited image path for CSS image-orientation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 #include "platform/graphics/GraphicsLayer.h" 27 #include "platform/graphics/GraphicsLayer.h"
28 28
29 #include "SkImageFilter.h" 29 #include "SkImageFilter.h"
30 #include "SkMatrix44.h" 30 #include "SkMatrix44.h"
31 #include "platform/DragImage.h"
32 #include "platform/RuntimeEnabledFeatures.h"
31 #include "platform/TraceEvent.h" 33 #include "platform/TraceEvent.h"
32 #include "platform/geometry/FloatRect.h" 34 #include "platform/geometry/FloatRect.h"
33 #include "platform/geometry/LayoutRect.h" 35 #include "platform/geometry/LayoutRect.h"
36 #include "platform/graphics/BitmapImage.h"
34 #include "platform/graphics/FirstPaintInvalidationTracking.h" 37 #include "platform/graphics/FirstPaintInvalidationTracking.h"
35 #include "platform/graphics/GraphicsContext.h" 38 #include "platform/graphics/GraphicsContext.h"
36 #include "platform/graphics/GraphicsLayerFactory.h" 39 #include "platform/graphics/GraphicsLayerFactory.h"
37 #include "platform/graphics/Image.h" 40 #include "platform/graphics/Image.h"
38 #include "platform/graphics/LinkHighlight.h" 41 #include "platform/graphics/LinkHighlight.h"
39 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" 42 #include "platform/graphics/filters/SkiaImageFilterBuilder.h"
40 #include "platform/graphics/paint/DisplayItemList.h" 43 #include "platform/graphics/paint/DisplayItemList.h"
41 #include "platform/graphics/paint/DrawingRecorder.h" 44 #include "platform/graphics/paint/DrawingRecorder.h"
42 #include "platform/scroll/ScrollableArea.h" 45 #include "platform/scroll/ScrollableArea.h"
43 #include "platform/text/TextStream.h" 46 #include "platform/text/TextStream.h"
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 } 1010 }
1008 1011
1009 void GraphicsLayer::setContentsToImage(Image* image) 1012 void GraphicsLayer::setContentsToImage(Image* image)
1010 { 1013 {
1011 RefPtr<SkImage> skImage = image ? image->imageForCurrentFrame() : nullptr; 1014 RefPtr<SkImage> skImage = image ? image->imageForCurrentFrame() : nullptr;
1012 if (image && skImage) { 1015 if (image && skImage) {
1013 if (!m_imageLayer) { 1016 if (!m_imageLayer) {
1014 m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateImageLayer()); 1017 m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->cr eateImageLayer());
1015 registerContentsLayer(m_imageLayer->layer()); 1018 registerContentsLayer(m_imageLayer->layer());
1016 } 1019 }
1020 if (RuntimeEnabledFeatures::imageOrientationEnabled() && image->isBitmap Image()) {
1021 ImageOrientation imageOrientation = static_cast<BitmapImage*>(image) ->currentFrameOrientation();
Noel Gordon 2015/09/25 00:12:19 Let's avoid the static cast: we could for example
1022 bool usesWidthAsHeight = imageOrientation.usesWidthAsHeight();
1023 IntSize size = usesWidthAsHeight ? image->size().transposedSize() : image->size();
1024 skImage = adjustedImage(skImage.release(), size, imageOrientation.tr ansformFromDefault(size), 1.0f);
1025 }
1017 m_imageLayer->setImage(skImage.get()); 1026 m_imageLayer->setImage(skImage.get());
1018 m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque()); 1027 m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque());
1019 updateContentsRect(); 1028 updateContentsRect();
1020 } else { 1029 } else {
1021 if (m_imageLayer) { 1030 if (m_imageLayer) {
1022 unregisterContentsLayer(m_imageLayer->layer()); 1031 unregisterContentsLayer(m_imageLayer->layer());
1023 m_imageLayer.clear(); 1032 m_imageLayer.clear();
1024 } 1033 }
1025 } 1034 }
1026 1035
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 { 1168 {
1160 if (!layer) { 1169 if (!layer) {
1161 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); 1170 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n");
1162 return; 1171 return;
1163 } 1172 }
1164 1173
1165 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1174 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1166 fprintf(stderr, "%s\n", output.utf8().data()); 1175 fprintf(stderr, "%s\n", output.utf8().data());
1167 } 1176 }
1168 #endif 1177 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698