| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef ScopedPaintChunkProperties_h | 5 #ifndef ScopedPaintChunkProperties_h |
| 6 #define ScopedPaintChunkProperties_h | 6 #define ScopedPaintChunkProperties_h |
| 7 | 7 |
| 8 #include "platform/graphics/paint/DisplayItem.h" | 8 #include "platform/graphics/paint/DisplayItem.h" |
| 9 #include "platform/graphics/paint/PaintChunk.h" | 9 #include "platform/graphics/paint/PaintChunk.h" |
| 10 #include "platform/graphics/paint/PaintChunkProperties.h" | 10 #include "platform/graphics/paint/PaintChunkProperties.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 ScopedPaintChunkProperties(PaintController& paintController, const DisplayIt
emClient& client, DisplayItem::Type type, const PaintChunkProperties& properties
) | 21 ScopedPaintChunkProperties(PaintController& paintController, const DisplayIt
emClient& client, DisplayItem::Type type, const PaintChunkProperties& properties
) |
| 22 : m_paintController(paintController) | 22 : m_paintController(paintController) |
| 23 , m_previousProperties(paintController.currentPaintChunkProperties()) | 23 , m_previousProperties(paintController.currentPaintChunkProperties()) |
| 24 { | 24 { |
| 25 PaintChunk::Id id(client, type); | 25 PaintChunk::Id id(client, type); |
| 26 m_paintController.updateCurrentPaintChunkProperties(&id, properties); | 26 m_paintController.updateCurrentPaintChunkProperties(&id, properties); |
| 27 } | 27 } |
| 28 | 28 |
| 29 // Omits the type parameter, in case that the client creates only one PaintC
hunkProperties node during each painting. | 29 // Omits the type parameter, in case that the client creates only one PaintC
hunkProperties node during each painting. |
| 30 ScopedPaintChunkProperties(PaintController& paintController, const DisplayIt
emClient& client, const PaintChunkProperties& properties) | 30 ScopedPaintChunkProperties(PaintController& paintController, const DisplayIt
emClient& client, const PaintChunkProperties& properties) |
| 31 : ScopedPaintChunkProperties(paintController, client, DisplayItem::Unini
tializedType, properties) | 31 : ScopedPaintChunkProperties(paintController, client, DisplayItem::kUnin
itializedType, properties) |
| 32 { } | 32 { } |
| 33 | 33 |
| 34 ~ScopedPaintChunkProperties() | 34 ~ScopedPaintChunkProperties() |
| 35 { | 35 { |
| 36 // We should not return to the previous id, because that may cause a new
chunk to use | 36 // We should not return to the previous id, because that may cause a new
chunk to use |
| 37 // the same id as that of the previous chunk before this ScopedPaintChun
kProperties. | 37 // the same id as that of the previous chunk before this ScopedPaintChun
kProperties. |
| 38 // The painter should create another scope of paint properties with new
id, or the | 38 // The painter should create another scope of paint properties with new
id, or the |
| 39 // new chunk will have no id and will not match any old chunk and will b
e treated as | 39 // new chunk will have no id and will not match any old chunk and will b
e treated as |
| 40 // fully invalidated for rasterization. | 40 // fully invalidated for rasterization. |
| 41 m_paintController.updateCurrentPaintChunkProperties(nullptr, m_previousP
roperties); | 41 m_paintController.updateCurrentPaintChunkProperties(nullptr, m_previousP
roperties); |
| 42 } | 42 } |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 PaintController& m_paintController; | 45 PaintController& m_paintController; |
| 46 PaintChunkProperties m_previousProperties; | 46 PaintChunkProperties m_previousProperties; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 } // namespace blink | 49 } // namespace blink |
| 50 | 50 |
| 51 #endif // ScopedPaintChunkProperties_h | 51 #endif // ScopedPaintChunkProperties_h |
| OLD | NEW |