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