summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorweiliangc@chromium.org <weiliangc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-07 15:39:41 +0000
committerweiliangc@chromium.org <weiliangc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-07 15:39:41 +0000
commit9be1adc83cd60051957268b4aa6517cf2c23fbbb (patch)
tree7930ff16a9ead5412d0a5a10dd325e4b575a6c87 /cc
parentaf5e7996e4e5e60ea67512143a226aac952a695d (diff)
downloadchromium_src-9be1adc83cd60051957268b4aa6517cf2c23fbbb.zip
chromium_src-9be1adc83cd60051957268b4aa6517cf2c23fbbb.tar.gz
chromium_src-9be1adc83cd60051957268b4aa6517cf2c23fbbb.tar.bz2
Create SharedQuadState on RenderPass
Instead of creating SharedQuadState on layers and pass ownership around, create SharedQuadState on RenderPass and only pass the raw pointer to layers. Also let QuadCuller hold pointer to RenderPass instead of two points to DrawQuadList and SharedQuadStateList that is owned by RenderPass. BUG=344962 TEST=cc_unittests Review URL: https://codereview.chromium.org/265823015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/layers/delegated_renderer_layer_impl.cc8
-rw-r--r--cc/layers/delegated_renderer_layer_impl_unittest.cc20
-rw-r--r--cc/layers/heads_up_display_layer_impl.cc4
-rw-r--r--cc/layers/io_surface_layer_impl.cc5
-rw-r--r--cc/layers/layer_impl.cc4
-rw-r--r--cc/layers/layer_impl.h2
-rw-r--r--cc/layers/nine_patch_layer_impl.cc5
-rw-r--r--cc/layers/painted_scrollbar_layer_impl.cc5
-rw-r--r--cc/layers/picture_layer_impl.cc4
-rw-r--r--cc/layers/quad_sink.h7
-rw-r--r--cc/layers/render_surface_impl.cc3
-rw-r--r--cc/layers/render_surface_unittest.cc9
-rw-r--r--cc/layers/solid_color_layer_impl.cc5
-rw-r--r--cc/layers/solid_color_scrollbar_layer_impl.cc5
-rw-r--r--cc/layers/surface_layer_impl.cc5
-rw-r--r--cc/layers/texture_layer_impl.cc5
-rw-r--r--cc/layers/tiled_layer_impl.cc5
-rw-r--r--cc/layers/tiled_layer_impl_unittest.cc43
-rw-r--r--cc/layers/ui_resource_layer_impl.cc5
-rw-r--r--cc/layers/video_layer_impl.cc5
-rw-r--r--cc/quads/render_pass.cc10
-rw-r--r--cc/quads/render_pass.h2
-rw-r--r--cc/quads/shared_quad_state.cc4
-rw-r--r--cc/quads/shared_quad_state.h1
-rw-r--r--cc/surfaces/surface_aggregator.cc14
-rw-r--r--cc/surfaces/surface_aggregator.h4
-rw-r--r--cc/surfaces/surface_aggregator_test_helpers.cc5
-rw-r--r--cc/test/mock_quad_culler.cc24
-rw-r--r--cc/test/mock_quad_culler.h20
-rw-r--r--cc/test/render_pass_test_utils.cc27
-rw-r--r--cc/trees/layer_tree_host_impl.cc18
-rw-r--r--cc/trees/layer_tree_host_impl_unittest.cc9
-rw-r--r--cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc9
-rw-r--r--cc/trees/quad_culler.cc21
-rw-r--r--cc/trees/quad_culler.h11
35 files changed, 154 insertions, 179 deletions
diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc
index 4556db6..f59e1f2 100644
--- a/cc/layers/delegated_renderer_layer_impl.cc
+++ b/cc/layers/delegated_renderer_layer_impl.cc
@@ -319,8 +319,8 @@ void DelegatedRendererLayerImpl::AppendRainbowDebugBorder(
if (!ShowDebugBorders())
return;
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
SkColor color;
float border_width;
@@ -407,8 +407,8 @@ void DelegatedRendererLayerImpl::AppendRenderPassQuads(
if (delegated_quad->shared_quad_state != delegated_shared_quad_state) {
delegated_shared_quad_state = delegated_quad->shared_quad_state;
- output_shared_quad_state = quad_sink->UseSharedQuadState(
- delegated_shared_quad_state->Copy());
+ output_shared_quad_state = quad_sink->CreateSharedQuadState();
+ output_shared_quad_state->CopyFrom(delegated_shared_quad_state);
bool is_root_delegated_render_pass =
delegated_render_pass == render_passes_in_draw_order_.back();
diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc
index 7578e22..bf4b088 100644
--- a/cc/layers/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc
@@ -541,9 +541,8 @@ class DelegatedRendererLayerImplTestTransform
RenderPass::Id(10, 7),
child_pass_rect,
gfx::Transform());
- MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
- SharedQuadState* shared_quad_state = quad_sink.UseSharedQuadState(
- SharedQuadState::Create());
+ MockQuadCuller quad_sink(pass);
+ SharedQuadState* shared_quad_state = quad_sink.CreateSharedQuadState();
shared_quad_state->SetAll(child_pass_transform,
child_pass_content_bounds,
child_pass_rect,
@@ -583,9 +582,8 @@ class DelegatedRendererLayerImplTestTransform
RenderPass::Id(9, 6),
root_pass_rect,
gfx::Transform());
- MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
- SharedQuadState* shared_quad_state =
- quad_sink.UseSharedQuadState(SharedQuadState::Create());
+ MockQuadCuller quad_sink(pass);
+ SharedQuadState* shared_quad_state = quad_sink.CreateSharedQuadState();
shared_quad_state->SetAll(root_pass_transform,
root_pass_content_bounds,
root_pass_rect,
@@ -972,9 +970,8 @@ class DelegatedRendererLayerImplTestClip
RenderPass::Id(10, 7),
child_pass_rect,
gfx::Transform());
- MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
- SharedQuadState* shared_quad_state =
- quad_sink.UseSharedQuadState(SharedQuadState::Create());
+ MockQuadCuller quad_sink(pass);
+ SharedQuadState* shared_quad_state = quad_sink.CreateSharedQuadState();
shared_quad_state->SetAll(child_pass_transform,
child_pass_content_bounds,
child_pass_rect,
@@ -1012,9 +1009,8 @@ class DelegatedRendererLayerImplTestClip
RenderPass::Id(9, 6),
root_pass_rect,
gfx::Transform());
- MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
- SharedQuadState* shared_quad_state =
- quad_sink.UseSharedQuadState(SharedQuadState::Create());
+ MockQuadCuller quad_sink(pass);
+ SharedQuadState* shared_quad_state = quad_sink.CreateSharedQuadState();
shared_quad_state->SetAll(root_pass_transform,
root_pass_content_bounds,
root_pass_rect,
diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc
index 957ad9a..6149a06 100644
--- a/cc/layers/heads_up_display_layer_impl.cc
+++ b/cc/layers/heads_up_display_layer_impl.cc
@@ -110,8 +110,8 @@ void HeadsUpDisplayLayerImpl::AppendQuads(QuadSink* quad_sink,
if (!hud_resource_->id())
return;
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
gfx::Rect quad_rect(content_bounds());
gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect());
diff --git a/cc/layers/io_surface_layer_impl.cc b/cc/layers/io_surface_layer_impl.cc
index 4176c26..6d94c91 100644
--- a/cc/layers/io_surface_layer_impl.cc
+++ b/cc/layers/io_surface_layer_impl.cc
@@ -66,8 +66,9 @@ bool IOSurfaceLayerImpl::WillDraw(DrawMode draw_mode,
void IOSurfaceLayerImpl::AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) {
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
gfx::Rect quad_rect(content_bounds());
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 855f43d..fd5ea31 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -243,8 +243,7 @@ void LayerImpl::ClearRenderSurfaceLayerList() {
draw_properties_.render_surface->layer_list().clear();
}
-scoped_ptr<SharedQuadState> LayerImpl::CreateSharedQuadState() const {
- scoped_ptr<SharedQuadState> state = SharedQuadState::Create();
+void LayerImpl::PopulateSharedQuadState(SharedQuadState* state) const {
state->SetAll(draw_properties_.target_space_transform,
draw_properties_.content_bounds,
draw_properties_.visible_content_rect,
@@ -252,7 +251,6 @@ scoped_ptr<SharedQuadState> LayerImpl::CreateSharedQuadState() const {
draw_properties_.is_clipped,
draw_properties_.opacity,
blend_mode_);
- return state.Pass();
}
bool LayerImpl::WillDraw(DrawMode draw_mode,
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h
index e712b7e..e84c669 100644
--- a/cc/layers/layer_impl.h
+++ b/cc/layers/layer_impl.h
@@ -158,7 +158,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver,
LayerTreeImpl* layer_tree_impl() const { return layer_tree_impl_; }
- scoped_ptr<SharedQuadState> CreateSharedQuadState() const;
+ void PopulateSharedQuadState(SharedQuadState* state) const;
// WillDraw must be called before AppendQuads. If WillDraw returns false,
// AppendQuads and DidDraw will not be called. If WillDraw returns true,
// DidDraw is guaranteed to be called before another WillDraw or before
diff --git a/cc/layers/nine_patch_layer_impl.cc b/cc/layers/nine_patch_layer_impl.cc
index 95c286f..990310b 100644
--- a/cc/layers/nine_patch_layer_impl.cc
+++ b/cc/layers/nine_patch_layer_impl.cc
@@ -96,8 +96,9 @@ void NinePatchLayerImpl::CheckGeometryLimitations() {
void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) {
CheckGeometryLimitations();
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
if (!ui_resource_id_)
diff --git a/cc/layers/painted_scrollbar_layer_impl.cc b/cc/layers/painted_scrollbar_layer_impl.cc
index e4677f7..ac6ce4a 100644
--- a/cc/layers/painted_scrollbar_layer_impl.cc
+++ b/cc/layers/painted_scrollbar_layer_impl.cc
@@ -78,8 +78,9 @@ void PaintedScrollbarLayerImpl::AppendQuads(
gfx::Rect bounds_rect(bounds());
gfx::Rect content_bounds_rect(content_bounds());
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
gfx::Rect thumb_quad_rect = ComputeThumbQuadRect();
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 36e754f..1d71e07 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -138,8 +138,8 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink,
gfx::Rect rect(visible_content_rect());
gfx::Rect content_rect(content_bounds());
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) {
AppendDebugBorderQuad(
diff --git a/cc/layers/quad_sink.h b/cc/layers/quad_sink.h
index 7312781..0b503e4 100644
--- a/cc/layers/quad_sink.h
+++ b/cc/layers/quad_sink.h
@@ -24,10 +24,9 @@ class CC_EXPORT QuadSink {
virtual ~QuadSink() {}
// Call this to add a SharedQuadState before appending quads that refer to it.
- // Returns a pointer to the given SharedQuadState for convenience, that can be
- // set on the quads to append.
- virtual SharedQuadState* UseSharedQuadState(
- scoped_ptr<SharedQuadState> shared_quad_state) = 0;
+ // Returns a pointer to the given SharedQuadState, that can be set on the
+ // quads to append.
+ virtual SharedQuadState* CreateSharedQuadState() = 0;
virtual gfx::Rect UnoccludedContentRect(
const gfx::Rect& content_rect,
diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc
index fa7dcb8..3bce76f 100644
--- a/cc/layers/render_surface_impl.cc
+++ b/cc/layers/render_surface_impl.cc
@@ -150,8 +150,7 @@ void RenderSurfaceImpl::AppendQuads(QuadSink* quad_sink,
if (visible_content_rect.IsEmpty())
return;
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(SharedQuadState::Create());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
shared_quad_state->SetAll(draw_transform,
content_rect_.size(),
content_rect_,
diff --git a/cc/layers/render_surface_unittest.cc b/cc/layers/render_surface_unittest.cc
index 7056b1d0..47ce276 100644
--- a/cc/layers/render_surface_unittest.cc
+++ b/cc/layers/render_surface_unittest.cc
@@ -107,17 +107,16 @@ TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectSharedQuadState) {
render_surface->SetClipRect(clip_rect);
render_surface->SetDrawOpacity(1.f);
- QuadList quad_list;
- SharedQuadStateList shared_state_list;
- MockQuadCuller mock_quad_culler(&quad_list, &shared_state_list);
+ scoped_ptr<RenderPass> render_pass = RenderPass::Create();
+ MockQuadCuller mock_quad_culler(render_pass.get());
AppendQuadsData append_quads_data;
bool for_replica = false;
render_surface->AppendQuads(
&mock_quad_culler, &append_quads_data, for_replica, RenderPass::Id(2, 0));
- ASSERT_EQ(1u, shared_state_list.size());
- SharedQuadState* shared_quad_state = shared_state_list[0];
+ ASSERT_EQ(1u, render_pass->shared_quad_state_list.size());
+ SharedQuadState* shared_quad_state = render_pass->shared_quad_state_list[0];
EXPECT_EQ(
30.0,
diff --git a/cc/layers/solid_color_layer_impl.cc b/cc/layers/solid_color_layer_impl.cc
index 2708af9..e60edd1 100644
--- a/cc/layers/solid_color_layer_impl.cc
+++ b/cc/layers/solid_color_layer_impl.cc
@@ -24,8 +24,9 @@ scoped_ptr<LayerImpl> SolidColorLayerImpl::CreateLayerImpl(
void SolidColorLayerImpl::AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) {
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
// We create a series of smaller quads instead of just one large one so that
diff --git a/cc/layers/solid_color_scrollbar_layer_impl.cc b/cc/layers/solid_color_scrollbar_layer_impl.cc
index f579ea6..24c54e4 100644
--- a/cc/layers/solid_color_scrollbar_layer_impl.cc
+++ b/cc/layers/solid_color_scrollbar_layer_impl.cc
@@ -94,8 +94,9 @@ bool SolidColorScrollbarLayerImpl::IsThumbResizable() const {
void SolidColorScrollbarLayerImpl::AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) {
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
gfx::Rect thumb_quad_rect(ComputeThumbQuadRect());
diff --git a/cc/layers/surface_layer_impl.cc b/cc/layers/surface_layer_impl.cc
index 2f98805..3bfae2d 100644
--- a/cc/layers/surface_layer_impl.cc
+++ b/cc/layers/surface_layer_impl.cc
@@ -37,8 +37,9 @@ void SurfaceLayerImpl::PushPropertiesTo(LayerImpl* layer) {
void SurfaceLayerImpl::AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) {
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
if (!surface_id_)
diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc
index 9cd94a3..5e65d72 100644
--- a/cc/layers/texture_layer_impl.cc
+++ b/cc/layers/texture_layer_impl.cc
@@ -143,8 +143,9 @@ void TextureLayerImpl::AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) {
DCHECK(external_texture_resource_ || valid_texture_copy_);
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
SkColor bg_color = blend_background_color_ ?
diff --git a/cc/layers/tiled_layer_impl.cc b/cc/layers/tiled_layer_impl.cc
index cc95a04..a510883 100644
--- a/cc/layers/tiled_layer_impl.cc
+++ b/cc/layers/tiled_layer_impl.cc
@@ -158,8 +158,9 @@ void TiledLayerImpl::AppendQuads(QuadSink* quad_sink,
DCHECK(!visible_content_rect().IsEmpty());
gfx::Rect content_rect = visible_content_rect();
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
int left, top, right, bottom;
diff --git a/cc/layers/tiled_layer_impl_unittest.cc b/cc/layers/tiled_layer_impl_unittest.cc
index a92d024..2b18fff 100644
--- a/cc/layers/tiled_layer_impl_unittest.cc
+++ b/cc/layers/tiled_layer_impl_unittest.cc
@@ -67,8 +67,7 @@ class TiledLayerImplTest : public testing::Test {
return layer.Pass();
}
- void GetQuads(QuadList* quads,
- SharedQuadStateList* shared_states,
+ void GetQuads(RenderPass* render_pass,
const gfx::Size& tile_size,
const gfx::Size& layer_size,
LayerTilingData::BorderTexelOption border_texel_option,
@@ -78,7 +77,7 @@ class TiledLayerImplTest : public testing::Test {
layer->draw_properties().visible_content_rect = visible_content_rect;
layer->SetBounds(layer_size);
- MockQuadCuller quad_culler(quads, shared_states);
+ MockQuadCuller quad_culler(render_pass);
AppendQuadsData data;
layer->AppendQuads(&quad_culler, &data);
}
@@ -200,15 +199,14 @@ class TiledLayerImplBorderTest : public TiledLayerImplTest {
void CoverageVisibleRectOnTileBoundaries(
LayerTilingData::BorderTexelOption borders) {
gfx::Size layer_size(1000, 1000);
- QuadList quads;
- SharedQuadStateList shared_states;
- GetQuads(&quads,
- &shared_states,
+ scoped_ptr<RenderPass> render_pass = RenderPass::Create();
+ GetQuads(render_pass.get(),
gfx::Size(100, 100),
layer_size,
borders,
gfx::Rect(layer_size));
- LayerTestCommon::VerifyQuadsExactlyCoverRect(quads, gfx::Rect(layer_size));
+ LayerTestCommon::VerifyQuadsExactlyCoverRect(render_pass->quad_list,
+ gfx::Rect(layer_size));
}
void CoverageVisibleRectIntersectsTiles(
@@ -219,30 +217,28 @@ class TiledLayerImplBorderTest : public TiledLayerImplTest {
gfx::Rect visible_content_rect = gfx::BoundingRect(top_left, bottom_right);
gfx::Size layer_size(250, 250);
- QuadList quads;
- SharedQuadStateList shared_states;
- GetQuads(&quads,
- &shared_states,
+ scoped_ptr<RenderPass> render_pass = RenderPass::Create();
+ GetQuads(render_pass.get(),
gfx::Size(50, 50),
gfx::Size(250, 250),
LayerTilingData::NO_BORDER_TEXELS,
visible_content_rect);
- LayerTestCommon::VerifyQuadsExactlyCoverRect(quads, visible_content_rect);
+ LayerTestCommon::VerifyQuadsExactlyCoverRect(render_pass->quad_list,
+ visible_content_rect);
}
void CoverageVisibleRectIntersectsBounds(
LayerTilingData::BorderTexelOption borders) {
gfx::Size layer_size(220, 210);
gfx::Rect visible_content_rect(layer_size);
- QuadList quads;
- SharedQuadStateList shared_states;
- GetQuads(&quads,
- &shared_states,
+ scoped_ptr<RenderPass> render_pass = RenderPass::Create();
+ GetQuads(render_pass.get(),
gfx::Size(100, 100),
layer_size,
LayerTilingData::NO_BORDER_TEXELS,
visible_content_rect);
- LayerTestCommon::VerifyQuadsExactlyCoverRect(quads, visible_content_rect);
+ LayerTestCommon::VerifyQuadsExactlyCoverRect(render_pass->quad_list,
+ visible_content_rect);
}
};
WITH_AND_WITHOUT_BORDER_TEST(CoverageVisibleRectOnTileBoundaries);
@@ -254,17 +250,16 @@ WITH_AND_WITHOUT_BORDER_TEST(CoverageVisibleRectIntersectsBounds);
TEST_F(TiledLayerImplTest, TextureInfoForLayerNoBorders) {
gfx::Size tile_size(50, 50);
gfx::Size layer_size(250, 250);
- QuadList quads;
- SharedQuadStateList shared_states;
- GetQuads(&quads,
- &shared_states,
+ scoped_ptr<RenderPass> render_pass = RenderPass::Create();
+ GetQuads(render_pass.get(),
tile_size,
layer_size,
LayerTilingData::NO_BORDER_TEXELS,
gfx::Rect(layer_size));
- for (size_t i = 0; i < quads.size(); ++i) {
- const TileDrawQuad* quad = TileDrawQuad::MaterialCast(quads[i]);
+ for (size_t i = 0; i < render_pass->quad_list.size(); ++i) {
+ const TileDrawQuad* quad =
+ TileDrawQuad::MaterialCast(render_pass->quad_list[i]);
EXPECT_NE(0u, quad->resource_id) << LayerTestCommon::quad_string << i;
EXPECT_EQ(gfx::RectF(gfx::PointF(), tile_size), quad->tex_coord_rect)
diff --git a/cc/layers/ui_resource_layer_impl.cc b/cc/layers/ui_resource_layer_impl.cc
index 33392af..a5b563f 100644
--- a/cc/layers/ui_resource_layer_impl.cc
+++ b/cc/layers/ui_resource_layer_impl.cc
@@ -93,8 +93,9 @@ bool UIResourceLayerImpl::WillDraw(DrawMode draw_mode,
void UIResourceLayerImpl::AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) {
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
if (!ui_resource_id_)
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc
index 2002116..dad3159 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -128,8 +128,9 @@ void VideoLayerImpl::AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) {
DCHECK(frame_.get());
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data);
gfx::Rect quad_rect(content_bounds());
diff --git a/cc/quads/render_pass.cc b/cc/quads/render_pass.cc
index 3c8b481..535cb63 100644
--- a/cc/quads/render_pass.cc
+++ b/cc/quads/render_pass.cc
@@ -79,8 +79,9 @@ void RenderPass::CopyAll(const ScopedPtrVector<RenderPass>& in,
source->transform_to_root_target,
source->has_transparent_background);
for (size_t i = 0; i < source->shared_quad_state_list.size(); ++i) {
- copy_pass->shared_quad_state_list.push_back(
- source->shared_quad_state_list[i]->Copy());
+ SharedQuadState* copy_shared_quad_state =
+ copy_pass->CreateAndAppendSharedQuadState();
+ copy_shared_quad_state->CopyFrom(source->shared_quad_state_list[i]);
}
for (size_t i = 0, sqs_i = 0; i < source->quad_list.size(); ++i) {
while (source->quad_list[i]->shared_quad_state !=
@@ -168,4 +169,9 @@ scoped_ptr<base::Value> RenderPass::AsValue() const {
return value.PassAs<base::Value>();
}
+SharedQuadState* RenderPass::CreateAndAppendSharedQuadState() {
+ shared_quad_state_list.push_back(SharedQuadState::Create());
+ return shared_quad_state_list.back();
+}
+
} // namespace cc
diff --git a/cc/quads/render_pass.h b/cc/quads/render_pass.h
index 1cbac05..4416ea8 100644
--- a/cc/quads/render_pass.h
+++ b/cc/quads/render_pass.h
@@ -88,6 +88,8 @@ class CC_EXPORT RenderPass {
scoped_ptr<base::Value> AsValue() const;
+ SharedQuadState* CreateAndAppendSharedQuadState();
+
// Uniquely identifies the render pass in the compositor's current frame.
Id id;
diff --git a/cc/quads/shared_quad_state.cc b/cc/quads/shared_quad_state.cc
index 9ea3faa..3832886 100644
--- a/cc/quads/shared_quad_state.cc
+++ b/cc/quads/shared_quad_state.cc
@@ -27,6 +27,10 @@ scoped_ptr<SharedQuadState> SharedQuadState::Copy() const {
return make_scoped_ptr(new SharedQuadState(*this));
}
+void SharedQuadState::CopyFrom(const SharedQuadState* other) {
+ *this = *other;
+}
+
void SharedQuadState::SetAll(const gfx::Transform& content_to_target_transform,
const gfx::Size& content_bounds,
const gfx::Rect& visible_content_rect,
diff --git a/cc/quads/shared_quad_state.h b/cc/quads/shared_quad_state.h
index 42d977e..cf44381 100644
--- a/cc/quads/shared_quad_state.h
+++ b/cc/quads/shared_quad_state.h
@@ -28,6 +28,7 @@ class CC_EXPORT SharedQuadState {
~SharedQuadState();
scoped_ptr<SharedQuadState> Copy() const;
+ void CopyFrom(const SharedQuadState* other);
void SetAll(const gfx::Transform& content_to_target_transform,
const gfx::Size& content_bounds,
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index 5b108bb..6b2178d 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -131,10 +131,12 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
}
void SurfaceAggregator::CopySharedQuadState(
- const SharedQuadState& source_sqs,
+ const SharedQuadState* source_sqs,
const gfx::Transform& content_to_target_transform,
- SharedQuadStateList* dest_sqs_list) {
- scoped_ptr<SharedQuadState> copy_shared_quad_state = source_sqs.Copy();
+ RenderPass* dest_render_pass) {
+ SharedQuadState* copy_shared_quad_state =
+ dest_render_pass->CreateAndAppendSharedQuadState();
+ copy_shared_quad_state->CopyFrom(source_sqs);
// content_to_target_transform contains any transformation that may exist
// between the context that these quads are being copied from (i.e. the
// surface's draw transform when aggregated from within a surface) to the
@@ -143,7 +145,6 @@ void SurfaceAggregator::CopySharedQuadState(
// transform is not identity.
copy_shared_quad_state->content_to_target_transform.ConcatTransform(
content_to_target_transform);
- dest_sqs_list->push_back(copy_shared_quad_state.Pass());
}
void SurfaceAggregator::CopyQuadsToPass(
@@ -167,9 +168,8 @@ void SurfaceAggregator::CopyQuadsToPass(
HandleSurfaceQuad(surface_quad, dest_pass);
} else {
if (quad->shared_quad_state != last_copied_source_shared_quad_state) {
- CopySharedQuadState(*quad->shared_quad_state,
- content_to_target_transform,
- &dest_pass->shared_quad_state_list);
+ CopySharedQuadState(
+ quad->shared_quad_state, content_to_target_transform, dest_pass);
last_copied_source_shared_quad_state = quad->shared_quad_state;
}
if (quad->material == DrawQuad::RENDER_PASS) {
diff --git a/cc/surfaces/surface_aggregator.h b/cc/surfaces/surface_aggregator.h
index 9ee3d11..4115bc3 100644
--- a/cc/surfaces/surface_aggregator.h
+++ b/cc/surfaces/surface_aggregator.h
@@ -33,9 +33,9 @@ class CC_SURFACES_EXPORT SurfaceAggregator {
void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
RenderPass* dest_pass);
- void CopySharedQuadState(const SharedQuadState& source_sqs,
+ void CopySharedQuadState(const SharedQuadState* source_sqs,
const gfx::Transform& content_to_target_transform,
- SharedQuadStateList* dest_sqs_list);
+ RenderPass* dest_render_pass);
void CopyQuadsToPass(const QuadList& source_quad_list,
const SharedQuadStateList& source_shared_quad_state_list,
const gfx::Transform& content_to_target_transform,
diff --git a/cc/surfaces/surface_aggregator_test_helpers.cc b/cc/surfaces/surface_aggregator_test_helpers.cc
index 2ac3289..be6340e 100644
--- a/cc/surfaces/surface_aggregator_test_helpers.cc
+++ b/cc/surfaces/surface_aggregator_test_helpers.cc
@@ -54,10 +54,9 @@ void AddTestSurfaceQuad(TestRenderPass* pass,
}
void AddTestRenderPassQuad(TestRenderPass* pass,
RenderPass::Id render_pass_id) {
- MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
+ MockQuadCuller quad_sink(pass);
gfx::Rect output_rect = gfx::Rect(0, 0, 5, 5);
- SharedQuadState* shared_state =
- quad_sink.UseSharedQuadState(SharedQuadState::Create());
+ SharedQuadState* shared_state = quad_sink.CreateSharedQuadState();
shared_state->SetAll(gfx::Transform(),
output_rect.size(),
output_rect,
diff --git a/cc/test/mock_quad_culler.cc b/cc/test/mock_quad_culler.cc
index 773430f..ddb5913 100644
--- a/cc/test/mock_quad_culler.cc
+++ b/cc/test/mock_quad_culler.cc
@@ -9,23 +9,19 @@
namespace cc {
-MockQuadCuller::MockQuadCuller()
- : active_quad_list_(&quad_list_storage_),
- active_shared_quad_state_list_(&shared_quad_state_storage_) {}
+MockQuadCuller::MockQuadCuller() {
+ render_pass_storage_ = RenderPass::Create();
+ active_render_pass_ = render_pass_storage_.get();
+}
-MockQuadCuller::MockQuadCuller(
- QuadList* external_quad_list,
- SharedQuadStateList* external_shared_quad_state_list)
- : active_quad_list_(external_quad_list),
- active_shared_quad_state_list_(external_shared_quad_state_list) {}
+MockQuadCuller::MockQuadCuller(RenderPass* external_render_pass)
+ : active_render_pass_(external_render_pass) {
+}
MockQuadCuller::~MockQuadCuller() {}
-SharedQuadState* MockQuadCuller::UseSharedQuadState(
- scoped_ptr<SharedQuadState> shared_quad_state) {
- SharedQuadState* raw_ptr = shared_quad_state.get();
- active_shared_quad_state_list_->push_back(shared_quad_state.Pass());
- return raw_ptr;
+SharedQuadState* MockQuadCuller::CreateSharedQuadState() {
+ return active_render_pass_->CreateAndAppendSharedQuadState();
}
gfx::Rect MockQuadCuller::UnoccludedContentRect(
@@ -63,7 +59,7 @@ gfx::Rect MockQuadCuller::UnoccludedContributingSurfaceContentRect(
void MockQuadCuller::Append(scoped_ptr<DrawQuad> draw_quad) {
DCHECK(!draw_quad->rect.IsEmpty());
DCHECK(!draw_quad->visible_rect.IsEmpty());
- active_quad_list_->push_back(draw_quad.Pass());
+ active_render_pass_->quad_list.push_back(draw_quad.Pass());
}
} // namespace cc
diff --git a/cc/test/mock_quad_culler.h b/cc/test/mock_quad_culler.h
index 6e3436a..195eb5b 100644
--- a/cc/test/mock_quad_culler.h
+++ b/cc/test/mock_quad_culler.h
@@ -17,12 +17,10 @@ class MockQuadCuller : public QuadSink {
MockQuadCuller();
virtual ~MockQuadCuller();
- MockQuadCuller(QuadList* external_quad_list,
- SharedQuadStateList* external_shared_quad_state_list);
+ explicit MockQuadCuller(RenderPass* external_render_pass);
// QuadSink interface.
- virtual SharedQuadState* UseSharedQuadState(
- scoped_ptr<SharedQuadState> shared_quad_state) OVERRIDE;
+ virtual SharedQuadState* CreateSharedQuadState() OVERRIDE;
virtual gfx::Rect UnoccludedContentRect(const gfx::Rect& content_rect,
const gfx::Transform& draw_transform)
OVERRIDE;
@@ -31,9 +29,9 @@ class MockQuadCuller : public QuadSink {
const gfx::Transform& draw_transform) OVERRIDE;
virtual void Append(scoped_ptr<DrawQuad> draw_quad) OVERRIDE;
- const QuadList& quad_list() const { return *active_quad_list_; }
+ const QuadList& quad_list() const { return active_render_pass_->quad_list; }
const SharedQuadStateList& shared_quad_state_list() const {
- return *active_shared_quad_state_list_;
+ return active_render_pass_->shared_quad_state_list;
}
void set_occluded_target_rect(const gfx::Rect& occluded) {
@@ -46,15 +44,13 @@ class MockQuadCuller : public QuadSink {
}
void clear_lists() {
- active_quad_list_->clear();
- active_shared_quad_state_list_->clear();
+ active_render_pass_->quad_list.clear();
+ active_render_pass_->shared_quad_state_list.clear();
}
private:
- QuadList* active_quad_list_;
- QuadList quad_list_storage_;
- SharedQuadStateList* active_shared_quad_state_list_;
- SharedQuadStateList shared_quad_state_storage_;
+ scoped_ptr<RenderPass> render_pass_storage_;
+ RenderPass* active_render_pass_;
gfx::Rect occluded_target_rect_;
gfx::Rect occluded_target_rect_for_contributing_surface_;
};
diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc
index 8d0d955..e70919a 100644
--- a/cc/test/render_pass_test_utils.cc
+++ b/cc/test/render_pass_test_utils.cc
@@ -31,9 +31,8 @@ TestRenderPass* AddRenderPass(RenderPassList* pass_list,
SolidColorDrawQuad* AddQuad(TestRenderPass* pass,
const gfx::Rect& rect,
SkColor color) {
- MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
- SharedQuadState* shared_state =
- quad_sink.UseSharedQuadState(SharedQuadState::Create());
+ MockQuadCuller quad_sink(pass);
+ SharedQuadState* shared_state = quad_sink.CreateSharedQuadState();
shared_state->SetAll(gfx::Transform(),
rect.size(),
rect,
@@ -51,9 +50,8 @@ SolidColorDrawQuad* AddQuad(TestRenderPass* pass,
SolidColorDrawQuad* AddClippedQuad(TestRenderPass* pass,
const gfx::Rect& rect,
SkColor color) {
- MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
- SharedQuadState* shared_state =
- quad_sink.UseSharedQuadState(SharedQuadState::Create());
+ MockQuadCuller quad_sink(pass);
+ SharedQuadState* shared_state = quad_sink.CreateSharedQuadState();
shared_state->SetAll(gfx::Transform(),
rect.size(),
rect,
@@ -72,9 +70,8 @@ SolidColorDrawQuad* AddTransformedQuad(TestRenderPass* pass,
const gfx::Rect& rect,
SkColor color,
const gfx::Transform& transform) {
- MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
- SharedQuadState* shared_state =
- quad_sink.UseSharedQuadState(SharedQuadState::Create());
+ MockQuadCuller quad_sink(pass);
+ SharedQuadState* shared_state = quad_sink.CreateSharedQuadState();
shared_state->SetAll(
transform, rect.size(), rect, rect, false, 1, SkXfermode::kSrcOver_Mode);
scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
@@ -86,11 +83,9 @@ SolidColorDrawQuad* AddTransformedQuad(TestRenderPass* pass,
void AddRenderPassQuad(TestRenderPass* to_pass,
TestRenderPass* contributing_pass) {
- MockQuadCuller quad_sink(&to_pass->quad_list,
- &to_pass->shared_quad_state_list);
+ MockQuadCuller quad_sink(to_pass);
gfx::Rect output_rect = contributing_pass->output_rect;
- SharedQuadState* shared_state =
- quad_sink.UseSharedQuadState(SharedQuadState::Create());
+ SharedQuadState* shared_state = quad_sink.CreateSharedQuadState();
shared_state->SetAll(gfx::Transform(),
output_rect.size(),
output_rect,
@@ -117,11 +112,9 @@ void AddRenderPassQuad(TestRenderPass* to_pass,
ResourceProvider::ResourceId mask_resource_id,
const FilterOperations& filters,
gfx::Transform transform) {
- MockQuadCuller quad_sink(&to_pass->quad_list,
- &to_pass->shared_quad_state_list);
+ MockQuadCuller quad_sink(to_pass);
gfx::Rect output_rect = contributing_pass->output_rect;
- SharedQuadState* shared_state =
- quad_sink.UseSharedQuadState(SharedQuadState::Create());
+ SharedQuadState* shared_state = quad_sink.CreateSharedQuadState();
shared_state->SetAll(transform,
output_rect.size(),
output_rect,
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 9950faa..2d1b217 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -589,10 +589,7 @@ static void AppendQuadsForLayer(
LayerImpl* layer,
const OcclusionTracker<LayerImpl>& occlusion_tracker,
AppendQuadsData* append_quads_data) {
- QuadCuller quad_culler(&target_render_pass->quad_list,
- &target_render_pass->shared_quad_state_list,
- layer,
- occlusion_tracker);
+ QuadCuller quad_culler(target_render_pass, layer, occlusion_tracker);
layer->AppendQuads(&quad_culler, append_quads_data);
}
@@ -602,10 +599,7 @@ static void AppendQuadsForRenderSurfaceLayer(
const RenderPass* contributing_render_pass,
const OcclusionTracker<LayerImpl>& occlusion_tracker,
AppendQuadsData* append_quads_data) {
- QuadCuller quad_culler(&target_render_pass->quad_list,
- &target_render_pass->shared_quad_state_list,
- layer,
- occlusion_tracker);
+ QuadCuller quad_culler(target_render_pass, layer, occlusion_tracker);
bool is_replica = false;
layer->render_surface()->AppendQuads(&quad_culler,
@@ -648,10 +642,7 @@ static void AppendQuadsToFillScreen(
screen_background_color_region.Intersect(root_scroll_layer_rect);
}
- QuadCuller quad_culler(&target_render_pass->quad_list,
- &target_render_pass->shared_quad_state_list,
- root_layer,
- occlusion_tracker);
+ QuadCuller quad_culler(target_render_pass, root_layer, occlusion_tracker);
// Manually create the quad state for the gutter quads, as the root layer
// doesn't have any bounds and so can't generate this itself.
@@ -660,8 +651,7 @@ static void AppendQuadsToFillScreen(
gfx::Rect root_target_rect = root_layer->render_surface()->content_rect();
float opacity = 1.f;
- SharedQuadState* shared_quad_state =
- quad_culler.UseSharedQuadState(SharedQuadState::Create());
+ SharedQuadState* shared_quad_state = quad_culler.CreateSharedQuadState();
shared_quad_state->SetAll(gfx::Transform(),
root_target_rect.size(),
root_target_rect,
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 48053bfc..8f928f7 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -3452,8 +3452,9 @@ class BlendStateCheckLayer : public LayerImpl {
opaque_rect = opaque_content_rect_;
gfx::Rect visible_quad_rect = quad_rect_;
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
+
scoped_ptr<TileDrawQuad> test_blending_draw_quad = TileDrawQuad::Create();
test_blending_draw_quad->SetNew(shared_quad_state,
quad_rect_,
@@ -4233,8 +4234,8 @@ class FakeLayerWithQuads : public LayerImpl {
virtual void AppendQuads(QuadSink* quad_sink,
AppendQuadsData* append_quads_data) OVERRIDE {
- SharedQuadState* shared_quad_state =
- quad_sink->UseSharedQuadState(CreateSharedQuadState());
+ SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState();
+ PopulateSharedQuadState(shared_quad_state);
SkColor gray = SkColorSetRGB(100, 100, 100);
gfx::Rect quad_rect(content_bounds());
diff --git a/cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc b/cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc
index 832eac7..47964fd 100644
--- a/cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc
+++ b/cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc
@@ -41,15 +41,14 @@ class LayerTreeHostOnDemandRasterPixelTest : public LayerTreePixelTest {
PictureLayerImpl* picture_layer = static_cast<PictureLayerImpl*>(
host_impl->active_tree()->root_layer()->child_at(0));
- QuadList quads;
- SharedQuadStateList shared_states;
- MockQuadCuller quad_culler(&quads, &shared_states);
+ scoped_ptr<RenderPass> render_pass = RenderPass::Create();
+ MockQuadCuller quad_culler(render_pass.get());
AppendQuadsData data;
picture_layer->AppendQuads(&quad_culler, &data);
- for (size_t i = 0; i < quads.size(); ++i)
- EXPECT_EQ(quads[i]->material, DrawQuad::PICTURE_CONTENT);
+ for (size_t i = 0; i < render_pass->quad_list.size(); ++i)
+ EXPECT_EQ(render_pass->quad_list[i]->material, DrawQuad::PICTURE_CONTENT);
// Triggers pixel readback and ends the test.
LayerTreePixelTest::SwapBuffersOnThread(host_impl, result);
diff --git a/cc/trees/quad_culler.cc b/cc/trees/quad_culler.cc
index d828675..419a3dd 100644
--- a/cc/trees/quad_culler.cc
+++ b/cc/trees/quad_culler.cc
@@ -16,23 +16,17 @@
namespace cc {
-QuadCuller::QuadCuller(QuadList* quad_list,
- SharedQuadStateList* shared_quad_state_list,
+QuadCuller::QuadCuller(RenderPass* render_pass,
const LayerImpl* layer,
const OcclusionTracker<LayerImpl>& occlusion_tracker)
- : quad_list_(quad_list),
- shared_quad_state_list_(shared_quad_state_list),
+ : render_pass_(render_pass),
layer_(layer),
occlusion_tracker_(occlusion_tracker),
current_shared_quad_state_(NULL) {
}
-SharedQuadState* QuadCuller::UseSharedQuadState(
- scoped_ptr<SharedQuadState> shared_quad_state) {
- // TODO(danakj): If all quads are culled for the shared_quad_state, we can
- // drop it from the list.
- current_shared_quad_state_ = shared_quad_state.get();
- shared_quad_state_list_->push_back(shared_quad_state.Pass());
+SharedQuadState* QuadCuller::CreateSharedQuadState() {
+ current_shared_quad_state_ = render_pass_->CreateAndAppendSharedQuadState();
return current_shared_quad_state_;
}
@@ -52,11 +46,12 @@ gfx::Rect QuadCuller::UnoccludedContributingSurfaceContentRect(
void QuadCuller::Append(scoped_ptr<DrawQuad> draw_quad) {
DCHECK(draw_quad->shared_quad_state == current_shared_quad_state_);
- DCHECK(!shared_quad_state_list_->empty());
- DCHECK(shared_quad_state_list_->back() == current_shared_quad_state_);
+ DCHECK(!render_pass_->shared_quad_state_list.empty());
+ DCHECK(render_pass_->shared_quad_state_list.back() ==
+ current_shared_quad_state_);
DCHECK(!draw_quad->rect.IsEmpty());
DCHECK(!draw_quad->visible_rect.IsEmpty());
- quad_list_->push_back(draw_quad.Pass());
+ render_pass_->quad_list.push_back(draw_quad.Pass());
}
} // namespace cc
diff --git a/cc/trees/quad_culler.h b/cc/trees/quad_culler.h
index 6377b13..1a69cd4 100644
--- a/cc/trees/quad_culler.h
+++ b/cc/trees/quad_culler.h
@@ -7,25 +7,23 @@
#include "cc/base/cc_export.h"
#include "cc/layers/quad_sink.h"
-#include "cc/quads/render_pass.h"
namespace cc {
class LayerImpl;
+class RenderPass;
class RenderSurfaceImpl;
template <typename LayerType>
class OcclusionTracker;
class CC_EXPORT QuadCuller : public QuadSink {
public:
- QuadCuller(QuadList* quad_list,
- SharedQuadStateList* shared_quad_state_list,
+ QuadCuller(RenderPass* render_pass,
const LayerImpl* layer,
const OcclusionTracker<LayerImpl>& occlusion_tracker);
virtual ~QuadCuller() {}
// QuadSink implementation.
- virtual SharedQuadState* UseSharedQuadState(
- scoped_ptr<SharedQuadState> shared_quad_state) OVERRIDE;
+ virtual SharedQuadState* CreateSharedQuadState() OVERRIDE;
virtual gfx::Rect UnoccludedContentRect(const gfx::Rect& content_rect,
const gfx::Transform& draw_transform)
OVERRIDE;
@@ -35,8 +33,7 @@ class CC_EXPORT QuadCuller : public QuadSink {
virtual void Append(scoped_ptr<DrawQuad> draw_quad) OVERRIDE;
private:
- QuadList* quad_list_;
- SharedQuadStateList* shared_quad_state_list_;
+ RenderPass* render_pass_;
const LayerImpl* layer_;
const OcclusionTracker<LayerImpl>& occlusion_tracker_;