Chromium Code Reviews| 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 MockCCQuadCuller_h | 5 #ifndef MockCCQuadCuller_h |
| 6 #define MockCCQuadCuller_h | 6 #define MockCCQuadCuller_h |
| 7 | 7 |
| 8 #include "CCDrawQuad.h" | 8 #include "CCDrawQuad.h" |
| 9 #include "CCQuadSink.h" | 9 #include "CCQuadSink.h" |
| 10 #include "CCRenderPass.h" | |
| 10 #include "IntRect.h" | 11 #include "IntRect.h" |
| 11 #include <wtf/PassOwnPtr.h> | 12 #include <wtf/PassOwnPtr.h> |
| 12 | 13 |
| 13 namespace cc { | 14 namespace cc { |
| 14 | 15 |
| 15 class MockCCQuadCuller : public CCQuadSink { | 16 class MockCCQuadCuller : public CCQuadSink { |
| 16 public: | 17 public: |
| 17 MockCCQuadCuller() | 18 MockCCQuadCuller(); |
| 18 : m_activeQuadList(m_quadListStorage) | 19 virtual ~MockCCQuadCuller(); |
| 19 , m_activeSharedQuadStateList(m_sharedQuadStateStorage) | |
| 20 { } | |
| 21 | 20 |
| 22 explicit MockCCQuadCuller(CCQuadList& externalQuadList, CCSharedQuadStateLis t& externalSharedQuadStateList) | 21 explicit MockCCQuadCuller(CCQuadList& externalQuadList, CCSharedQuadStateLis t& externalSharedQuadStateList); |
|
jamesr
2012/09/20 00:36:19
can drop the explicit since this takes 2 args
| |
| 23 : m_activeQuadList(externalQuadList) | |
| 24 , m_activeSharedQuadStateList(externalSharedQuadStateList) | |
| 25 { } | |
| 26 | 22 |
| 27 virtual bool append(PassOwnPtr<CCDrawQuad> newQuad, CCAppendQuadsData&) OVER RIDE | 23 virtual bool append(PassOwnPtr<CCDrawQuad> newQuad, CCAppendQuadsData&) OVER RIDE; |
| 28 { | |
| 29 OwnPtr<CCDrawQuad> drawQuad = newQuad; | |
| 30 if (!drawQuad->quadRect().isEmpty()) { | |
| 31 m_activeQuadList.append(drawQuad.release()); | |
| 32 return true; | |
| 33 } | |
| 34 return false; | |
| 35 } | |
| 36 | 24 |
| 37 virtual CCSharedQuadState* useSharedQuadState(PassOwnPtr<CCSharedQuadState> passSharedQuadState) OVERRIDE | 25 virtual CCSharedQuadState* useSharedQuadState(PassOwnPtr<CCSharedQuadState> passSharedQuadState) OVERRIDE; |
| 38 { | |
| 39 OwnPtr<CCSharedQuadState> sharedQuadState(passSharedQuadState); | |
| 40 sharedQuadState->id = m_activeSharedQuadStateList.size(); | |
| 41 | |
| 42 CCSharedQuadState* rawPtr = sharedQuadState.get(); | |
| 43 m_activeSharedQuadStateList.append(sharedQuadState.release()); | |
| 44 return rawPtr; | |
| 45 } | |
| 46 | 26 |
| 47 const CCQuadList& quadList() const { return m_activeQuadList; }; | 27 const CCQuadList& quadList() const { return m_activeQuadList; }; |
| 48 const CCSharedQuadStateList& sharedQuadStateList() const { return m_activeSh aredQuadStateList; }; | 28 const CCSharedQuadStateList& sharedQuadStateList() const { return m_activeSh aredQuadStateList; }; |
| 49 | 29 |
| 50 private: | 30 private: |
| 51 CCQuadList& m_activeQuadList; | 31 CCQuadList& m_activeQuadList; |
| 52 CCQuadList m_quadListStorage; | 32 CCQuadList m_quadListStorage; |
| 53 CCSharedQuadStateList& m_activeSharedQuadStateList; | 33 CCSharedQuadStateList& m_activeSharedQuadStateList; |
| 54 CCSharedQuadStateList m_sharedQuadStateStorage; | 34 CCSharedQuadStateList m_sharedQuadStateStorage; |
| 55 }; | 35 }; |
| 56 | 36 |
| 57 } // namespace cc | 37 } // namespace cc |
| 58 #endif // MockCCQuadCuller_h | 38 #endif // MockCCQuadCuller_h |
| OLD | NEW |