Chromium Code Reviews| 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 PaintChunkProperties_h | 5 #ifndef PaintChunkProperties_h |
| 6 #define PaintChunkProperties_h | 6 #define PaintChunkProperties_h |
| 7 | 7 |
| 8 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 8 #include "platform/graphics/paint/PropertyTreeState.h" |
| 9 #include "platform/graphics/paint/EffectPaintPropertyNode.h" | |
| 10 #include "platform/graphics/paint/ScrollPaintPropertyNode.h" | |
| 11 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | |
| 12 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
| 13 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
| 14 #include <iosfwd> | 11 #include <iosfwd> |
| 15 | 12 |
| 16 namespace blink { | 13 namespace blink { |
| 17 | 14 |
| 18 // The set of paint properties applying to a |PaintChunk|. These properties are | 15 // The set of paint properties applying to a |PaintChunk|. These properties are |
| 19 // not local-only paint style parameters such as color, but instead represent | 16 // not local-only paint style parameters such as color, but instead represent |
| 20 // the hierarchy of transforms, clips, effects, etc, that apply to a contiguous | 17 // the hierarchy of transforms, clips, effects, etc, that apply to a contiguous |
| 21 // chunk of display items. A single DisplayItemClient can generate multiple | 18 // chunk of display items. A single DisplayItemClient can generate multiple |
| 22 // properties of the same type and this struct represents the total state of all | 19 // properties of the same type and this struct represents the total state of all |
| 23 // properties for a given |PaintChunk|. | 20 // properties for a given |PaintChunk|. |
| 24 // | 21 // |
| 25 // This differs from |ObjectPaintProperties| because it only stores one property | 22 // This differs from |ObjectPaintProperties| because it only stores one property |
| 26 // for each type (e.g., either transform or perspective, but not both). | 23 // for each type (e.g., either transform or perspective, but not both). |
| 27 struct PaintChunkProperties { | 24 struct PaintChunkProperties { |
| 28 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 25 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 29 | 26 |
| 30 PaintChunkProperties() : backfaceHidden(false) {} | 27 PaintChunkProperties(const PropertyTreeState& state) |
| 28 : propertyTreeState(state), backfaceHidden(false) {} | |
| 29 | |
| 30 PaintChunkProperties() | |
| 31 : propertyTreeState(nullptr, nullptr, nullptr, nullptr), | |
| 32 backfaceHidden(false) {} | |
| 31 | 33 |
| 32 // TODO(pdr): Refactor these to use PropertyTreeState. | 34 // TODO(pdr): Refactor these to use PropertyTreeState. |
|
pdr.
2016/12/13 18:27:10
Please remove this comment
chrishtr
2016/12/13 21:03:40
Done.
| |
| 33 RefPtr<const TransformPaintPropertyNode> transform; | 35 PropertyTreeState propertyTreeState; |
| 34 RefPtr<const ClipPaintPropertyNode> clip; | |
| 35 RefPtr<const EffectPaintPropertyNode> effect; | |
| 36 RefPtr<const ScrollPaintPropertyNode> scroll; | |
| 37 bool backfaceHidden; | 36 bool backfaceHidden; |
| 38 }; | 37 }; |
| 39 | 38 |
| 40 // Equality is based only on the pointers and is not 'deep' which would require | 39 // Equality is based only on the pointers and is not 'deep' which would require |
| 41 // crawling the entire property tree to compute. | 40 // crawling the entire property tree to compute. |
| 42 inline bool operator==(const PaintChunkProperties& a, | 41 inline bool operator==(const PaintChunkProperties& a, |
| 43 const PaintChunkProperties& b) { | 42 const PaintChunkProperties& b) { |
| 44 return a.transform.get() == b.transform.get() && | 43 return a.propertyTreeState == b.propertyTreeState && |
| 45 a.clip.get() == b.clip.get() && a.effect.get() == b.effect.get() && | |
| 46 a.scroll.get() == b.scroll.get() && | |
| 47 a.backfaceHidden == b.backfaceHidden; | 44 a.backfaceHidden == b.backfaceHidden; |
| 48 } | 45 } |
| 49 | 46 |
| 50 inline bool operator!=(const PaintChunkProperties& a, | 47 inline bool operator!=(const PaintChunkProperties& a, |
| 51 const PaintChunkProperties& b) { | 48 const PaintChunkProperties& b) { |
| 52 return !(a == b); | 49 return !(a == b); |
| 53 } | 50 } |
| 54 | 51 |
| 55 // Redeclared here to avoid ODR issues. | 52 // Redeclared here to avoid ODR issues. |
| 56 // See platform/testing/PaintPrinters.h. | 53 // See platform/testing/PaintPrinters.h. |
| 57 void PrintTo(const PaintChunkProperties&, std::ostream*); | 54 void PrintTo(const PaintChunkProperties&, std::ostream*); |
| 58 | 55 |
| 59 } // namespace blink | 56 } // namespace blink |
| 60 | 57 |
| 61 #endif // PaintChunkProperties_h | 58 #endif // PaintChunkProperties_h |
| OLD | NEW |