| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 CCDrawQuad_h | 5 #ifndef CCDrawQuad_h |
| 6 #define CCDrawQuad_h | 6 #define CCDrawQuad_h |
| 7 | 7 |
| 8 #include "CCSharedQuadState.h" | 8 #include "CCSharedQuadState.h" |
| 9 | 9 |
| 10 namespace IPC { |
| 11 template <class P> struct ParamTraits; |
| 12 }; |
| 13 |
| 10 namespace cc { | 14 namespace cc { |
| 11 | 15 |
| 12 // WARNING! All CCXYZDrawQuad classes must remain PODs (plain old data). | 16 // WARNING! All CCXYZDrawQuad classes must remain PODs (plain old data). |
| 13 // They are intended to be "serializable" by copying their raw bytes, so they | 17 // They are intended to be "serializable" by copying their raw bytes, so they |
| 14 // must not contain any non-bit-copyable member variables! | 18 // must not contain any non-bit-copyable member variables! |
| 15 // | 19 // |
| 16 // Furthermore, the class members need to be packed so they are aligned | 20 // Furthermore, the class members need to be packed so they are aligned |
| 17 // properly and don't have paddings/gaps, otherwise memory check tools | 21 // properly and don't have paddings/gaps, otherwise memory check tools |
| 18 // like Valgrind will complain about uninitialized memory usage when | 22 // like Valgrind will complain about uninitialized memory usage when |
| 19 // transferring these classes over the wire. | 23 // transferring these classes over the wire. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // looking at the material type). | 63 // looking at the material type). |
| 60 unsigned size() const; | 64 unsigned size() const; |
| 61 | 65 |
| 62 scoped_ptr<CCDrawQuad> copy(const CCSharedQuadState* copiedSharedQuadState)
const; | 66 scoped_ptr<CCDrawQuad> copy(const CCSharedQuadState* copiedSharedQuadState)
const; |
| 63 | 67 |
| 64 const CCSharedQuadState* sharedQuadState() const { return m_sharedQuadState;
} | 68 const CCSharedQuadState* sharedQuadState() const { return m_sharedQuadState;
} |
| 65 int sharedQuadStateId() const { return m_sharedQuadStateId; } | 69 int sharedQuadStateId() const { return m_sharedQuadStateId; } |
| 66 void setSharedQuadState(const CCSharedQuadState*); | 70 void setSharedQuadState(const CCSharedQuadState*); |
| 67 | 71 |
| 68 protected: | 72 protected: |
| 73 friend struct IPC::ParamTraits<CCDrawQuad>; |
| 69 CCDrawQuad(const CCSharedQuadState*, Material, const IntRect&); | 74 CCDrawQuad(const CCSharedQuadState*, Material, const IntRect&); |
| 70 | 75 |
| 71 // Stores state common to a large bundle of quads; kept separate for memory | 76 // Stores state common to a large bundle of quads; kept separate for memory |
| 72 // efficiency. There is special treatment to reconstruct these pointers | 77 // efficiency. There is special treatment to reconstruct these pointers |
| 73 // during serialization. | 78 // during serialization. |
| 74 const CCSharedQuadState* m_sharedQuadState; | 79 const CCSharedQuadState* m_sharedQuadState; |
| 75 int m_sharedQuadStateId; | 80 int m_sharedQuadStateId; |
| 76 | 81 |
| 77 Material m_material; | 82 Material m_material; |
| 78 IntRect m_quadRect; | 83 IntRect m_quadRect; |
| 79 IntRect m_quadVisibleRect; | 84 IntRect m_quadVisibleRect; |
| 80 | 85 |
| 81 // By default, the shared quad state determines whether or not this quad is | 86 // By default, the shared quad state determines whether or not this quad is |
| 82 // opaque or needs blending. Derived classes can override with these | 87 // opaque or needs blending. Derived classes can override with these |
| 83 // variables. | 88 // variables. |
| 84 bool m_quadOpaque; | 89 bool m_quadOpaque; |
| 85 bool m_needsBlending; | 90 bool m_needsBlending; |
| 86 | 91 |
| 87 // Be default, this rect is empty. It is used when the shared quad state and
above | 92 // Be default, this rect is empty. It is used when the shared quad state and
above |
| 88 // variables determine that the quad is not fully opaque but may be partiall
y opaque. | 93 // variables determine that the quad is not fully opaque but may be partiall
y opaque. |
| 89 IntRect m_opaqueRect; | 94 IntRect m_opaqueRect; |
| 90 }; | 95 }; |
| 91 | 96 |
| 92 #pragma pack(pop) | 97 #pragma pack(pop) |
| 93 | 98 |
| 94 } | 99 } |
| 95 | 100 |
| 96 #endif | 101 #endif |
| OLD | NEW |