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/CompositorAnimation.h" |
35 #include "platform/geometry/FloatRect.h" | 37 #include "platform/geometry/FloatRect.h" |
36 #include "platform/geometry/LayoutRect.h" | 38 #include "platform/geometry/LayoutRect.h" |
37 #include "platform/graphics/BitmapImage.h" | 39 #include "platform/graphics/BitmapImage.h" |
| 40 #include "platform/graphics/CompositorFilterOperations.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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 } else { | 1096 } else { |
1096 if (m_imageLayer) { | 1097 if (m_imageLayer) { |
1097 unregisterContentsLayer(m_imageLayer->layer()); | 1098 unregisterContentsLayer(m_imageLayer->layer()); |
1098 m_imageLayer.clear(); | 1099 m_imageLayer.clear(); |
1099 } | 1100 } |
1100 } | 1101 } |
1101 | 1102 |
1102 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); | 1103 setContentsTo(m_imageLayer ? m_imageLayer->layer() : 0); |
1103 } | 1104 } |
1104 | 1105 |
1105 bool GraphicsLayer::addAnimation(PassOwnPtr<WebCompositorAnimation> popAnimation
) | 1106 bool GraphicsLayer::addAnimation(PassOwnPtr<CompositorAnimation> animation) |
1106 { | 1107 { |
1107 OwnPtr<WebCompositorAnimation> animation(std::move(popAnimation)); | |
1108 ASSERT(animation); | 1108 ASSERT(animation); |
1109 platformLayer()->setAnimationDelegate(this); | 1109 platformLayer()->setAnimationDelegate(this); |
1110 return platformLayer()->addAnimation(animation.leakPtr()); | 1110 return platformLayer()->addAnimation(animation->releaseCCAnimation()); |
1111 } | 1111 } |
1112 | 1112 |
1113 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) | 1113 void GraphicsLayer::pauseAnimation(int animationId, double timeOffset) |
1114 { | 1114 { |
1115 platformLayer()->pauseAnimation(animationId, timeOffset); | 1115 platformLayer()->pauseAnimation(animationId, timeOffset); |
1116 } | 1116 } |
1117 | 1117 |
1118 void GraphicsLayer::removeAnimation(int animationId) | 1118 void GraphicsLayer::removeAnimation(int animationId) |
1119 { | 1119 { |
1120 platformLayer()->removeAnimation(animationId); | 1120 platformLayer()->removeAnimation(animationId); |
1121 } | 1121 } |
1122 | 1122 |
1123 void GraphicsLayer::abortAnimation(int animationId) | 1123 void GraphicsLayer::abortAnimation(int animationId) |
1124 { | 1124 { |
1125 platformLayer()->abortAnimation(animationId); | 1125 platformLayer()->abortAnimation(animationId); |
1126 } | 1126 } |
1127 | 1127 |
1128 WebLayer* GraphicsLayer::platformLayer() const | 1128 WebLayer* GraphicsLayer::platformLayer() const |
1129 { | 1129 { |
1130 return m_layer->layer(); | 1130 return m_layer->layer(); |
1131 } | 1131 } |
1132 | 1132 |
1133 void GraphicsLayer::setFilters(const FilterOperations& filters) | 1133 void GraphicsLayer::setFilters(const FilterOperations& filters) |
1134 { | 1134 { |
1135 SkiaImageFilterBuilder builder; | 1135 SkiaImageFilterBuilder builder; |
1136 OwnPtr<WebFilterOperations> webFilters = adoptPtr(Platform::current()->compo
sitorSupport()->createFilterOperations()); | 1136 OwnPtr<CompositorFilterOperations> webFilters = adoptPtr(CompositorFactory::
current().createFilterOperations()); |
1137 builder.buildFilterOperations(filters, webFilters.get()); | 1137 builder.buildFilterOperations(filters, webFilters.get()); |
1138 m_layer->layer()->setFilters(*webFilters); | 1138 m_layer->layer()->setFilters(webFilters->asFilterOperations()); |
1139 } | 1139 } |
1140 | 1140 |
1141 void GraphicsLayer::setBackdropFilters(const FilterOperations& filters) | 1141 void GraphicsLayer::setBackdropFilters(const FilterOperations& filters) |
1142 { | 1142 { |
1143 SkiaImageFilterBuilder builder; | 1143 SkiaImageFilterBuilder builder; |
1144 OwnPtr<WebFilterOperations> webFilters = adoptPtr(Platform::current()->compo
sitorSupport()->createFilterOperations()); | 1144 OwnPtr<CompositorFilterOperations> webFilters = adoptPtr(CompositorFactory::
current().createFilterOperations()); |
1145 builder.buildFilterOperations(filters, webFilters.get()); | 1145 builder.buildFilterOperations(filters, webFilters.get()); |
1146 m_layer->layer()->setBackgroundFilters(*webFilters); | 1146 m_layer->layer()->setBackgroundFilters(webFilters->asFilterOperations()); |
1147 } | 1147 } |
1148 | 1148 |
1149 void GraphicsLayer::setFilterQuality(SkFilterQuality filterQuality) | 1149 void GraphicsLayer::setFilterQuality(SkFilterQuality filterQuality) |
1150 { | 1150 { |
1151 if (m_imageLayer) | 1151 if (m_imageLayer) |
1152 m_imageLayer->setNearestNeighbor(filterQuality == kNone_SkFilterQuality)
; | 1152 m_imageLayer->setNearestNeighbor(filterQuality == kNone_SkFilterQuality)
; |
1153 } | 1153 } |
1154 | 1154 |
1155 void GraphicsLayer::setPaintingPhase(GraphicsLayerPaintingPhase phase) | 1155 void GraphicsLayer::setPaintingPhase(GraphicsLayerPaintingPhase phase) |
1156 { | 1156 { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 { | 1252 { |
1253 if (!layer) { | 1253 if (!layer) { |
1254 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); | 1254 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); |
1255 return; | 1255 return; |
1256 } | 1256 } |
1257 | 1257 |
1258 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1258 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
1259 fprintf(stderr, "%s\n", output.utf8().data()); | 1259 fprintf(stderr, "%s\n", output.utf8().data()); |
1260 } | 1260 } |
1261 #endif | 1261 #endif |
OLD | NEW |