| 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 11 matching lines...) Expand all Loading... |
| 22 ScopedPaintChunkProperties(PaintController& paintController, | 22 ScopedPaintChunkProperties(PaintController& paintController, |
| 23 const DisplayItemClient& client, | 23 const DisplayItemClient& client, |
| 24 DisplayItem::Type type, | 24 DisplayItem::Type type, |
| 25 const PaintChunkProperties& properties) | 25 const PaintChunkProperties& properties) |
| 26 : m_paintController(paintController), | 26 : m_paintController(paintController), |
| 27 m_previousProperties(paintController.currentPaintChunkProperties()) { | 27 m_previousProperties(paintController.currentPaintChunkProperties()) { |
| 28 PaintChunk::Id id(client, type); | 28 PaintChunk::Id id(client, type); |
| 29 m_paintController.updateCurrentPaintChunkProperties(&id, properties); | 29 m_paintController.updateCurrentPaintChunkProperties(&id, properties); |
| 30 } | 30 } |
| 31 | 31 |
| 32 // Omits the type parameter, in case that the client creates only one PaintChu
nkProperties node during each painting. | 32 // Omits the type parameter, in case that the client creates only one |
| 33 // PaintChunkProperties node during each painting. |
| 33 ScopedPaintChunkProperties(PaintController& paintController, | 34 ScopedPaintChunkProperties(PaintController& paintController, |
| 34 const DisplayItemClient& client, | 35 const DisplayItemClient& client, |
| 35 const PaintChunkProperties& properties) | 36 const PaintChunkProperties& properties) |
| 36 : ScopedPaintChunkProperties(paintController, | 37 : ScopedPaintChunkProperties(paintController, |
| 37 client, | 38 client, |
| 38 DisplayItem::kUninitializedType, | 39 DisplayItem::kUninitializedType, |
| 39 properties) {} | 40 properties) {} |
| 40 | 41 |
| 41 ~ScopedPaintChunkProperties() { | 42 ~ScopedPaintChunkProperties() { |
| 42 // We should not return to the previous id, because that may cause a new chu
nk to use | 43 // We should not return to the previous id, because that may cause a new |
| 43 // the same id as that of the previous chunk before this ScopedPaintChunkPro
perties. | 44 // chunk to use the same id as that of the previous chunk before this |
| 44 // The painter should create another scope of paint properties with new id,
or the | 45 // ScopedPaintChunkProperties. The painter should create another scope of |
| 45 // new chunk will have no id and will not match any old chunk and will be tr
eated as | 46 // paint properties with new id, or the new chunk will have no id and will |
| 46 // fully invalidated for rasterization. | 47 // not match any old chunk and will be treated as fully invalidated for |
| 48 // rasterization. |
| 47 m_paintController.updateCurrentPaintChunkProperties(nullptr, | 49 m_paintController.updateCurrentPaintChunkProperties(nullptr, |
| 48 m_previousProperties); | 50 m_previousProperties); |
| 49 } | 51 } |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 PaintController& m_paintController; | 54 PaintController& m_paintController; |
| 53 PaintChunkProperties m_previousProperties; | 55 PaintChunkProperties m_previousProperties; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 } // namespace blink | 58 } // namespace blink |
| 57 | 59 |
| 58 #endif // ScopedPaintChunkProperties_h | 60 #endif // ScopedPaintChunkProperties_h |
| OLD | NEW |