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/RuntimeEnabledFeatures.h" | |
32 #include "platform/TraceEvent.h" | 31 #include "platform/TraceEvent.h" |
33 #include "platform/geometry/FloatRect.h" | 32 #include "platform/geometry/FloatRect.h" |
34 #include "platform/geometry/LayoutRect.h" | 33 #include "platform/geometry/LayoutRect.h" |
35 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 34 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
36 #include "platform/graphics/GraphicsContext.h" | |
37 #include "platform/graphics/GraphicsLayerFactory.h" | 35 #include "platform/graphics/GraphicsLayerFactory.h" |
38 #include "platform/graphics/Image.h" | 36 #include "platform/graphics/Image.h" |
39 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 37 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
40 #include "platform/graphics/paint/DisplayItemList.h" | |
41 #include "platform/graphics/skia/NativeImageSkia.h" | 38 #include "platform/graphics/skia/NativeImageSkia.h" |
42 #include "platform/scroll/ScrollableArea.h" | 39 #include "platform/scroll/ScrollableArea.h" |
43 #include "platform/text/TextStream.h" | 40 #include "platform/text/TextStream.h" |
44 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
45 #include "public/platform/WebCompositorAnimation.h" | 42 #include "public/platform/WebCompositorAnimation.h" |
46 #include "public/platform/WebCompositorSupport.h" | 43 #include "public/platform/WebCompositorSupport.h" |
47 #include "public/platform/WebFilterOperations.h" | 44 #include "public/platform/WebFilterOperations.h" |
48 #include "public/platform/WebFloatPoint.h" | 45 #include "public/platform/WebFloatPoint.h" |
49 #include "public/platform/WebFloatRect.h" | 46 #include "public/platform/WebFloatRect.h" |
50 #include "public/platform/WebGraphicsLayerDebugInfo.h" | 47 #include "public/platform/WebGraphicsLayerDebugInfo.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 264 } |
268 | 265 |
269 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I
ntRect& clip) | 266 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I
ntRect& clip) |
270 { | 267 { |
271 if (!m_client) | 268 if (!m_client) |
272 return; | 269 return; |
273 if (firstPaintInvalidationTrackingEnabled()) | 270 if (firstPaintInvalidationTrackingEnabled()) |
274 m_debugInfo.clearAnnotatedInvalidateRects(); | 271 m_debugInfo.clearAnnotatedInvalidateRects(); |
275 incrementPaintCount(); | 272 incrementPaintCount(); |
276 m_client->paintContents(this, context, m_paintingPhase, clip); | 273 m_client->paintContents(this, context, m_paintingPhase, clip); |
277 | |
278 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | |
279 | |
280 #ifndef NDEBUG | |
281 context.fillRect(clip, Color(0xFF, 0, 0)); | |
282 #endif | |
283 // FIXME: This is incorrect for squashed layers. | |
284 // We should do proper translation in CompositedLayerMapping once transf
orm paint item is implemented. | |
285 context.translate(-m_offsetFromRenderer.width(), -m_offsetFromRenderer.h
eight()); | |
286 const PaintList& paintList = displayItemList().paintList(); | |
287 for (PaintList::const_iterator it = paintList.begin(); it != paintList.e
nd(); ++it) | |
288 (*it)->replay(&context); | |
289 context.translate(m_offsetFromRenderer.width(), m_offsetFromRenderer.hei
ght()); | |
290 } | |
291 } | 274 } |
292 | 275 |
293 void GraphicsLayer::updateChildList() | 276 void GraphicsLayer::updateChildList() |
294 { | 277 { |
295 WebLayer* childHost = m_layer->layer(); | 278 WebLayer* childHost = m_layer->layer(); |
296 childHost->removeAllChildren(); | 279 childHost->removeAllChildren(); |
297 | 280 |
298 clearContentsLayerIfUnregistered(); | 281 clearContentsLayerIfUnregistered(); |
299 | 282 |
300 if (m_contentsLayer) { | 283 if (m_contentsLayer) { |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 | 1048 |
1066 void GraphicsLayer::didScroll() | 1049 void GraphicsLayer::didScroll() |
1067 { | 1050 { |
1068 if (m_scrollableArea) { | 1051 if (m_scrollableArea) { |
1069 DoublePoint newPosition = m_scrollableArea->minimumScrollPosition() + to
DoubleSize(m_layer->layer()->scrollPositionDouble()); | 1052 DoublePoint newPosition = m_scrollableArea->minimumScrollPosition() + to
DoubleSize(m_layer->layer()->scrollPositionDouble()); |
1070 // FIXME: Remove the toFloatPoint(). crbug.com/414283. | 1053 // FIXME: Remove the toFloatPoint(). crbug.com/414283. |
1071 m_scrollableArea->scrollToOffsetWithoutAnimation(toFloatPoint(newPositio
n)); | 1054 m_scrollableArea->scrollToOffsetWithoutAnimation(toFloatPoint(newPositio
n)); |
1072 } | 1055 } |
1073 } | 1056 } |
1074 | 1057 |
1075 DisplayItemList& GraphicsLayer::displayItemList() | |
1076 { | |
1077 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | |
1078 if (!m_displayItemList) | |
1079 m_displayItemList = adoptPtr(new DisplayItemList()); | |
1080 return *m_displayItemList; | |
1081 } | |
1082 | |
1083 } // namespace blink | 1058 } // namespace blink |
1084 | 1059 |
1085 #ifndef NDEBUG | 1060 #ifndef NDEBUG |
1086 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) | 1061 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) |
1087 { | 1062 { |
1088 if (!layer) | 1063 if (!layer) |
1089 return; | 1064 return; |
1090 | 1065 |
1091 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1066 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
1092 fprintf(stderr, "%s\n", output.utf8().data()); | 1067 fprintf(stderr, "%s\n", output.utf8().data()); |
1093 } | 1068 } |
1094 #endif | 1069 #endif |
OLD | NEW |