OLD | NEW |
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 Loading... |
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" |
31 #include "platform/TraceEvent.h" | 32 #include "platform/TraceEvent.h" |
32 #include "platform/geometry/FloatRect.h" | 33 #include "platform/geometry/FloatRect.h" |
33 #include "platform/geometry/LayoutRect.h" | 34 #include "platform/geometry/LayoutRect.h" |
| 35 #include "platform/graphics/BitmapImage.h" |
34 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 36 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
35 #include "platform/graphics/GraphicsContext.h" | 37 #include "platform/graphics/GraphicsContext.h" |
36 #include "platform/graphics/GraphicsLayerFactory.h" | 38 #include "platform/graphics/GraphicsLayerFactory.h" |
37 #include "platform/graphics/Image.h" | 39 #include "platform/graphics/Image.h" |
38 #include "platform/graphics/LinkHighlight.h" | 40 #include "platform/graphics/LinkHighlight.h" |
39 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 41 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
40 #include "platform/graphics/paint/DisplayItemList.h" | 42 #include "platform/graphics/paint/DisplayItemList.h" |
41 #include "platform/graphics/paint/DrawingRecorder.h" | 43 #include "platform/graphics/paint/DrawingRecorder.h" |
42 #include "platform/scroll/ScrollableArea.h" | 44 #include "platform/scroll/ScrollableArea.h" |
43 #include "platform/text/TextStream.h" | 45 #include "platform/text/TextStream.h" |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 | 1039 |
1038 void GraphicsLayer::setContentsRect(const IntRect& rect) | 1040 void GraphicsLayer::setContentsRect(const IntRect& rect) |
1039 { | 1041 { |
1040 if (rect == m_contentsRect) | 1042 if (rect == m_contentsRect) |
1041 return; | 1043 return; |
1042 | 1044 |
1043 m_contentsRect = rect; | 1045 m_contentsRect = rect; |
1044 updateContentsRect(); | 1046 updateContentsRect(); |
1045 } | 1047 } |
1046 | 1048 |
1047 void GraphicsLayer::setContentsToImage(Image* image) | 1049 void GraphicsLayer::setContentsToImage(Image* image, RespectImageOrientationEnum
respectImageOrientation) |
1048 { | 1050 { |
1049 RefPtr<SkImage> skImage = image ? image->imageForCurrentFrame() : nullptr; | 1051 RefPtr<SkImage> skImage = image ? image->imageForCurrentFrame() : nullptr; |
1050 if (image && skImage) { | 1052 if (image && skImage) { |
1051 if (!m_imageLayer) { | 1053 if (!m_imageLayer) { |
1052 m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateImageLayer()); | 1054 m_imageLayer = adoptPtr(Platform::current()->compositorSupport()->cr
eateImageLayer()); |
1053 registerContentsLayer(m_imageLayer->layer()); | 1055 registerContentsLayer(m_imageLayer->layer()); |
1054 } | 1056 } |
| 1057 if (respectImageOrientation == RespectImageOrientation && image->isBitma
pImage()) { |
| 1058 ImageOrientation imageOrientation = toBitmapImage(image)->currentFra
meOrientation(); |
| 1059 skImage = DragImage::resizeAndOrientImage(skImage.release(), imageOr
ientation); |
| 1060 } |
1055 m_imageLayer->setImage(skImage.get()); | 1061 m_imageLayer->setImage(skImage.get()); |
1056 m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque()); | 1062 m_imageLayer->layer()->setOpaque(image->currentFrameKnownToBeOpaque()); |
1057 updateContentsRect(); | 1063 updateContentsRect(); |
1058 } else { | 1064 } else { |
1059 if (m_imageLayer) { | 1065 if (m_imageLayer) { |
1060 unregisterContentsLayer(m_imageLayer->layer()); | 1066 unregisterContentsLayer(m_imageLayer->layer()); |
1061 m_imageLayer.clear(); | 1067 m_imageLayer.clear(); |
1062 } | 1068 } |
1063 } | 1069 } |
1064 | 1070 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 { | 1203 { |
1198 if (!layer) { | 1204 if (!layer) { |
1199 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); | 1205 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); |
1200 return; | 1206 return; |
1201 } | 1207 } |
1202 | 1208 |
1203 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1209 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
1204 fprintf(stderr, "%s\n", output.utf8().data()); | 1210 fprintf(stderr, "%s\n", output.utf8().data()); |
1205 } | 1211 } |
1206 #endif | 1212 #endif |
OLD | NEW |