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" |
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" |
34 #include "platform/graphics/FirstPaintInvalidationTracking.h" | 35 #include "platform/graphics/FirstPaintInvalidationTracking.h" |
| 36 #include "platform/graphics/GraphicsContext.h" |
35 #include "platform/graphics/GraphicsLayerFactory.h" | 37 #include "platform/graphics/GraphicsLayerFactory.h" |
36 #include "platform/graphics/Image.h" | 38 #include "platform/graphics/Image.h" |
37 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 39 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
| 40 #include "platform/graphics/paint/DisplayItemList.h" |
38 #include "platform/graphics/skia/NativeImageSkia.h" | 41 #include "platform/graphics/skia/NativeImageSkia.h" |
39 #include "platform/scroll/ScrollableArea.h" | 42 #include "platform/scroll/ScrollableArea.h" |
40 #include "platform/text/TextStream.h" | 43 #include "platform/text/TextStream.h" |
41 #include "public/platform/Platform.h" | 44 #include "public/platform/Platform.h" |
42 #include "public/platform/WebCompositorAnimation.h" | 45 #include "public/platform/WebCompositorAnimation.h" |
43 #include "public/platform/WebCompositorSupport.h" | 46 #include "public/platform/WebCompositorSupport.h" |
44 #include "public/platform/WebFilterOperations.h" | 47 #include "public/platform/WebFilterOperations.h" |
45 #include "public/platform/WebFloatPoint.h" | 48 #include "public/platform/WebFloatPoint.h" |
46 #include "public/platform/WebFloatRect.h" | 49 #include "public/platform/WebFloatRect.h" |
47 #include "public/platform/WebGraphicsLayerDebugInfo.h" | 50 #include "public/platform/WebGraphicsLayerDebugInfo.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 267 } |
265 | 268 |
266 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I
ntRect& clip) | 269 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const I
ntRect& clip) |
267 { | 270 { |
268 if (!m_client) | 271 if (!m_client) |
269 return; | 272 return; |
270 if (firstPaintInvalidationTrackingEnabled()) | 273 if (firstPaintInvalidationTrackingEnabled()) |
271 m_debugInfo.clearAnnotatedInvalidateRects(); | 274 m_debugInfo.clearAnnotatedInvalidateRects(); |
272 incrementPaintCount(); | 275 incrementPaintCount(); |
273 m_client->paintContents(this, context, m_paintingPhase, clip); | 276 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 } |
274 } | 291 } |
275 | 292 |
276 void GraphicsLayer::updateChildList() | 293 void GraphicsLayer::updateChildList() |
277 { | 294 { |
278 WebLayer* childHost = m_layer->layer(); | 295 WebLayer* childHost = m_layer->layer(); |
279 childHost->removeAllChildren(); | 296 childHost->removeAllChildren(); |
280 | 297 |
281 clearContentsLayerIfUnregistered(); | 298 clearContentsLayerIfUnregistered(); |
282 | 299 |
283 if (m_contentsLayer) { | 300 if (m_contentsLayer) { |
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 | 1065 |
1049 void GraphicsLayer::didScroll() | 1066 void GraphicsLayer::didScroll() |
1050 { | 1067 { |
1051 if (m_scrollableArea) { | 1068 if (m_scrollableArea) { |
1052 DoublePoint newPosition = m_scrollableArea->minimumScrollPosition() + to
DoubleSize(m_layer->layer()->scrollPositionDouble()); | 1069 DoublePoint newPosition = m_scrollableArea->minimumScrollPosition() + to
DoubleSize(m_layer->layer()->scrollPositionDouble()); |
1053 // FIXME: Remove the toFloatPoint(). crbug.com/414283. | 1070 // FIXME: Remove the toFloatPoint(). crbug.com/414283. |
1054 m_scrollableArea->scrollToOffsetWithoutAnimation(toFloatPoint(newPositio
n)); | 1071 m_scrollableArea->scrollToOffsetWithoutAnimation(toFloatPoint(newPositio
n)); |
1055 } | 1072 } |
1056 } | 1073 } |
1057 | 1074 |
| 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 |
1058 } // namespace blink | 1083 } // namespace blink |
1059 | 1084 |
1060 #ifndef NDEBUG | 1085 #ifndef NDEBUG |
1061 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) | 1086 void showGraphicsLayerTree(const blink::GraphicsLayer* layer) |
1062 { | 1087 { |
1063 if (!layer) | 1088 if (!layer) |
1064 return; | 1089 return; |
1065 | 1090 |
1066 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); | 1091 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); |
1067 fprintf(stderr, "%s\n", output.utf8().data()); | 1092 fprintf(stderr, "%s\n", output.utf8().data()); |
1068 } | 1093 } |
1069 #endif | 1094 #endif |
OLD | NEW |