| 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 "config.h" | 5 #include "config.h" |
| 6 #include "platform/graphics/paint/PaintController.h" | 6 #include "platform/graphics/paint/PaintController.h" |
| 7 | 7 |
| 8 #include "platform/NotImplemented.h" | 8 #include "platform/NotImplemented.h" |
| 9 #include "platform/TraceEvent.h" | 9 #include "platform/TraceEvent.h" |
| 10 #include "platform/graphics/GraphicsLayer.h" | 10 #include "platform/graphics/GraphicsLayer.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 void PaintController::endScope() | 109 void PaintController::endScope() |
| 110 { | 110 { |
| 111 m_scopeStack.removeLast(); | 111 m_scopeStack.removeLast(); |
| 112 endSkippingCache(); | 112 endSkippingCache(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void PaintController::invalidate(const DisplayItemClientWrapper& client, PaintIn
validationReason paintInvalidationReason, const IntRect& previousPaintInvalidati
onRect, const IntRect& newPaintInvalidationRect) | 115 void PaintController::invalidate(const DisplayItemClientWrapper& client, PaintIn
validationReason paintInvalidationReason, const IntRect& previousPaintInvalidati
onRect, const IntRect& newPaintInvalidationRect) |
| 116 { | 116 { |
| 117 invalidateClient(client); | 117 invalidateClient(client); |
| 118 | 118 |
| 119 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { | 119 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 120 Invalidation invalidation = { previousPaintInvalidationRect, paintInvali
dationReason }; | 120 Invalidation invalidation = { previousPaintInvalidationRect, paintInvali
dationReason }; |
| 121 if (!previousPaintInvalidationRect.isEmpty()) | 121 if (!previousPaintInvalidationRect.isEmpty()) |
| 122 m_invalidations.append(invalidation); | 122 m_invalidations.append(invalidation); |
| 123 if (newPaintInvalidationRect != previousPaintInvalidationRect && !newPai
ntInvalidationRect.isEmpty()) { | 123 if (newPaintInvalidationRect != previousPaintInvalidationRect && !newPai
ntInvalidationRect.isEmpty()) { |
| 124 invalidation.rect = newPaintInvalidationRect; | 124 invalidation.rect = newPaintInvalidationRect; |
| 125 m_invalidations.append(invalidation); | 125 m_invalidations.append(invalidation); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 if (!m_newDisplayItemList.isEmpty() && m_newDisplayItemList.last().type(
) == DisplayItem::CachedDisplayItemList) { | 279 if (!m_newDisplayItemList.isEmpty() && m_newDisplayItemList.last().type(
) == DisplayItem::CachedDisplayItemList) { |
| 280 // The whole display item list is cached. | 280 // The whole display item list is cached. |
| 281 ASSERT(m_newDisplayItemList.size() == 1 | 281 ASSERT(m_newDisplayItemList.size() == 1 |
| 282 || (m_newDisplayItemList.size() == 2 && m_newDisplayItemList[0].
type() == DisplayItem::DebugRedFill)); | 282 || (m_newDisplayItemList.size() == 2 && m_newDisplayItemList[0].
type() == DisplayItem::DebugRedFill)); |
| 283 ASSERT(m_invalidations.isEmpty()); | 283 ASSERT(m_invalidations.isEmpty()); |
| 284 ASSERT(m_clientsCheckedPaintInvalidation.isEmpty()); | 284 ASSERT(m_clientsCheckedPaintInvalidation.isEmpty()); |
| 285 m_newDisplayItemList.clear(); | 285 m_newDisplayItemList.clear(); |
| 286 m_newPaintChunks.clear(); | 286 m_newPaintChunks.clear(); |
| 287 return; | 287 return; |
| 288 } | 288 } |
| 289 } |
| 290 |
| 291 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 289 for (const auto& invalidation : m_invalidations) | 292 for (const auto& invalidation : m_invalidations) |
| 290 graphicsLayer->setNeedsDisplayInRect(invalidation.rect, invalidation
.invalidationReason); | 293 graphicsLayer->setNeedsDisplayInRect(invalidation.rect, invalidation
.invalidationReason); |
| 291 m_invalidations.clear(); | 294 m_invalidations.clear(); |
| 292 m_clientsCheckedPaintInvalidation.clear(); | 295 m_clientsCheckedPaintInvalidation.clear(); |
| 296 } else { |
| 297 ASSERT(m_invalidations.isEmpty()); |
| 293 } | 298 } |
| 294 | 299 |
| 295 // These data structures are used during painting only. | 300 // These data structures are used during painting only. |
| 296 ASSERT(m_scopeStack.isEmpty()); | 301 ASSERT(m_scopeStack.isEmpty()); |
| 297 m_scopeStack.clear(); | 302 m_scopeStack.clear(); |
| 298 m_nextScope = 1; | 303 m_nextScope = 1; |
| 299 ASSERT(!skippingCache()); | 304 ASSERT(!skippingCache()); |
| 300 #if ENABLE(ASSERT) | 305 #if ENABLE(ASSERT) |
| 301 m_newDisplayItemIndicesByClient.clear(); | 306 m_newDisplayItemIndicesByClient.clear(); |
| 302 m_clientsWithPaintOffsetInvalidations.clear(); | 307 m_clientsWithPaintOffsetInvalidations.clear(); |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 | 570 |
| 566 void PaintController::showDebugData() const | 571 void PaintController::showDebugData() const |
| 567 { | 572 { |
| 568 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.displayItemList()).utf8().data()); | 573 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.displayItemList()).utf8().data()); |
| 569 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); | 574 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); |
| 570 } | 575 } |
| 571 | 576 |
| 572 #endif // ifndef NDEBUG | 577 #endif // ifndef NDEBUG |
| 573 | 578 |
| 574 } // namespace blink | 579 } // namespace blink |
| OLD | NEW |