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 11 matching lines...) Expand all Loading... |
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 "platform/graphics/GraphicsLayer.h" | 26 #include "platform/graphics/GraphicsLayer.h" |
27 | 27 |
28 #include "SkImageFilter.h" | 28 #include "SkImageFilter.h" |
29 #include "SkMatrix44.h" | 29 #include "SkMatrix44.h" |
30 #include "base/trace_event/trace_event_argument.h" | 30 #include "base/trace_event/trace_event_argument.h" |
31 #include "cc/layers/layer.h" | 31 #include "cc/layers/layer.h" |
| 32 #include "platform/CompositorFactory.h" |
32 #include "platform/DragImage.h" | 33 #include "platform/DragImage.h" |
33 #include "platform/JSONValues.h" | 34 #include "platform/JSONValues.h" |
34 #include "platform/TraceEvent.h" | 35 #include "platform/TraceEvent.h" |
| 36 #include "platform/animation/WebCompositorAnimation.h" |
| 37 #include "platform/animation/WebFilterOperations.h" |
35 #include "platform/geometry/FloatRect.h" | 38 #include "platform/geometry/FloatRect.h" |
36 #include "platform/geometry/LayoutRect.h" | 39 #include "platform/geometry/LayoutRect.h" |
37 #include "platform/graphics/BitmapImage.h" | 40 #include "platform/graphics/BitmapImage.h" |
38 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 41 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
39 #include "platform/graphics/GraphicsContext.h" | 42 #include "platform/graphics/GraphicsContext.h" |
40 #include "platform/graphics/GraphicsLayerFactory.h" | 43 #include "platform/graphics/GraphicsLayerFactory.h" |
41 #include "platform/graphics/Image.h" | 44 #include "platform/graphics/Image.h" |
42 #include "platform/graphics/LinkHighlight.h" | 45 #include "platform/graphics/LinkHighlight.h" |
43 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 46 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
44 #include "platform/graphics/paint/DrawingRecorder.h" | 47 #include "platform/graphics/paint/DrawingRecorder.h" |
45 #include "platform/graphics/paint/PaintController.h" | 48 #include "platform/graphics/paint/PaintController.h" |
46 #include "platform/scroll/ScrollableArea.h" | 49 #include "platform/scroll/ScrollableArea.h" |
47 #include "platform/text/TextStream.h" | 50 #include "platform/text/TextStream.h" |
48 #include "public/platform/Platform.h" | 51 #include "public/platform/Platform.h" |
49 #include "public/platform/WebCompositorAnimation.h" | |
50 #include "public/platform/WebCompositorSupport.h" | 52 #include "public/platform/WebCompositorSupport.h" |
51 #include "public/platform/WebFilterOperations.h" | |
52 #include "public/platform/WebFloatPoint.h" | 53 #include "public/platform/WebFloatPoint.h" |
53 #include "public/platform/WebFloatRect.h" | 54 #include "public/platform/WebFloatRect.h" |
54 #include "public/platform/WebLayer.h" | 55 #include "public/platform/WebLayer.h" |
55 #include "public/platform/WebPoint.h" | 56 #include "public/platform/WebPoint.h" |
56 #include "public/platform/WebSize.h" | 57 #include "public/platform/WebSize.h" |
57 #include "wtf/CurrentTime.h" | 58 #include "wtf/CurrentTime.h" |
58 #include "wtf/HashMap.h" | 59 #include "wtf/HashMap.h" |
59 #include "wtf/HashSet.h" | 60 #include "wtf/HashSet.h" |
60 #include "wtf/MathExtras.h" | 61 #include "wtf/MathExtras.h" |
61 #include "wtf/text/StringUTF8Adaptor.h" | 62 #include "wtf/text/StringUTF8Adaptor.h" |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 } else { | 1108 } else { |
1108 if (m_imageLayer) { | 1109 if (m_imageLayer) { |
1109 unregisterContentsLayer(m_imageLayer->layer()); | 1110 unregisterContentsLayer(m_imageLayer->layer()); |
1110 m_imageLayer.clear(); | 1111 m_imageLayer.clear(); |
1111 } | 1112 } |
1112 } | 1113 } |
1113 | 1114 |
1114 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); | 1115 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); |
1115 } | 1116 } |
1116 | 1117 |
1117 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation
) | 1118 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> animation) |
1118 { | 1119 { |
1119 OwnPtr<WebCompositorAnimation> animation(std::move(popAnimation)); | |
1120 ASSERT(animation); | 1120 ASSERT(animation); |
1121 platformLayer()->setAnimationDelegate(this); | 1121 platformLayer()->setAnimationDelegate(this); |
1122 return platformLayer()->addAnimation(animation.leakPtr()); | 1122 return platformLayer()->addAnimation(animation->releaseCCAnimation()); |
1123 } | 1123 } |
1124 | 1124 |
1125 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) | 1125 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) |
1126 { | 1126 { |
1127 platformLayer()->pauseAnimation(animationId, timeOffset); | 1127 platformLayer()->pauseAnimation(animationId, timeOffset); |
1128 } | 1128 } |
1129 | 1129 |
1130 void GraphicsLayer::removeAnimation(int animationId) | 1130 void GraphicsLayer::removeAnimation(int animationId) |
1131 { | 1131 { |
1132 platformLayer()->removeAnimation(animationId); | 1132 platformLayer()->removeAnimation(animationId); |
1133 } | 1133 } |
1134 | 1134 |
1135 void GraphicsLayer::abortAnimation(int animationId) | 1135 void GraphicsLayer::abortAnimation(int animationId) |
1136 { | 1136 { |
1137 platformLayer()->abortAnimation(animationId); | 1137 platformLayer()->abortAnimation(animationId); |
1138 } | 1138 } |
1139 | 1139 |
1140 WebLayer* GraphicsLayer::platformLayer() const | 1140 WebLayer* GraphicsLayer::platformLayer() const |
1141 { | 1141 { |
1142 return m_layer->layer(); | 1142 return m_layer->layer(); |
1143 } | 1143 } |
1144 | 1144 |
1145 void GraphicsLayer::setFilters(const FilterOperations& filters) | 1145 void GraphicsLayer::setFilters(const FilterOperations& filters) |
1146 { | 1146 { |
1147 SkiaImageFilterBuilder builder; | 1147 SkiaImageFilterBuilder builder; |
1148 OwnPtr<WebFilterOperations> webFilters = adoptPtr(Platform::current()->compo
sitorSupport()->createFilterOperations()); | 1148 OwnPtr<WebFilterOperations> webFilters = adoptPtr(CompositorFactory::current
().createFilterOperations()); |
1149 builder.buildFilterOperations(filters, webFilters.get()); | 1149 builder.buildFilterOperations(filters, webFilters.get()); |
1150 m_layer->layer()->setFilters(*webFilters); | 1150 m_layer->layer()->setFilters(webFilters->AsFilterOperations()); |
1151 } | 1151 } |
1152 | 1152 |
1153 void GraphicsLayer::setBackdropFilters(const FilterOperations& filters) | 1153 void GraphicsLayer::setBackdropFilters(const FilterOperations& filters) |
1154 { | 1154 { |
1155 SkiaImageFilterBuilder builder; | 1155 SkiaImageFilterBuilder builder; |
1156 OwnPtr<WebFilterOperations> webFilters = adoptPtr(Platform::current()->compo
sitorSupport()->createFilterOperations()); | 1156 OwnPtr<WebFilterOperations> webFilters = adoptPtr(CompositorFactory::current
().createFilterOperations()); |
1157 builder.buildFilterOperations(filters, webFilters.get()); | 1157 builder.buildFilterOperations(filters, webFilters.get()); |
1158 m_layer->layer()->setBackgroundFilters(*webFilters); | 1158 m_layer->layer()->setBackgroundFilters(webFilters->AsFilterOperations()); |
1159 } | 1159 } |
1160 | 1160 |
1161 void GraphicsLayer::setFilterQuality(SkFilterQuality filterQuality) | 1161 void GraphicsLayer::setFilterQuality(SkFilterQuality filterQuality) |
1162 { | 1162 { |
1163 if (m_imageLayer) | 1163 if (m_imageLayer) |
1164 m_imageLayer->setNearestNeighbor(filterQuality == kNone_SkFilterQuality)
; | 1164 m_imageLayer->setNearestNeighbor(filterQuality == kNone_SkFilterQuality)
; |
1165 } | 1165 } |
1166 | 1166 |
1167 void GraphicsLayer::setPaintingPhase(GraphicsLayerPaintingPhase phase) | 1167 void GraphicsLayer::setPaintingPhase(GraphicsLayerPaintingPhase phase) |
1168 { | 1168 { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 { | 1264 { |
1265 if (!layer) { | 1265 if (!layer) { |
1266 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); | 1266 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); |
1267 return; | 1267 return; |
1268 } | 1268 } |
1269 | 1269 |
1270 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1270 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
1271 fprintf(stderr, "%s\n", output.utf8().data()); | 1271 fprintf(stderr, "%s\n", output.utf8().data()); |
1272 } | 1272 } |
1273 #endif | 1273 #endif |
OLD | NEW |