summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc')
-rw-r--r--cc/checkerboard_draw_quad.cc2
-rw-r--r--cc/debug_border_draw_quad.cc2
-rw-r--r--cc/delegated_renderer_layer_impl.cc6
-rw-r--r--cc/delegated_renderer_layer_impl_unittest.cc30
-rw-r--r--cc/draw_quad.cc89
-rw-r--r--cc/draw_quad.h147
-rw-r--r--cc/draw_quad_unittest.cc32
-rw-r--r--cc/gl_renderer.cc50
-rw-r--r--cc/layer_tree_host_impl.cc8
-rw-r--r--cc/layer_tree_host_impl_unittest.cc34
-rw-r--r--cc/nine_patch_layer_impl_unittest.cc6
-rw-r--r--cc/quad_culler.cc18
-rw-r--r--cc/quad_culler_unittest.cc8
-rw-r--r--cc/render_pass_draw_quad.cc2
-rw-r--r--cc/software_renderer.cc7
-rw-r--r--cc/solid_color_draw_quad.cc2
-rw-r--r--cc/solid_color_layer_impl_unittest.cc6
-rw-r--r--cc/test/layer_test_common.cc2
-rw-r--r--cc/test/mock_quad_culler.cc2
-rw-r--r--cc/texture_draw_quad.cc5
-rw-r--r--cc/texture_draw_quad.h2
-rw-r--r--cc/tile_draw_quad.cc2
-rw-r--r--cc/tiled_layer_impl_unittest.cc21
-rw-r--r--cc/yuv_video_draw_quad.h2
24 files changed, 239 insertions, 246 deletions
diff --git a/cc/checkerboard_draw_quad.cc b/cc/checkerboard_draw_quad.cc
index c8e3021..709bade 100644
--- a/cc/checkerboard_draw_quad.cc
+++ b/cc/checkerboard_draw_quad.cc
@@ -18,7 +18,7 @@ CheckerboardDrawQuad::CheckerboardDrawQuad(const SharedQuadState* sharedQuadStat
, m_color(color)
{
if (SkColorGetA(m_color) < 255)
- m_opaqueRect = gfx::Rect();
+ opaque_rect_ = gfx::Rect();
}
const CheckerboardDrawQuad* CheckerboardDrawQuad::materialCast(const DrawQuad* quad)
diff --git a/cc/debug_border_draw_quad.cc b/cc/debug_border_draw_quad.cc
index 576ddb1..6d95818 100644
--- a/cc/debug_border_draw_quad.cc
+++ b/cc/debug_border_draw_quad.cc
@@ -19,7 +19,7 @@ DebugBorderDrawQuad::DebugBorderDrawQuad(const SharedQuadState* sharedQuadState,
, m_width(width)
{
if (SkColorGetA(m_color) < 255)
- m_needsBlending = true;
+ needs_blending_ = true;
}
const DebugBorderDrawQuad* DebugBorderDrawQuad::materialCast(const DrawQuad* quad)
diff --git a/cc/delegated_renderer_layer_impl.cc b/cc/delegated_renderer_layer_impl.cc
index f8c601d..6d63961 100644
--- a/cc/delegated_renderer_layer_impl.cc
+++ b/cc/delegated_renderer_layer_impl.cc
@@ -142,8 +142,8 @@ void DelegatedRendererLayerImpl::appendRenderPassQuads(QuadSink& quadSink, Appen
for (size_t i = 0; i < delegatedRenderPass->quadList().size(); ++i) {
DrawQuad* quad = delegatedRenderPass->quadList()[i];
- if (quad->sharedQuadState() != currentSharedQuadState) {
- currentSharedQuadState = quad->sharedQuadState();
+ if (quad->shared_quad_state() != currentSharedQuadState) {
+ currentSharedQuadState = quad->shared_quad_state();
copiedSharedQuadState = quadSink.useSharedQuadState(currentSharedQuadState->copy());
bool targetIsFromDelegatedRendererLayer = appendQuadsData.renderPassId.layerId == id();
if (!targetIsFromDelegatedRendererLayer) {
@@ -161,7 +161,7 @@ void DelegatedRendererLayerImpl::appendRenderPassQuads(QuadSink& quadSink, Appen
scoped_ptr<DrawQuad> copyQuad;
if (quad->material() != DrawQuad::RENDER_PASS)
- copyQuad = quad->copy(copiedSharedQuadState);
+ copyQuad = quad->Copy(copiedSharedQuadState);
else {
RenderPass::Id contributingDelegatedRenderPassId = RenderPassDrawQuad::materialCast(quad)->renderPassId();
RenderPass::Id contributingRenderPassId = convertDelegatedRenderPassId(contributingDelegatedRenderPassId);
diff --git a/cc/delegated_renderer_layer_impl_unittest.cc b/cc/delegated_renderer_layer_impl_unittest.cc
index 8dcbab87..f580cee 100644
--- a/cc/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/delegated_renderer_layer_impl_unittest.cc
@@ -209,14 +209,14 @@ TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToContributingRenderPasses
// The DelegatedRendererLayer should have added copies of its quads to contributing RenderPasses.
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
- EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->rect());
// Verify it added the right quads.
ASSERT_EQ(2u, frame.renderPasses[2]->quadList().size());
- EXPECT_RECT_EQ(gfx::Rect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->quadRect());
- EXPECT_RECT_EQ(gfx::Rect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->rect());
+ EXPECT_RECT_EQ(gfx::Rect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->rect());
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
- EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->rect());
}
TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass)
@@ -237,10 +237,10 @@ TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass)
ASSERT_EQ(2u, frame.renderPasses[3]->quadList().size());
// Verify it added the right quads.
- EXPECT_RECT_EQ(gfx::Rect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->rect());
// Its target layer should have a quad as well.
- EXPECT_RECT_EQ(gfx::Rect(0, 0, 15, 15), frame.renderPasses[3]->quadList()[1]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 15, 15), frame.renderPasses[3]->quadList()[1]->rect());
}
TEST_F(DelegatedRendererLayerImplTestSimple, QuadsFromRootRenderPassAreModifiedForTheTarget)
@@ -325,14 +325,14 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToContributingRenderPa
// The DelegatedRendererLayer should have added copies of its quads to contributing RenderPasses.
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
- EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->rect());
// Verify it added the right quads.
ASSERT_EQ(2u, frame.renderPasses[2]->quadList().size());
- EXPECT_RECT_EQ(gfx::Rect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->quadRect());
- EXPECT_RECT_EQ(gfx::Rect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->rect());
+ EXPECT_RECT_EQ(gfx::Rect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->rect());
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
- EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->rect());
}
TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass)
@@ -353,7 +353,7 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass)
ASSERT_EQ(1u, frame.renderPasses[3]->quadList().size());
// Verify it added the right quads.
- EXPECT_RECT_EQ(gfx::Rect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->rect());
}
TEST_F(DelegatedRendererLayerImplTestOwnSurface, QuadsFromRootRenderPassAreNotModifiedForTheTarget)
@@ -440,10 +440,10 @@ TEST_F(DelegatedRendererLayerImplTestSharedData, SharedData)
ASSERT_EQ(4u, quadList.size());
// All quads should share the same state.
- const SharedQuadState* sharedState = quadList[0]->sharedQuadState();
- EXPECT_EQ(sharedState, quadList[1]->sharedQuadState());
- EXPECT_EQ(sharedState, quadList[2]->sharedQuadState());
- EXPECT_EQ(sharedState, quadList[3]->sharedQuadState());
+ const SharedQuadState* sharedState = quadList[0]->shared_quad_state();
+ EXPECT_EQ(sharedState, quadList[1]->shared_quad_state());
+ EXPECT_EQ(sharedState, quadList[2]->shared_quad_state());
+ EXPECT_EQ(sharedState, quadList[3]->shared_quad_state());
// The state should be transformed only once.
EXPECT_RECT_EQ(gfx::Rect(30, 30, 50, 50), sharedState->clippedRectInTarget);
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
diff --git a/cc/draw_quad.h b/cc/draw_quad.h
index b6481d8..898bde8 100644
--- a/cc/draw_quad.h
+++ b/cc/draw_quad.h
@@ -15,64 +15,95 @@ namespace cc {
// from DrawQuad store additional data in their derived instance. The Material
// enum is used to "safely" downcast to the derived class.
class CC_EXPORT DrawQuad {
-public:
- enum Material {
- INVALID,
- CHECKERBOARD,
- DEBUG_BORDER,
- IO_SURFACE_CONTENT,
- RENDER_PASS,
- TEXTURE_CONTENT,
- SOLID_COLOR,
- TILED_CONTENT,
- YUV_VIDEO_CONTENT,
- STREAM_VIDEO_CONTENT,
- };
-
- gfx::Rect quadRect() const { return m_quadRect; }
- const WebKit::WebTransformationMatrix& quadTransform() const { return m_sharedQuadState->quadTransform; }
- gfx::Rect visibleContentRect() const { return m_sharedQuadState->visibleContentRect; }
- gfx::Rect clippedRectInTarget() const { return m_sharedQuadState->clippedRectInTarget; }
- float opacity() const { return m_sharedQuadState->opacity; }
- // For the purposes of blending, what part of the contents of this quad are opaque?
- gfx::Rect opaqueRect() const;
- bool needsBlending() const { return m_needsBlending || !opaqueRect().Contains(m_quadVisibleRect); }
-
- // Allows changing the rect that gets drawn to make it smaller. Parameter passed
- // in will be clipped to quadRect().
- void setQuadVisibleRect(gfx::Rect);
- gfx::Rect quadVisibleRect() const { return m_quadVisibleRect; }
- bool isDebugQuad() const { return m_material == DEBUG_BORDER; }
-
- Material material() const { return m_material; }
-
- scoped_ptr<DrawQuad> copy(const SharedQuadState* copiedSharedQuadState) const;
-
- const SharedQuadState* sharedQuadState() const { return m_sharedQuadState; }
- int sharedQuadStateId() const { return m_sharedQuadStateId; }
- void setSharedQuadState(const SharedQuadState*);
-
-protected:
- DrawQuad(const SharedQuadState*, Material, const gfx::Rect&, const gfx::Rect& opaqueRect);
-
- // Stores state common to a large bundle of quads; kept separate for memory
- // efficiency. There is special treatment to reconstruct these pointers
- // during serialization.
- const SharedQuadState* m_sharedQuadState;
- int m_sharedQuadStateId;
-
- Material m_material;
- gfx::Rect m_quadRect;
- gfx::Rect m_quadVisibleRect;
-
- // By default blending is used when some part of the quad is not opaque. With
- // this setting, it is possible to force blending on regardless of the opaque
- // area.
- bool m_needsBlending;
-
- // Be default, this rect is empty. It is used when the shared quad state and above
- // variables determine that the quad is not fully opaque but may be partially opaque.
- gfx::Rect m_opaqueRect;
+ public:
+ enum Material {
+ INVALID,
+ CHECKERBOARD,
+ DEBUG_BORDER,
+ IO_SURFACE_CONTENT,
+ RENDER_PASS,
+ TEXTURE_CONTENT,
+ SOLID_COLOR,
+ TILED_CONTENT,
+ YUV_VIDEO_CONTENT,
+ STREAM_VIDEO_CONTENT,
+ };
+
+ virtual ~DrawQuad();
+
+ scoped_ptr<DrawQuad> Copy(
+ const SharedQuadState* copied_shared_quad_state) const;
+
+ // TODO(danakj): Chromify or remove these SharedQuadState helpers.
+ const WebKit::WebTransformationMatrix& quadTransform() const { return shared_quad_state_->quadTransform; }
+ gfx::Rect visibleContentRect() const { return shared_quad_state_->visibleContentRect; }
+ gfx::Rect clippedRectInTarget() const { return shared_quad_state_->clippedRectInTarget; }
+ float opacity() const { return shared_quad_state_->opacity; }
+
+ Material material() const { return material_; }
+
+ // This rect, after applying the quad_transform(), gives the geometry that
+ // this quad should draw to.
+ gfx::Rect rect() const { return rect_; }
+
+ // This specifies the region of the quad that is opaque.
+ gfx::Rect opaque_rect() const { return opaque_rect_; }
+
+ // Allows changing the rect that gets drawn to make it smaller. This value
+ // should be clipped to quadRect.
+ gfx::Rect visible_rect() const { return visible_rect_; }
+
+ // Allows changing the rect that gets drawn to make it smaller. Parameter
+ // passed in will be clipped to quadRect().
+ void set_visible_rect(gfx::Rect rect) { visible_rect_ = rect; }
+
+ // By default blending is used when some part of the quad is not opaque.
+ // With this setting, it is possible to force blending on regardless of the
+ // opaque area.
+ bool needs_blending() const { return needs_blending_; }
+
+ // Stores state common to a large bundle of quads; kept separate for memory
+ // efficiency. There is special treatment to reconstruct these pointers
+ // during serialization.
+ const SharedQuadState* shared_quad_state() const {
+ return shared_quad_state_;
+ }
+
+ // Allows changing the rect that gets drawn to make it smaller. Parameter
+ // passed in will be clipped to quadRect().
+ void set_shared_quad_state(const SharedQuadState* shared_quad_state) {
+ shared_quad_state_ = shared_quad_state;
+ }
+
+ bool IsDebugQuad() const { return material_ == DEBUG_BORDER; }
+ bool ShouldDrawWithBlending() const {
+ return needs_blending_ || opacity() < 1.0f ||
+ !opaque_rect_.Contains(visible_rect_);
+ }
+
+ protected:
+ DrawQuad(const SharedQuadState* shared_quad_state,
+ Material material,
+ gfx::Rect rect,
+ gfx::Rect opaque_rect);
+
+ // Stores state common to a large bundle of quads; kept separate for memory
+ // efficiency. There is special treatment to reconstruct these pointers
+ // during serialization.
+ const SharedQuadState* shared_quad_state_;
+
+ Material material_;
+ gfx::Rect rect_;
+ gfx::Rect visible_rect_;
+
+ // By default blending is used when some part of the quad is not opaque. With
+ // this setting, it is possible to force blending on regardless of the opaque
+ // area.
+ bool needs_blending_;
+
+ // Be default, this rect is empty. It is used when the shared quad state and above
+ // variables determine that the quad is not fully opaque but may be partially opaque.
+ gfx::Rect opaque_rect_;
};
}
diff --git a/cc/draw_quad_unittest.cc b/cc/draw_quad_unittest.cc
index e083905..7b4093e 100644
--- a/cc/draw_quad_unittest.cc
+++ b/cc/draw_quad_unittest.cc
@@ -57,17 +57,11 @@ scoped_ptr<SharedQuadState> createSharedQuadState()
void compareDrawQuad(DrawQuad* quad, DrawQuad* copy, SharedQuadState* copySharedState)
{
EXPECT_EQ(quad->material(), copy->material());
- EXPECT_EQ(quad->isDebugQuad(), copy->isDebugQuad());
- EXPECT_RECT_EQ(quad->quadRect(), copy->quadRect());
- EXPECT_RECT_EQ(quad->quadVisibleRect(), copy->quadVisibleRect());
- EXPECT_EQ(quad->opaqueRect(), copy->opaqueRect());
- EXPECT_EQ(quad->needsBlending(), copy->needsBlending());
-
- EXPECT_EQ(copySharedState, copy->sharedQuadState());
- EXPECT_EQ(copySharedState->id, copy->sharedQuadStateId());
-
- EXPECT_EQ(quad->sharedQuadStateId(), quad->sharedQuadState()->id);
- EXPECT_EQ(copy->sharedQuadStateId(), copy->sharedQuadState()->id);
+ EXPECT_RECT_EQ(quad->rect(), copy->rect());
+ EXPECT_RECT_EQ(quad->visible_rect(), copy->visible_rect());
+ EXPECT_RECT_EQ(quad->opaque_rect(), copy->opaque_rect());
+ EXPECT_EQ(quad->needs_blending(), copy->needs_blending());
+ EXPECT_EQ(copySharedState, copy->shared_quad_state());
}
#define CREATE_SHARED_STATE() \
@@ -80,13 +74,13 @@ void compareDrawQuad(DrawQuad* quad, DrawQuad* copy, SharedQuadState* copyShared
gfx::Rect quadVisibleRect(40, 50, 30, 20);
#define SETUP_AND_COPY_QUAD(Type, quad) \
- quad->setQuadVisibleRect(quadVisibleRect); \
- scoped_ptr<DrawQuad> copy(quad->copy(copySharedState.get())); \
+ quad->set_visible_rect(quadVisibleRect); \
+ scoped_ptr<DrawQuad> copy(quad->Copy(copySharedState.get())); \
compareDrawQuad(quad.get(), copy.get(), copySharedState.get()); \
const Type* copyQuad = Type::materialCast(copy.get());
#define SETUP_AND_COPY_QUAD_1(Type, quad, a) \
- quad->setQuadVisibleRect(quadVisibleRect); \
+ quad->set_visible_rect(quadVisibleRect); \
scoped_ptr<DrawQuad> copy(quad->copy(copySharedState.get(), a)); \
compareDrawQuad(quad.get(), copy.get(), copySharedState.get()); \
const Type* copyQuad = Type::materialCast(copy.get());
@@ -174,7 +168,7 @@ TEST(DrawQuadTest, copyIOSurfaceDrawQuad)
CREATE_SHARED_STATE();
CREATE_QUAD_4(IOSurfaceDrawQuad, opaqueRect, size, textureId, orientation);
- EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect());
+ EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect());
EXPECT_EQ(size, copyQuad->ioSurfaceSize());
EXPECT_EQ(textureId, copyQuad->ioSurfaceTextureId());
EXPECT_EQ(orientation, copyQuad->orientation());
@@ -222,7 +216,7 @@ TEST(DrawQuadTest, copyStreamVideoDrawQuad)
CREATE_SHARED_STATE();
CREATE_QUAD_3(StreamVideoDrawQuad, opaqueRect, textureId, matrix);
- EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect());
+ EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect());
EXPECT_EQ(textureId, copyQuad->textureId());
EXPECT_EQ(matrix, copyQuad->matrix());
}
@@ -237,7 +231,7 @@ TEST(DrawQuadTest, copyTextureDrawQuad)
CREATE_SHARED_STATE();
CREATE_QUAD_5(TextureDrawQuad, opaqueRect, resourceId, premultipliedAlpha, uvRect, flipped);
- EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect());
+ EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect());
EXPECT_EQ(resourceId, copyQuad->resourceId());
EXPECT_EQ(premultipliedAlpha, copyQuad->premultipliedAlpha());
EXPECT_FLOAT_RECT_EQ(uvRect, copyQuad->uvRect());
@@ -258,7 +252,7 @@ TEST(DrawQuadTest, copyTileDrawQuad)
CREATE_SHARED_STATE();
CREATE_QUAD_9(TileDrawQuad, opaqueRect, resourceId, textureOffset, textureSize, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA);
- EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect());
+ EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect());
EXPECT_EQ(resourceId, copyQuad->resourceId());
EXPECT_EQ(textureOffset, copyQuad->textureOffset());
EXPECT_EQ(textureSize, copyQuad->textureSize());
@@ -288,7 +282,7 @@ TEST(DrawQuadTest, copyYUVVideoDrawQuad)
CREATE_SHARED_STATE();
CREATE_QUAD_5(YUVVideoDrawQuad, opaqueRect, texScale, yPlane, uPlane, vPlane);
- EXPECT_RECT_EQ(opaqueRect, copyQuad->opaqueRect());
+ EXPECT_RECT_EQ(opaqueRect, copyQuad->opaque_rect());
EXPECT_EQ(texScale, copyQuad->texScale());
EXPECT_EQ(yPlane.resourceId, copyQuad->yPlane().resourceId);
EXPECT_EQ(yPlane.size, copyQuad->yPlane().size);
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc
index 895e5db..44a135b 100644
--- a/cc/gl_renderer.cc
+++ b/cc/gl_renderer.cc
@@ -250,7 +250,9 @@ void GLRenderer::doNoOp()
void GLRenderer::drawQuad(DrawingFrame& frame, const DrawQuad* quad)
{
- if (quad->needsBlending())
+ DCHECK(quad->rect().Contains(quad->visible_rect()));
+
+ if (quad->ShouldDrawWithBlending())
GLC(m_context, m_context->enable(GL_BLEND));
else
GLC(m_context, m_context->disable(GL_BLEND));
@@ -301,7 +303,7 @@ void GLRenderer::drawCheckerboardQuad(const DrawingFrame& frame, const Checkerbo
const int checkerboardWidth = 16;
float frequency = 1.0 / checkerboardWidth;
- gfx::Rect tileRect = quad->quadRect();
+ gfx::Rect tileRect = quad->rect();
float texOffsetX = tileRect.x() % checkerboardWidth;
float texOffsetY = tileRect.y() % checkerboardWidth;
float texScaleX = tileRect.width();
@@ -311,7 +313,7 @@ void GLRenderer::drawCheckerboardQuad(const DrawingFrame& frame, const Checkerbo
GLC(context(), context()->uniform1f(program->fragmentShader().frequencyLocation(), frequency));
setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation());
- drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation());
+ drawQuadGeometry(frame, quad->quadTransform(), quad->rect(), program->vertexShader().matrixLocation());
}
void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorderDrawQuad* quad)
@@ -322,7 +324,7 @@ void GLRenderer::drawDebugBorderQuad(const DrawingFrame& frame, const DebugBorde
GLC(context(), context()->useProgram(program->program()));
// Use the full quadRect for debug quads to not move the edges based on partial swaps.
- const gfx::Rect& layerRect = quad->quadRect();
+ const gfx::Rect& layerRect = quad->rect();
WebTransformationMatrix renderMatrix = quad->quadTransform();
renderMatrix.translate(0.5 * layerRect.width() + layerRect.x(), 0.5 * layerRect.height() + layerRect.y());
renderMatrix.scaleNonUniform(layerRect.width(), layerRect.height());
@@ -478,17 +480,17 @@ scoped_ptr<ScopedResource> GLRenderer::drawBackgroundFilters(
int filteredDeviceBackgroundTextureId = texture->getTextureHandle();
scoped_ptr<ScopedResource> backgroundTexture = ScopedResource::create(m_resourceProvider);
- if (!backgroundTexture->Allocate(Renderer::ImplPool, quad->quadRect().size(), GL_RGBA, ResourceProvider::TextureUsageFramebuffer))
+ if (!backgroundTexture->Allocate(Renderer::ImplPool, quad->rect().size(), GL_RGBA, ResourceProvider::TextureUsageFramebuffer))
return scoped_ptr<ScopedResource>();
const RenderPass* targetRenderPass = frame.currentRenderPass;
- bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(), quad->quadRect());
+ bool usingBackgroundTexture = useScopedTexture(frame, backgroundTexture.get(), quad->rect());
if (usingBackgroundTexture) {
// Copy the readback pixels from device to the background texture for the surface.
WebTransformationMatrix deviceToFramebufferTransform;
- deviceToFramebufferTransform.translate(quad->quadRect().width() / 2.0, quad->quadRect().height() / 2.0);
- deviceToFramebufferTransform.scale3d(quad->quadRect().width(), quad->quadRect().height(), 1);
+ deviceToFramebufferTransform.translate(quad->rect().width() / 2.0, quad->rect().height() / 2.0);
+ deviceToFramebufferTransform.scale3d(quad->rect().width(), quad->rect().height(), 1);
deviceToFramebufferTransform.multiply(contentsDeviceTransformInverse);
copyTextureToFramebuffer(frame, filteredDeviceBackgroundTextureId, deviceRect, deviceToFramebufferTransform);
}
@@ -512,7 +514,7 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
return;
WebTransformationMatrix quadRectMatrix;
- quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->quadRect());
+ quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect());
WebTransformationMatrix contentsDeviceTransform = (frame.windowMatrix * frame.projectionMatrix * quadRectMatrix).to2dTransform();
// Can only draw surface if device matrix is invertible.
@@ -544,9 +546,9 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
// Draw the background texture if there is one.
if (backgroundTexture) {
- DCHECK(backgroundTexture->size() == quad->quadRect().size());
+ DCHECK(backgroundTexture->size() == quad->rect().size());
ResourceProvider::ScopedReadLockGL lock(m_resourceProvider, backgroundTexture->id());
- copyTextureToFramebuffer(frame, lock.textureId(), quad->quadRect(), quad->quadTransform());
+ copyTextureToFramebuffer(frame, lock.textureId(), quad->rect(), quad->quadTransform());
}
bool clipped = false;
@@ -644,7 +646,7 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
setShaderOpacity(quad->opacity(), shaderAlphaLocation);
setShaderQuadF(surfaceQuad, shaderQuadLocation);
- drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), shaderMatrixLocation);
+ drawQuadGeometry(frame, quad->quadTransform(), quad->rect(), shaderMatrixLocation);
// Flush the compositor context before the filter bitmap goes out of
// scope, so the draw gets processed before the filter texture gets deleted.
@@ -663,7 +665,7 @@ void GLRenderer::drawSolidColorQuad(const DrawingFrame& frame, const SolidColorD
GLC(context(), context()->uniform4f(program->fragmentShader().colorLocation(), (SkColorGetR(color) / 255.0) * alpha, (SkColorGetG(color) / 255.0) * alpha, (SkColorGetB(color) / 255.0) * alpha, alpha));
- drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation());
+ drawQuadGeometry(frame, quad->quadTransform(), quad->rect(), program->vertexShader().matrixLocation());
}
struct TileProgramUniforms {
@@ -693,7 +695,7 @@ static void tileUniformLocation(T program, TileProgramUniforms& uniforms)
void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* quad)
{
- gfx::Rect tileRect = quad->quadVisibleRect();
+ gfx::Rect tileRect = quad->visible_rect();
gfx::RectF clampRect(tileRect);
// Clamp texture coordinates to avoid sampling outside the layer
@@ -707,7 +709,7 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
float clampY = min(0.5, clampRect.height() / 2.0 - epsilon);
clampRect.Inset(clampX, clampY, clampX, clampY);
- gfx::Vector2dF textureOffset = quad->textureOffset() + clampRect.OffsetFromOrigin() - quad->quadRect().OffsetFromOrigin();
+ gfx::Vector2dF textureOffset = quad->textureOffset() + (clampRect.origin() - quad->rect().origin());
// Map clamping rectangle to unit square.
float vertexTexTranslateX = -clampRect.x() / clampRect.width();
@@ -741,7 +743,7 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
else
tileUniformLocation(tileProgramAA(), uniforms);
} else {
- if (quad->needsBlending()) {
+ if (quad->ShouldDrawWithBlending()) {
if (quad->swizzleContents())
tileUniformLocation(tileProgramSwizzle(), uniforms);
else
@@ -796,13 +798,13 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
LayerQuad::Edge rightEdge(topRight, bottomRight);
// Only apply anti-aliasing to edges not clipped by culling or scissoring.
- if (quad->topEdgeAA() && tileRect.y() == quad->quadRect().y())
+ if (quad->topEdgeAA() && tileRect.y() == quad->rect().y())
topEdge = deviceLayerEdges.top();
- if (quad->leftEdgeAA() && tileRect.x() == quad->quadRect().x())
+ if (quad->leftEdgeAA() && tileRect.x() == quad->rect().x())
leftEdge = deviceLayerEdges.left();
- if (quad->rightEdgeAA() && tileRect.right() == quad->quadRect().right())
+ if (quad->rightEdgeAA() && tileRect.right() == quad->rect().right())
rightEdge = deviceLayerEdges.right();
- if (quad->bottomEdgeAA() && tileRect.bottom() == quad->quadRect().bottom())
+ if (quad->bottomEdgeAA() && tileRect.bottom() == quad->rect().bottom())
bottomEdge = deviceLayerEdges.bottom();
float sign = gfx::QuadF(tileRect).IsCounterClockwise() ? -1 : 1;
@@ -901,7 +903,7 @@ void GLRenderer::drawYUVVideoQuad(const DrawingFrame& frame, const YUVVideoDrawQ
GLC(context(), context()->uniform3fv(program->fragmentShader().yuvAdjLocation(), 1, yuvAdjust));
setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation());
- drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation());
+ drawQuadGeometry(frame, quad->quadTransform(), quad->rect(), program->vertexShader().matrixLocation());
// Reset active texture back to texture 0.
GLC(context(), context()->activeTexture(GL_TEXTURE0));
@@ -924,7 +926,7 @@ void GLRenderer::drawStreamVideoQuad(const DrawingFrame& frame, const StreamVide
GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0));
setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation());
- drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), program->vertexShader().matrixLocation());
+ drawQuadGeometry(frame, quad->quadTransform(), quad->rect(), program->vertexShader().matrixLocation());
}
struct TextureProgramBinding {
@@ -979,7 +981,7 @@ void GLRenderer::drawTextureQuad(const DrawingFrame& frame, const TextureDrawQua
}
setShaderOpacity(quad->opacity(), binding.alphaLocation);
- drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.matrixLocation);
+ drawQuadGeometry(frame, quad->quadTransform(), quad->rect(), binding.matrixLocation);
if (!quad->premultipliedAlpha())
GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
@@ -1000,7 +1002,7 @@ void GLRenderer::drawIOSurfaceQuad(const DrawingFrame& frame, const IOSurfaceDra
GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, quad->ioSurfaceTextureId()));
setShaderOpacity(quad->opacity(), binding.alphaLocation);
- drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.matrixLocation);
+ drawQuadGeometry(frame, quad->quadTransform(), quad->rect(), binding.matrixLocation);
GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0));
}
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index ea5967f..24f7a8e 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -467,9 +467,11 @@ bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
#ifndef NDEBUG
for (size_t i = 0; i < frame.renderPasses.size(); ++i) {
- for (size_t j = 0; j < frame.renderPasses[i]->quadList().size(); ++j)
- DCHECK(frame.renderPasses[i]->quadList()[j]->sharedQuadStateId() >= 0);
- DCHECK(frame.renderPassesById.contains(frame.renderPasses[i]->id()));
+ for (size_t j = 0; j < frame.renderPasses[i]->quadList().size(); ++j) {
+ DCHECK(frame.renderPasses[i]->quadList()[j]->shared_quad_state());
+ DCHECK_GE(frame.renderPasses[i]->quadList()[j]->shared_quad_state()->id, 0);
+ }
+ DCHECK(frame.renderPassesById.contains(frame.renderPasses[i]->id()));
}
#endif
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index 1814221..546c1c1 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -1583,8 +1583,8 @@ public:
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
scoped_ptr<TileDrawQuad> testBlendingDrawQuad = TileDrawQuad::create(sharedQuadState, m_quadRect, opaqueRect, m_resourceId, gfx::Vector2d(), gfx::Size(1, 1), false, false, false, false, false);
- testBlendingDrawQuad->setQuadVisibleRect(m_quadVisibleRect);
- EXPECT_EQ(m_blend, testBlendingDrawQuad->needsBlending());
+ testBlendingDrawQuad->set_visible_rect(m_quadVisibleRect);
+ EXPECT_EQ(m_blend, testBlendingDrawQuad->ShouldDrawWithBlending());
EXPECT_EQ(m_hasRenderSurface, !!renderSurface());
quadSink.append(testBlendingDrawQuad.PassAs<DrawQuad>(), appendQuadsData);
}
@@ -3128,17 +3128,17 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
ASSERT_EQ(1U, frame.renderPasses[1]->quadList().size());
// Verify that the child layers are being clipped.
- gfx::Rect quadVisibleRect = frame.renderPasses[0]->quadList()[0]->quadVisibleRect();
+ gfx::Rect quadVisibleRect = frame.renderPasses[0]->quadList()[0]->visible_rect();
EXPECT_LT(quadVisibleRect.width(), 100);
- quadVisibleRect = frame.renderPasses[0]->quadList()[1]->quadVisibleRect();
+ quadVisibleRect = frame.renderPasses[0]->quadList()[1]->visible_rect();
EXPECT_LT(quadVisibleRect.width(), 100);
// Verify that the render surface texture is *not* clipped.
EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), frame.renderPasses[0]->outputRect());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[1]->quadList()[0]);
EXPECT_FALSE(quad->contentsChangedSinceLastFrame().IsEmpty());
myHostImpl->drawLayers(frame);
@@ -3796,7 +3796,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[1]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_FALSE(targetPass->damageRect().IsEmpty());
@@ -3814,7 +3814,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[0]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_TRUE(targetPass->damageRect().IsEmpty());
@@ -3833,7 +3833,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[0]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_TRUE(targetPass->damageRect().IsEmpty());
@@ -3854,7 +3854,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.renderPasses[0]->quadList()[0]->material());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[1]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_FALSE(targetPass->damageRect().IsEmpty());
@@ -3881,7 +3881,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[1]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_TRUE(targetPass->damageRect().IsEmpty());
@@ -3902,7 +3902,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[0]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_TRUE(targetPass->damageRect().IsEmpty());
@@ -3923,7 +3923,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[0]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_TRUE(targetPass->damageRect().IsEmpty());
@@ -3955,7 +3955,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[1]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_FALSE(targetPass->damageRect().IsEmpty());
@@ -3997,7 +3997,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[0]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_TRUE(targetPass->damageRect().IsEmpty());
@@ -4018,7 +4018,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
EXPECT_EQ(DrawQuad::SOLID_COLOR, frame.renderPasses[0]->quadList()[0]->material());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[1]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_FALSE(targetPass->damageRect().IsEmpty());
@@ -4045,7 +4045,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
EXPECT_EQ(1U, frame.renderPasses[1]->quadList().size());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[1]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[1]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_TRUE(targetPass->damageRect().IsEmpty());
@@ -4084,7 +4084,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size());
EXPECT_EQ(DrawQuad::RENDER_PASS, frame.renderPasses[0]->quadList()[0]->material());
- RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0]);
+ const RenderPassDrawQuad* quad = RenderPassDrawQuad::materialCast(frame.renderPasses[0]->quadList()[0]);
RenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId());
EXPECT_TRUE(targetPass->damageRect().IsEmpty());
diff --git a/cc/nine_patch_layer_impl_unittest.cc b/cc/nine_patch_layer_impl_unittest.cc
index 776beda..39112b7 100644
--- a/cc/nine_patch_layer_impl_unittest.cc
+++ b/cc/nine_patch_layer_impl_unittest.cc
@@ -59,11 +59,11 @@ TEST(NinePatchLayerImplTest, verifyDrawQuads)
Region remaining(visibleContentRect);
for (size_t i = 0; i < quads.size(); ++i) {
DrawQuad* quad = quads[i];
- gfx::Rect quadRect = quad->quadRect();
+ gfx::Rect quadRect = quad->rect();
EXPECT_TRUE(visibleContentRect.Contains(quadRect)) << i;
EXPECT_TRUE(remaining.Contains(quadRect)) << i;
- EXPECT_EQ(quad->sharedQuadState()->quadTransform, transform) << i;
+ EXPECT_EQ(quad->quadTransform(), transform) << i;
remaining.Subtract(Region(quadRect));
}
EXPECT_RECT_EQ(remaining.bounds(), scaledApertureNonUniform);
@@ -76,7 +76,7 @@ TEST(NinePatchLayerImplTest, verifyDrawQuads)
for (size_t i = 0; i < quads.size(); ++i) {
DrawQuad* quad = quads[i];
ASSERT_EQ(quad->material(), DrawQuad::TEXTURE_CONTENT);
- TextureDrawQuad* texQuad = static_cast<TextureDrawQuad*>(quad);
+ const TextureDrawQuad* texQuad = TextureDrawQuad::materialCast(quad);
gfx::RectF texRect = texQuad->uvRect();
texRect.Scale(bitmapSize.width(), bitmapSize.height());
texRemaining.Subtract(Region(ToRoundedIntRect(texRect)));
diff --git a/cc/quad_culler.cc b/cc/quad_culler.cc
index 890b7dd..b06f90b 100644
--- a/cc/quad_culler.cc
+++ b/cc/quad_culler.cc
@@ -43,16 +43,17 @@ static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx::
{
bool keepQuad = !culledRect.IsEmpty();
if (keepQuad)
- drawQuad->setQuadVisibleRect(culledRect);
+ drawQuad->set_visible_rect(culledRect);
- occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform(), drawQuad->quadRect(), culledRect);
- occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culledRect, drawQuad->opaqueRect());
+ occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform(), drawQuad->rect(), culledRect);
+ gfx::Rect opaqueDrawRect = drawQuad->opacity() == 1.0f ? drawQuad->opaque_rect() : gfx::Rect();
+ occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culledRect, opaqueDrawRect);
if (keepQuad) {
- if (createDebugBorderQuads && !drawQuad->isDebugQuad() && drawQuad->quadVisibleRect() != drawQuad->quadRect()) {
+ if (createDebugBorderQuads && !drawQuad->IsDebugQuad() && drawQuad->visible_rect() != drawQuad->rect()) {
SkColor color = DebugColors::CulledTileBorderColor();
float width = DebugColors::CulledTileBorderWidth(layer ? layer->layerTreeHostImpl() : NULL);
- quadList.append(DebugBorderDrawQuad::create(drawQuad->sharedQuadState(), drawQuad->quadVisibleRect(), color, width).PassAs<DrawQuad>());
+ quadList.append(DebugBorderDrawQuad::create(drawQuad->shared_quad_state(), drawQuad->visible_rect(), color, width).PassAs<DrawQuad>());
}
// Pass the quad after we're done using it.
@@ -63,8 +64,7 @@ static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx::
bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQuadsData)
{
- DCHECK(drawQuad->sharedQuadState() == m_currentSharedQuadState);
- DCHECK(drawQuad->sharedQuadStateId() == m_currentSharedQuadState->id);
+ DCHECK(drawQuad->shared_quad_state() == m_currentSharedQuadState);
DCHECK(!m_sharedQuadStateList.isEmpty());
DCHECK(m_sharedQuadStateList.last() == m_currentSharedQuadState);
@@ -73,9 +73,9 @@ bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQu
bool implDrawTransformIsUnknown = false;
if (m_forSurface)
- culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer, false, drawQuad->quadRect(), &hasOcclusionFromOutsideTargetSurface);
+ culledRect = m_occlusionTracker->unoccludedContributingSurfaceContentRect(m_layer, false, drawQuad->rect(), &hasOcclusionFromOutsideTargetSurface);
else
- culledRect = m_occlusionTracker->unoccludedContentRect(m_layer->renderTarget(), drawQuad->quadRect(), drawQuad->quadTransform(), implDrawTransformIsUnknown, drawQuad->clippedRectInTarget(), &hasOcclusionFromOutsideTargetSurface);
+ culledRect = m_occlusionTracker->unoccludedContentRect(m_layer->renderTarget(), drawQuad->rect(), drawQuad->quadTransform(), implDrawTransformIsUnknown, drawQuad->clippedRectInTarget(), &hasOcclusionFromOutsideTargetSurface);
appendQuadsData.hadOcclusionFromOutsideTargetSurface |= hasOcclusionFromOutsideTargetSurface;
diff --git a/cc/quad_culler_unittest.cc b/cc/quad_culler_unittest.cc
index 162a5fb..6bc2998 100644
--- a/cc/quad_culler_unittest.cc
+++ b/cc/quad_culler_unittest.cc
@@ -178,18 +178,18 @@ TEST(QuadCullerTest, verifyCullCenterTileOnly)
appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker);
ASSERT_EQ(quadList.size(), 12u);
- gfx::Rect quadVisibleRect1 = quadList[5]->quadVisibleRect();
+ gfx::Rect quadVisibleRect1 = quadList[5]->visible_rect();
EXPECT_EQ(quadVisibleRect1.height(), 50);
- gfx::Rect quadVisibleRect3 = quadList[7]->quadVisibleRect();
+ gfx::Rect quadVisibleRect3 = quadList[7]->visible_rect();
EXPECT_EQ(quadVisibleRect3.width(), 50);
// Next index is 8, not 9, since centre quad culled.
- gfx::Rect quadVisibleRect4 = quadList[8]->quadVisibleRect();
+ gfx::Rect quadVisibleRect4 = quadList[8]->visible_rect();
EXPECT_EQ(quadVisibleRect4.width(), 50);
EXPECT_EQ(quadVisibleRect4.x(), 250);
- gfx::Rect quadVisibleRect6 = quadList[10]->quadVisibleRect();
+ gfx::Rect quadVisibleRect6 = quadList[10]->visible_rect();
EXPECT_EQ(quadVisibleRect6.height(), 50);
EXPECT_EQ(quadVisibleRect6.y(), 250);
diff --git a/cc/render_pass_draw_quad.cc b/cc/render_pass_draw_quad.cc
index ddd4dc6..c70b3b4 100644
--- a/cc/render_pass_draw_quad.cc
+++ b/cc/render_pass_draw_quad.cc
@@ -35,7 +35,7 @@ const RenderPassDrawQuad* RenderPassDrawQuad::materialCast(const DrawQuad* quad)
scoped_ptr<RenderPassDrawQuad> RenderPassDrawQuad::copy(const SharedQuadState* copiedSharedQuadState, RenderPass::Id copiedRenderPassId) const
{
scoped_ptr<RenderPassDrawQuad> copyQuad(new RenderPassDrawQuad(*materialCast(this)));
- copyQuad->setSharedQuadState(copiedSharedQuadState);
+ copyQuad->set_shared_quad_state(copiedSharedQuadState);
copyQuad->m_renderPassId = copiedRenderPassId;
return copyQuad.Pass();
}
diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc
index 2710ba3..2ec35d0 100644
--- a/cc/software_renderer.cc
+++ b/cc/software_renderer.cc
@@ -168,7 +168,7 @@ void SoftwareRenderer::drawQuad(DrawingFrame& frame, const DrawQuad* quad)
{
TRACE_EVENT0("cc", "SoftwareRenderer::drawQuad");
WebTransformationMatrix quadRectMatrix;
- quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->quadRect());
+ quadRectTransform(&quadRectMatrix, quad->quadTransform(), quad->rect());
WebTransformationMatrix contentsDeviceTransform = (frame.windowMatrix * frame.projectionMatrix * quadRectMatrix).to2dTransform();
SkMatrix skDeviceMatrix;
toSkMatrix(&skDeviceMatrix, contentsDeviceTransform);
@@ -179,7 +179,8 @@ void SoftwareRenderer::drawQuad(DrawingFrame& frame, const DrawQuad* quad)
m_skCurrentPaint.setAntiAlias(true);
m_skCurrentPaint.setFilterBitmap(true);
}
- if (quad->needsBlending()) {
+
+ if (quad->ShouldDrawWithBlending()) {
m_skCurrentPaint.setAlpha(quad->opacity() * 255);
m_skCurrentPaint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
} else {
@@ -259,7 +260,7 @@ void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua
SkRect uvRect = SkRect::MakeXYWH(
quad->textureOffset().x(), quad->textureOffset().y(),
- quad->quadRect().width(), quad->quadRect().height());
+ quad->rect().width(), quad->rect().height());
m_skCurrentPaint.setFilterBitmap(true);
m_skCurrentCanvas->drawBitmapRectToRect(*lock.skBitmap(), &uvRect,
gfx::RectFToSkRect(quadVertexRect()),
diff --git a/cc/solid_color_draw_quad.cc b/cc/solid_color_draw_quad.cc
index 0cfdd0e2..f8c1614 100644
--- a/cc/solid_color_draw_quad.cc
+++ b/cc/solid_color_draw_quad.cc
@@ -18,7 +18,7 @@ SolidColorDrawQuad::SolidColorDrawQuad(const SharedQuadState* sharedQuadState, c
, m_color(color)
{
if (SkColorGetA(m_color) < 255)
- m_opaqueRect = gfx::Rect();
+ opaque_rect_ = gfx::Rect();
}
const SolidColorDrawQuad* SolidColorDrawQuad::materialCast(const DrawQuad* quad)
diff --git a/cc/solid_color_layer_impl_unittest.cc b/cc/solid_color_layer_impl_unittest.cc
index ce5508f..cd37ab0 100644
--- a/cc/solid_color_layer_impl_unittest.cc
+++ b/cc/solid_color_layer_impl_unittest.cc
@@ -113,7 +113,7 @@ TEST(SolidColorLayerImplTest, verifyOpaqueRect)
layerImpl->appendQuads(quadCuller, data);
ASSERT_EQ(quadCuller.quadList().size(), 1U);
- EXPECT_EQ(visibleContentRect.ToString(), quadCuller.quadList()[0]->opaqueRect().ToString());
+ EXPECT_EQ(visibleContentRect.ToString(), quadCuller.quadList()[0]->opaque_rect().ToString());
}
EXPECT_TRUE(layer->contentsOpaque());
@@ -127,7 +127,7 @@ TEST(SolidColorLayerImplTest, verifyOpaqueRect)
// The impl layer should callnot itself opaque anymore.
EXPECT_FALSE(layerImpl->contentsOpaque());
- // Impl layer has 1 opacity, but the color is not opaque, so the opaqueRect should be empty.
+ // Impl layer has 1 opacity, but the color is not opaque, so the opaque_rect should be empty.
layerImpl->setDrawOpacity(1);
MockQuadCuller quadCuller;
@@ -135,7 +135,7 @@ TEST(SolidColorLayerImplTest, verifyOpaqueRect)
layerImpl->appendQuads(quadCuller, data);
ASSERT_EQ(quadCuller.quadList().size(), 1U);
- EXPECT_EQ(gfx::Rect().ToString(), quadCuller.quadList()[0]->opaqueRect().ToString());
+ EXPECT_EQ(gfx::Rect().ToString(), quadCuller.quadList()[0]->opaque_rect().ToString());
}
}
diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc
index ba8bc14..601e834 100644
--- a/cc/test/layer_test_common.cc
+++ b/cc/test/layer_test_common.cc
@@ -38,7 +38,7 @@ void verifyQuadsExactlyCoverRect(const cc::QuadList& quads,
for (size_t i = 0; i < quads.size(); ++i) {
cc::DrawQuad* quad = quads[i];
- gfx::RectF quadRectF = cc::MathUtil::mapClippedRect(quad->sharedQuadState()->quadTransform, gfx::RectF(quad->quadRect()));
+ gfx::RectF quadRectF = cc::MathUtil::mapClippedRect(quad->shared_quad_state()->quadTransform, gfx::RectF(quad->rect()));
// Before testing for exact coverage in the integer world, assert that rounding
// will not round the rect incorrectly.
diff --git a/cc/test/mock_quad_culler.cc b/cc/test/mock_quad_culler.cc
index beb8d67..b2d760c 100644
--- a/cc/test/mock_quad_culler.cc
+++ b/cc/test/mock_quad_culler.cc
@@ -24,7 +24,7 @@ MockQuadCuller::~MockQuadCuller()
bool MockQuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData&)
{
- if (!drawQuad->quadRect().IsEmpty()) {
+ if (!drawQuad->rect().IsEmpty()) {
m_activeQuadList.append(drawQuad.Pass());
return true;
}
diff --git a/cc/texture_draw_quad.cc b/cc/texture_draw_quad.cc
index e720cd1..1bed6be 100644
--- a/cc/texture_draw_quad.cc
+++ b/cc/texture_draw_quad.cc
@@ -22,11 +22,6 @@ TextureDrawQuad::TextureDrawQuad(const SharedQuadState* sharedQuadState, const g
{
}
-void TextureDrawQuad::setNeedsBlending()
-{
- m_needsBlending = true;
-}
-
const TextureDrawQuad* TextureDrawQuad::materialCast(const DrawQuad* quad)
{
DCHECK(quad->material() == DrawQuad::TEXTURE_CONTENT);
diff --git a/cc/texture_draw_quad.h b/cc/texture_draw_quad.h
index ceccb1e..5a6d3f3 100644
--- a/cc/texture_draw_quad.h
+++ b/cc/texture_draw_quad.h
@@ -21,8 +21,6 @@ public:
bool premultipliedAlpha() const { return m_premultipliedAlpha; }
bool flipped() const { return m_flipped; }
- void setNeedsBlending();
-
static const TextureDrawQuad* materialCast(const DrawQuad*);
private:
TextureDrawQuad(const SharedQuadState*, const gfx::Rect&, const gfx::Rect& opaqueRect, unsigned resourceId, bool premultipliedAlpha, const gfx::RectF& uvRect, bool flipped);
diff --git a/cc/tile_draw_quad.cc b/cc/tile_draw_quad.cc
index b2e2b67..e5c3e40 100644
--- a/cc/tile_draw_quad.cc
+++ b/cc/tile_draw_quad.cc
@@ -26,7 +26,7 @@ TileDrawQuad::TileDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Re
, m_bottomEdgeAA(bottomEdgeAA)
{
if (isAntialiased())
- m_needsBlending = true;
+ needs_blending_ = true;
}
const TileDrawQuad* TileDrawQuad::materialCast(const DrawQuad* quad)
diff --git a/cc/tiled_layer_impl_unittest.cc b/cc/tiled_layer_impl_unittest.cc
index a465771..13e0c05 100644
--- a/cc/tiled_layer_impl_unittest.cc
+++ b/cc/tiled_layer_impl_unittest.cc
@@ -199,29 +199,12 @@ TEST(TiledLayerImplTest, textureInfoForLayerNoBorders)
getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, gfx::Rect(gfx::Point(), layerSize));
for (size_t i = 0; i < quads.size(); ++i) {
- ASSERT_EQ(quads[i]->material(), DrawQuad::TILED_CONTENT) << quadString << i;
- TileDrawQuad* quad = static_cast<TileDrawQuad*>(quads[i]);
+ const TileDrawQuad* quad = TileDrawQuad::materialCast(quads[i]);
EXPECT_NE(quad->resourceId(), 0u) << quadString << i;
EXPECT_EQ(quad->textureOffset(), gfx::Vector2d()) << quadString << i;
EXPECT_EQ(quad->textureSize(), tileSize) << quadString << i;
- EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i;
- }
-}
-
-TEST(TiledLayerImplTest, tileOpaqueRectForLayerNoBorders)
-{
- gfx::Size tileSize(50, 50);
- gfx::Size layerSize(250, 250);
- QuadList quads;
- SharedQuadStateList sharedStates;
- getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, gfx::Rect(gfx::Point(), layerSize));
-
- for (size_t i = 0; i < quads.size(); ++i) {
- ASSERT_EQ(quads[i]->material(), DrawQuad::TILED_CONTENT) << quadString << i;
- TileDrawQuad* quad = static_cast<TileDrawQuad*>(quads[i]);
-
- EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i;
+ EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaque_rect()) << quadString << i;
}
}
diff --git a/cc/yuv_video_draw_quad.h b/cc/yuv_video_draw_quad.h
index 21b88f4..e923b68 100644
--- a/cc/yuv_video_draw_quad.h
+++ b/cc/yuv_video_draw_quad.h
@@ -24,7 +24,7 @@ public:
const VideoLayerImpl::FramePlane& uPlane,
const VideoLayerImpl::FramePlane& vPlane);
- ~YUVVideoDrawQuad();
+ virtual ~YUVVideoDrawQuad();
const gfx::SizeF& texScale() const { return m_texScale; }