| 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "CCDrawQuad.h" | 6 #include "CCDrawQuad.h" |
| 7 | 7 |
| 8 #include "base/logging.h" |
| 8 #include "CCCheckerboardDrawQuad.h" | 9 #include "CCCheckerboardDrawQuad.h" |
| 9 #include "CCDebugBorderDrawQuad.h" | 10 #include "CCDebugBorderDrawQuad.h" |
| 10 #include "CCIOSurfaceDrawQuad.h" | 11 #include "CCIOSurfaceDrawQuad.h" |
| 11 #include "CCRenderPassDrawQuad.h" | 12 #include "CCRenderPassDrawQuad.h" |
| 12 #include "CCSolidColorDrawQuad.h" | 13 #include "CCSolidColorDrawQuad.h" |
| 13 #include "CCStreamVideoDrawQuad.h" | 14 #include "CCStreamVideoDrawQuad.h" |
| 14 #include "CCTextureDrawQuad.h" | 15 #include "CCTextureDrawQuad.h" |
| 15 #include "CCTileDrawQuad.h" | 16 #include "CCTileDrawQuad.h" |
| 16 #include "CCYUVVideoDrawQuad.h" | 17 #include "CCYUVVideoDrawQuad.h" |
| 17 #include "IntRect.h" | 18 #include "IntRect.h" |
| 18 | 19 |
| 19 namespace cc { | 20 namespace cc { |
| 20 | 21 |
| 21 CCDrawQuad::CCDrawQuad(const CCSharedQuadState* sharedQuadState, Material materi
al, const IntRect& quadRect) | 22 CCDrawQuad::CCDrawQuad(const CCSharedQuadState* sharedQuadState, Material materi
al, const IntRect& quadRect) |
| 22 : m_sharedQuadState(sharedQuadState) | 23 : m_sharedQuadState(sharedQuadState) |
| 23 , m_sharedQuadStateId(sharedQuadState->id) | 24 , m_sharedQuadStateId(sharedQuadState->id) |
| 24 , m_material(material) | 25 , m_material(material) |
| 25 , m_quadRect(quadRect) | 26 , m_quadRect(quadRect) |
| 26 , m_quadVisibleRect(quadRect) | 27 , m_quadVisibleRect(quadRect) |
| 27 , m_quadOpaque(true) | 28 , m_quadOpaque(true) |
| 28 , m_needsBlending(false) | 29 , m_needsBlending(false) |
| 29 { | 30 { |
| 30 ASSERT(m_sharedQuadState); | 31 DCHECK(m_sharedQuadState); |
| 31 ASSERT(m_material != Invalid); | 32 DCHECK(m_material != Invalid); |
| 32 } | 33 } |
| 33 | 34 |
| 34 IntRect CCDrawQuad::opaqueRect() const | 35 IntRect CCDrawQuad::opaqueRect() const |
| 35 { | 36 { |
| 36 if (opacity() != 1) | 37 if (opacity() != 1) |
| 37 return IntRect(); | 38 return IntRect(); |
| 38 if (m_sharedQuadState->opaque && m_quadOpaque) | 39 if (m_sharedQuadState->opaque && m_quadOpaque) |
| 39 return m_quadRect; | 40 return m_quadRect; |
| 40 return m_opaqueRect; | 41 return m_opaqueRect; |
| 41 } | 42 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 72 break; | 73 break; |
| 73 } | 74 } |
| 74 | 75 |
| 75 CRASH(); | 76 CRASH(); |
| 76 return sizeof(CCDrawQuad); | 77 return sizeof(CCDrawQuad); |
| 77 } | 78 } |
| 78 | 79 |
| 79 scoped_ptr<CCDrawQuad> CCDrawQuad::copy(const CCSharedQuadState* copiedSharedQua
dState) const | 80 scoped_ptr<CCDrawQuad> CCDrawQuad::copy(const CCSharedQuadState* copiedSharedQua
dState) const |
| 80 { | 81 { |
| 81 // RenderPass quads have their own copy() method. | 82 // RenderPass quads have their own copy() method. |
| 82 ASSERT(material() != RenderPass); | 83 DCHECK(material() != RenderPass); |
| 83 | 84 |
| 84 unsigned bytes = size(); | 85 unsigned bytes = size(); |
| 85 ASSERT(bytes); | 86 DCHECK(bytes > 0); |
| 86 | 87 |
| 87 scoped_ptr<CCDrawQuad> copyQuad(reinterpret_cast<CCDrawQuad*>(new char[bytes
])); | 88 scoped_ptr<CCDrawQuad> copyQuad(reinterpret_cast<CCDrawQuad*>(new char[bytes
])); |
| 88 memcpy(copyQuad.get(), this, bytes); | 89 memcpy(copyQuad.get(), this, bytes); |
| 89 copyQuad->setSharedQuadState(copiedSharedQuadState); | 90 copyQuad->setSharedQuadState(copiedSharedQuadState); |
| 90 | 91 |
| 91 return copyQuad.Pass(); | 92 return copyQuad.Pass(); |
| 92 } | 93 } |
| 93 | 94 |
| 94 void CCDrawQuad::setSharedQuadState(const CCSharedQuadState* sharedQuadState) | 95 void CCDrawQuad::setSharedQuadState(const CCSharedQuadState* sharedQuadState) |
| 95 { | 96 { |
| 96 m_sharedQuadState = sharedQuadState; | 97 m_sharedQuadState = sharedQuadState; |
| 97 m_sharedQuadStateId = sharedQuadState->id; | 98 m_sharedQuadStateId = sharedQuadState->id; |
| 98 } | 99 } |
| 99 | 100 |
| 100 } | 101 } |
| OLD | NEW |