OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/graphics/paint/PaintController.h" | 5 #include "platform/graphics/paint/PaintController.h" |
6 | 6 |
7 #include "platform/TraceEvent.h" | 7 #include "platform/TraceEvent.h" |
8 #include "platform/graphics/GraphicsLayer.h" | 8 #include "platform/graphics/GraphicsLayer.h" |
9 #include "platform/graphics/paint/DrawingDisplayItem.h" | 9 #include "platform/graphics/paint/DrawingDisplayItem.h" |
10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" | 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 SkPictureGpuAnalyzer gpuAnalyzer; | 305 SkPictureGpuAnalyzer gpuAnalyzer; |
306 | 306 |
307 if (m_currentPaintArtifact.isEmpty()) { | 307 if (m_currentPaintArtifact.isEmpty()) { |
308 #if DCHECK_IS_ON() | 308 #if DCHECK_IS_ON() |
309 for (const auto& item : m_newDisplayItemList) | 309 for (const auto& item : m_newDisplayItemList) |
310 DCHECK(!item.isCached()); | 310 DCHECK(!item.isCached()); |
311 #endif | 311 #endif |
312 | 312 |
313 for (const auto& item : m_newDisplayItemList) { | 313 for (const auto& item : m_newDisplayItemList) { |
314 m_newDisplayItemList.appendVisualRect(visualRectForDisplayItem(item,
offsetFromLayoutObject)); | 314 m_newDisplayItemList.appendVisualRect(visualRectForDisplayItem(item,
offsetFromLayoutObject)); |
315 if (item.isDrawing()) | 315 // No reason to continue the analysis once we have a veto. |
316 gpuAnalyzer.analyze(static_cast<const DrawingDisplayItem&>(item)
.picture()); | 316 if (gpuAnalyzer.suitableForGpuRasterization()) |
| 317 item.analyzeForGpuRasterization(gpuAnalyzer); |
317 } | 318 } |
318 m_currentPaintArtifact = PaintArtifact(std::move(m_newDisplayItemList),
m_newPaintChunks.releasePaintChunks(), gpuAnalyzer.suitableForGpuRasterization()
); | 319 m_currentPaintArtifact = PaintArtifact(std::move(m_newDisplayItemList),
m_newPaintChunks.releasePaintChunks(), gpuAnalyzer.suitableForGpuRasterization()
); |
319 m_newDisplayItemList = DisplayItemList(kInitialDisplayItemListCapacityBy
tes); | 320 m_newDisplayItemList = DisplayItemList(kInitialDisplayItemListCapacityBy
tes); |
320 updateCacheGeneration(); | 321 updateCacheGeneration(); |
321 return; | 322 return; |
322 } | 323 } |
323 | 324 |
324 // Stores indices to valid DrawingDisplayItems in m_currentDisplayItems that
have not been matched | 325 // Stores indices to valid DrawingDisplayItems in m_currentDisplayItems that
have not been matched |
325 // by CachedDisplayItems during synchronized matching. The indexed items wil
l be matched | 326 // by CachedDisplayItems during synchronized matching. The indexed items wil
l be matched |
326 // by later out-of-order CachedDisplayItems in m_newDisplayItemList. This en
sures that when | 327 // by later out-of-order CachedDisplayItems in m_newDisplayItemList. This en
sures that when |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 | 568 |
568 void PaintController::showDebugData() const | 569 void PaintController::showDebugData() const |
569 { | 570 { |
570 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); | 571 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); |
571 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); | 572 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); |
572 } | 573 } |
573 | 574 |
574 #endif // ifndef NDEBUG | 575 #endif // ifndef NDEBUG |
575 | 576 |
576 } // namespace blink | 577 } // namespace blink |
OLD | NEW |