| 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 "cc/draw_quad.h" | 5 #include "cc/draw_quad.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "cc/checkerboard_draw_quad.h" | 8 #include "cc/checkerboard_draw_quad.h" |
| 9 #include "cc/debug_border_draw_quad.h" | 9 #include "cc/debug_border_draw_quad.h" |
| 10 #include "cc/io_surface_draw_quad.h" | 10 #include "cc/io_surface_draw_quad.h" |
| 11 #include "cc/render_pass_draw_quad.h" | 11 #include "cc/render_pass_draw_quad.h" |
| 12 #include "cc/solid_color_draw_quad.h" | 12 #include "cc/solid_color_draw_quad.h" |
| 13 #include "cc/stream_video_draw_quad.h" | 13 #include "cc/stream_video_draw_quad.h" |
| 14 #include "cc/texture_draw_quad.h" | 14 #include "cc/texture_draw_quad.h" |
| 15 #include "cc/tile_draw_quad.h" | 15 #include "cc/tile_draw_quad.h" |
| 16 #include "cc/yuv_video_draw_quad.h" | 16 #include "cc/yuv_video_draw_quad.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 template<typename T> T* TypedCopy(const cc::DrawQuad* other) { | 20 template<typename T> T* TypedCopy(const cc::DrawQuad* other) { |
| 21 return new T(*T::materialCast(other)); | 21 return new T(*T::materialCast(other)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace cc { | 26 namespace cc { |
| 27 | 27 |
| 28 DrawQuad::DrawQuad(const SharedQuadState* sharedQuadState, Material material, co
nst gfx::Rect& quadRect) | 28 DrawQuad::DrawQuad(const SharedQuadState* sharedQuadState, Material material, co
nst gfx::Rect& quadRect, const gfx::Rect& opaqueRect) |
| 29 : m_sharedQuadState(sharedQuadState) | 29 : m_sharedQuadState(sharedQuadState) |
| 30 , m_sharedQuadStateId(sharedQuadState->id) | 30 , m_sharedQuadStateId(sharedQuadState->id) |
| 31 , m_material(material) | 31 , m_material(material) |
| 32 , m_quadRect(quadRect) | 32 , m_quadRect(quadRect) |
| 33 , m_quadVisibleRect(quadRect) | 33 , m_quadVisibleRect(quadRect) |
| 34 , m_quadOpaque(true) | |
| 35 , m_needsBlending(false) | 34 , m_needsBlending(false) |
| 35 , m_opaqueRect(opaqueRect) |
| 36 { | 36 { |
| 37 DCHECK(m_sharedQuadState); | 37 DCHECK(m_sharedQuadState); |
| 38 DCHECK(m_material != INVALID); | 38 DCHECK(m_material != INVALID); |
| 39 } | 39 } |
| 40 | 40 |
| 41 gfx::Rect DrawQuad::opaqueRect() const | 41 gfx::Rect DrawQuad::opaqueRect() const |
| 42 { | 42 { |
| 43 if (opacity() != 1) | 43 if (opacity() != 1) |
| 44 return gfx::Rect(); | 44 return gfx::Rect(); |
| 45 if (m_sharedQuadState->opaque && m_quadOpaque) | |
| 46 return m_quadRect; | |
| 47 return m_opaqueRect; | 45 return m_opaqueRect; |
| 48 } | 46 } |
| 49 | 47 |
| 50 void DrawQuad::setQuadVisibleRect(gfx::Rect quadVisibleRect) | 48 void DrawQuad::setQuadVisibleRect(gfx::Rect quadVisibleRect) |
| 51 { | 49 { |
| 52 m_quadVisibleRect = gfx::IntersectRects(quadVisibleRect, m_quadRect); | 50 m_quadVisibleRect = gfx::IntersectRects(quadVisibleRect, m_quadRect); |
| 53 } | 51 } |
| 54 | 52 |
| 55 scoped_ptr<DrawQuad> DrawQuad::copy(const SharedQuadState* copiedSharedQuadState
) const | 53 scoped_ptr<DrawQuad> DrawQuad::copy(const SharedQuadState* copiedSharedQuadState
) const |
| 56 { | 54 { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 return copyQuad.Pass(); | 87 return copyQuad.Pass(); |
| 90 } | 88 } |
| 91 | 89 |
| 92 void DrawQuad::setSharedQuadState(const SharedQuadState* sharedQuadState) | 90 void DrawQuad::setSharedQuadState(const SharedQuadState* sharedQuadState) |
| 93 { | 91 { |
| 94 m_sharedQuadState = sharedQuadState; | 92 m_sharedQuadState = sharedQuadState; |
| 95 m_sharedQuadStateId = sharedQuadState->id; | 93 m_sharedQuadStateId = sharedQuadState->id; |
| 96 } | 94 } |
| 97 | 95 |
| 98 } // namespace cc | 96 } // namespace cc |
| OLD | NEW |