diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-17 14:11:27 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-17 14:11:27 +0000 |
commit | 9cd20a3f28bdea5e6cb6908b49c0dae80ef9cd30 (patch) | |
tree | 55d75046d64113e05aad6c6d10ff6383adbabc88 /cc/draw_quad.cc | |
parent | 1757b6456de4001bd4bf46ad98cba9420941b5ff (diff) | |
download | chromium_src-9cd20a3f28bdea5e6cb6908b49c0dae80ef9cd30.zip chromium_src-9cd20a3f28bdea5e6cb6908b49c0dae80ef9cd30.tar.gz chromium_src-9cd20a3f28bdea5e6cb6908b49c0dae80ef9cd30.tar.bz2 |
cc: Convert DrawQuad to chromium style.
We leave the methods as methods instead of structifying it in this CL. But the
opaqueRect() helper method on DrawQuad is moved out to the call sites.
DrawQuad::needsBlending() is moved to DrawQuad::ShouldDrawWithBlending()
which combines together various states.
DrawQuad::opaqueRect() is computed in QuadCuller, and is used more cleverly
in ShouldDrawWithBlending().
TBR=aelias
BUG=152337
Review URL: https://chromiumcodereview.appspot.com/11420044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168423 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/draw_quad.cc')
-rw-r--r-- | cc/draw_quad.cc | 89 |
1 files changed, 38 insertions, 51 deletions
diff --git a/cc/draw_quad.cc b/cc/draw_quad.cc index 805561b..495cfb7 100644 --- a/cc/draw_quad.cc +++ b/cc/draw_quad.cc @@ -25,72 +25,59 @@ template<typename T> T* TypedCopy(const cc::DrawQuad* other) { namespace cc { -DrawQuad::DrawQuad(const SharedQuadState* sharedQuadState, Material material, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect) - : m_sharedQuadState(sharedQuadState) - , m_sharedQuadStateId(sharedQuadState->id) - , m_material(material) - , m_quadRect(quadRect) - , m_quadVisibleRect(quadRect) - , m_needsBlending(false) - , m_opaqueRect(opaqueRect) -{ - DCHECK(m_sharedQuadState); - DCHECK(m_material != INVALID); -} - -gfx::Rect DrawQuad::opaqueRect() const -{ - if (opacity() != 1) - return gfx::Rect(); - return m_opaqueRect; +DrawQuad::DrawQuad(const SharedQuadState* shared_quad_state, + Material material, + gfx::Rect rect, + gfx::Rect opaque_rect) + : shared_quad_state_(shared_quad_state), + material_(material), + rect_(rect), + visible_rect_(rect), + needs_blending_(false), + opaque_rect_(opaque_rect) { + DCHECK(shared_quad_state_); + DCHECK(material_ != INVALID); } -void DrawQuad::setQuadVisibleRect(gfx::Rect quadVisibleRect) -{ - m_quadVisibleRect = gfx::IntersectRects(quadVisibleRect, m_quadRect); +DrawQuad::~DrawQuad() { } -scoped_ptr<DrawQuad> DrawQuad::copy(const SharedQuadState* copiedSharedQuadState) const +scoped_ptr<DrawQuad> DrawQuad::Copy( + const SharedQuadState* copied_shared_quad_state) const { - scoped_ptr<DrawQuad> copyQuad; - switch (material()) { + scoped_ptr<DrawQuad> copy_quad; + switch (material()) { case CHECKERBOARD: - copyQuad.reset(TypedCopy<CheckerboardDrawQuad>(this)); - break; + copy_quad.reset(TypedCopy<CheckerboardDrawQuad>(this)); + break; case DEBUG_BORDER: - copyQuad.reset(TypedCopy<DebugBorderDrawQuad>(this)); - break; + copy_quad.reset(TypedCopy<DebugBorderDrawQuad>(this)); + break; case IO_SURFACE_CONTENT: - copyQuad.reset(TypedCopy<IOSurfaceDrawQuad>(this)); - break; + copy_quad.reset(TypedCopy<IOSurfaceDrawQuad>(this)); + break; case TEXTURE_CONTENT: - copyQuad.reset(TypedCopy<TextureDrawQuad>(this)); - break; + copy_quad.reset(TypedCopy<TextureDrawQuad>(this)); + break; case SOLID_COLOR: - copyQuad.reset(TypedCopy<SolidColorDrawQuad>(this)); - break; + copy_quad.reset(TypedCopy<SolidColorDrawQuad>(this)); + break; case TILED_CONTENT: - copyQuad.reset(TypedCopy<TileDrawQuad>(this)); - break; + copy_quad.reset(TypedCopy<TileDrawQuad>(this)); + break; case STREAM_VIDEO_CONTENT: - copyQuad.reset(TypedCopy<StreamVideoDrawQuad>(this)); - break; + copy_quad.reset(TypedCopy<StreamVideoDrawQuad>(this)); + break; case YUV_VIDEO_CONTENT: - copyQuad.reset(TypedCopy<YUVVideoDrawQuad>(this)); - break; + copy_quad.reset(TypedCopy<YUVVideoDrawQuad>(this)); + break; case RENDER_PASS: // RenderPass quads have their own copy() method. case INVALID: - LOG(FATAL) << "Invalid DrawQuad material " << material(); - break; - } - copyQuad->setSharedQuadState(copiedSharedQuadState); - return copyQuad.Pass(); -} - -void DrawQuad::setSharedQuadState(const SharedQuadState* sharedQuadState) -{ - m_sharedQuadState = sharedQuadState; - m_sharedQuadStateId = sharedQuadState->id; + LOG(FATAL) << "Invalid DrawQuad material " << material(); + break; + } + copy_quad->set_shared_quad_state(copied_shared_quad_state); + return copy_quad.Pass(); } } // namespace cc |