| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/DisplayItemList.h" | 5 #include "platform/graphics/paint/DisplayItemList.h" |
| 6 | 6 |
| 7 #include "platform/graphics/paint/DrawingDisplayItem.h" | 7 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 8 #include "platform/graphics/paint/PaintChunk.h" | 8 #include "platform/graphics/paint/PaintChunk.h" |
| 9 #include "third_party/skia/include/core/SkPictureAnalyzer.h" | 9 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
| 10 | 10 |
| 11 #ifndef NDEBUG | 11 #ifndef NDEBUG |
| 12 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 DisplayItem& DisplayItemList::appendByMoving(DisplayItem& item, const IntRect& v
isualRect, SkPictureGpuAnalyzer& gpuAnalyzer) | 17 DisplayItem& DisplayItemList::appendByMoving(DisplayItem& item) |
| 18 { | 18 { |
| 19 // No reason to continue the analysis once we have a veto. | |
| 20 if (gpuAnalyzer.suitableForGpuRasterization()) | |
| 21 item.analyzeForGpuRasterization(gpuAnalyzer); | |
| 22 | |
| 23 #ifndef NDEBUG | 19 #ifndef NDEBUG |
| 24 String originalDebugString = item.asDebugString(); | 20 String originalDebugString = item.asDebugString(); |
| 25 #endif | 21 #endif |
| 26 ASSERT(item.hasValidClient()); | 22 ASSERT(item.hasValidClient()); |
| 27 DisplayItem& result = ContiguousContainer::appendByMoving(item, item.derived
Size()); | 23 DisplayItem& result = ContiguousContainer::appendByMoving(item, item.derived
Size()); |
| 28 // ContiguousContainer::appendByMoving() calls an in-place constructor | 24 // ContiguousContainer::appendByMoving() calls an in-place constructor |
| 29 // on item which replaces it with a tombstone/"dead display item" that | 25 // on item which replaces it with a tombstone/"dead display item" that |
| 30 // can be safely destructed but should never be used. | 26 // can be safely destructed but should never be used. |
| 31 ASSERT(!item.hasValidClient()); | 27 ASSERT(!item.hasValidClient()); |
| 32 #ifndef NDEBUG | 28 #ifndef NDEBUG |
| 33 // Save original debug string in the old item to help debugging. | 29 // Save original debug string in the old item to help debugging. |
| 34 item.setClientDebugString(originalDebugString); | 30 item.setClientDebugString(originalDebugString); |
| 35 #endif | 31 #endif |
| 36 appendVisualRect(visualRect); | |
| 37 return result; | 32 return result; |
| 38 } | 33 } |
| 39 | 34 |
| 40 void DisplayItemList::appendVisualRect(const IntRect& visualRect) | 35 void DisplayItemList::appendVisualRect(const IntRect& visualRect) |
| 41 { | 36 { |
| 42 size_t itemIndex = m_visualRects.size(); | 37 size_t itemIndex = m_visualRects.size(); |
| 43 const DisplayItem& item = (*this)[itemIndex]; | 38 const DisplayItem& item = (*this)[itemIndex]; |
| 44 | 39 |
| 45 // For paired display items such as transforms, since we are not guaranteed
containment, the | 40 // For paired display items such as transforms, since we are not guaranteed
containment, the |
| 46 // visual rect must comprise the union of the visual rects for all items wit
hin its block. | 41 // visual rect must comprise the union of the visual rects for all items wit
hin its block. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 77 return Range<iterator>(begin() + paintChunk.beginIndex, begin() + paintChunk
.endIndex); | 72 return Range<iterator>(begin() + paintChunk.beginIndex, begin() + paintChunk
.endIndex); |
| 78 } | 73 } |
| 79 | 74 |
| 80 DisplayItemList::Range<DisplayItemList::const_iterator> | 75 DisplayItemList::Range<DisplayItemList::const_iterator> |
| 81 DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) const | 76 DisplayItemList::itemsInPaintChunk(const PaintChunk& paintChunk) const |
| 82 { | 77 { |
| 83 return Range<const_iterator>(begin() + paintChunk.beginIndex, begin() + pain
tChunk.endIndex); | 78 return Range<const_iterator>(begin() + paintChunk.beginIndex, begin() + pain
tChunk.endIndex); |
| 84 } | 79 } |
| 85 | 80 |
| 86 } // namespace blink | 81 } // namespace blink |
| OLD | NEW |