diff options
author | weiliangc@chromium.org <weiliangc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-23 05:50:36 +0000 |
---|---|---|
committer | weiliangc@chromium.org <weiliangc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-23 05:50:36 +0000 |
commit | c6707fdbb7ab92a3ded2f6f18542bc77770e9cfc (patch) | |
tree | f48af1cf16e746234a67d19ab3e26772d7fb3ea7 | |
parent | 8ef1b247b6685d8c87e936c4b0427aa464fad464 (diff) | |
download | chromium_src-c6707fdbb7ab92a3ded2f6f18542bc77770e9cfc.zip chromium_src-c6707fdbb7ab92a3ded2f6f18542bc77770e9cfc.tar.gz chromium_src-c6707fdbb7ab92a3ded2f6f18542bc77770e9cfc.tar.bz2 |
Removed QuadSink and MockQuadCuller
Since QuadSink does not provide more functionatility than passing
through to RenderPass and OcclusionTracker, it can be torn down and
removed. Same is for MockQuadCuller.
This CL follows 302603006, 306683002, 309493002.
BUG=344962
TEST=cc_unittests
Review URL: https://codereview.chromium.org/308193003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279050 0039d316-1c4b-4281-b951-d872f2087c98
60 files changed, 388 insertions, 542 deletions
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index d284456..2afc012 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn @@ -170,8 +170,6 @@ component("cc") { "layers/picture_layer.h", "layers/picture_layer_impl.cc", "layers/picture_layer_impl.h", - "layers/quad_sink.h", - "layers/quad_sink.cc", "layers/render_pass_sink.h", "layers/render_surface.cc", "layers/render_surface.h", @@ -566,8 +564,6 @@ source_set("test_support") { "test/layer_tree_test.cc", "test/layer_tree_test.h", "test/mock_occlusion_tracker.h", - "test/mock_quad_culler.cc", - "test/mock_quad_culler.h", "test/ordered_simple_task_runner.cc", "test/ordered_simple_task_runner.h", "test/ordered_texture_map.cc", @@ -197,8 +197,6 @@ 'layers/picture_layer.h', 'layers/picture_layer_impl.cc', 'layers/picture_layer_impl.h', - 'layers/quad_sink.h', - 'layers/quad_sink.cc', 'layers/render_pass_sink.h', 'layers/render_surface.cc', 'layers/render_surface.h', @@ -438,6 +436,8 @@ 'scheduler/scheduler_settings.h', 'scheduler/scheduler_state_machine.cc', 'scheduler/scheduler_state_machine.h', + 'scheduler/time_source.h', + 'test/mock_occlusion_tracker.h', 'trees/blocking_task_runner.cc', 'trees/blocking_task_runner.h', 'trees/damage_tracker.cc', diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp index ce114fd..fa96cd6 100644 --- a/cc/cc_tests.gyp +++ b/cc/cc_tests.gyp @@ -194,8 +194,6 @@ 'test/layer_tree_test.cc', 'test/layer_tree_test.h', 'test/mock_occlusion_tracker.h', - 'test/mock_quad_culler.cc', - 'test/mock_quad_culler.h', 'test/ordered_simple_task_runner.cc', 'test/ordered_simple_task_runner.h', 'test/ordered_texture_map.cc', diff --git a/cc/layers/delegated_renderer_layer_impl.cc b/cc/layers/delegated_renderer_layer_impl.cc index c1cdbbe..89af53a7 100644 --- a/cc/layers/delegated_renderer_layer_impl.cc +++ b/cc/layers/delegated_renderer_layer_impl.cc @@ -11,12 +11,12 @@ #include "base/containers/hash_tables.h" #include "cc/base/math_util.h" #include "cc/layers/append_quads_data.h" -#include "cc/layers/quad_sink.h" #include "cc/layers/render_pass_sink.h" #include "cc/output/delegated_frame_data.h" #include "cc/quads/render_pass_draw_quad.h" #include "cc/quads/solid_color_draw_quad.h" #include "cc/trees/layer_tree_impl.h" +#include "cc/trees/occlusion_tracker.h" namespace cc { @@ -256,9 +256,10 @@ bool DelegatedRendererLayerImpl::WillDraw(DrawMode draw_mode, } void DelegatedRendererLayerImpl::AppendQuads( - QuadSink* quad_sink, + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) { - AppendRainbowDebugBorder(quad_sink, append_quads_data); + AppendRainbowDebugBorder(render_pass, append_quads_data); // This list will be empty after a lost context until a new frame arrives. if (render_passes_in_draw_order_.empty()) @@ -282,8 +283,11 @@ void DelegatedRendererLayerImpl::AppendQuads( // render_target. DCHECK(target_render_pass_id.layer_id == render_target()->id()); - AppendRenderPassQuads( - quad_sink, append_quads_data, root_delegated_render_pass, frame_size); + AppendRenderPassQuads(render_pass, + occlusion_tracker, + append_quads_data, + root_delegated_render_pass, + frame_size); } else { // Verify that the RenderPass we are appending to was created by us. DCHECK(target_render_pass_id.layer_id == id()); @@ -291,18 +295,22 @@ void DelegatedRendererLayerImpl::AppendQuads( int render_pass_index = IdToIndex(target_render_pass_id.index); const RenderPass* delegated_render_pass = render_passes_in_draw_order_[render_pass_index]; - AppendRenderPassQuads( - quad_sink, append_quads_data, delegated_render_pass, frame_size); + AppendRenderPassQuads(render_pass, + occlusion_tracker, + append_quads_data, + delegated_render_pass, + frame_size); } } void DelegatedRendererLayerImpl::AppendRainbowDebugBorder( - QuadSink* quad_sink, + RenderPass* render_pass, AppendQuadsData* append_quads_data) { if (!ShowDebugBorders()) return; - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); SkColor color; @@ -349,7 +357,7 @@ void DelegatedRendererLayerImpl::AppendRainbowDebugBorder( scoped_ptr<SolidColorDrawQuad> top_quad = SolidColorDrawQuad::Create(); top_quad->SetNew( shared_quad_state, top, top, colors[i % kNumColors], false); - quad_sink->Append(top_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(top_quad.PassAs<DrawQuad>()); scoped_ptr<SolidColorDrawQuad> bottom_quad = SolidColorDrawQuad::Create(); bottom_quad->SetNew(shared_quad_state, @@ -357,7 +365,7 @@ void DelegatedRendererLayerImpl::AppendRainbowDebugBorder( bottom, colors[kNumColors - 1 - (i % kNumColors)], false); - quad_sink->Append(bottom_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(bottom_quad.PassAs<DrawQuad>()); } if (!left.IsEmpty()) { scoped_ptr<SolidColorDrawQuad> left_quad = SolidColorDrawQuad::Create(); @@ -366,22 +374,22 @@ void DelegatedRendererLayerImpl::AppendRainbowDebugBorder( left, colors[kNumColors - 1 - (i % kNumColors)], false); - quad_sink->Append(left_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(left_quad.PassAs<DrawQuad>()); scoped_ptr<SolidColorDrawQuad> right_quad = SolidColorDrawQuad::Create(); right_quad->SetNew( shared_quad_state, right, right, colors[i % kNumColors], false); - quad_sink->Append(right_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(right_quad.PassAs<DrawQuad>()); } } } void DelegatedRendererLayerImpl::AppendRenderPassQuads( - QuadSink* quad_sink, + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data, const RenderPass* delegated_render_pass, const gfx::Size& frame_size) const { - const SharedQuadState* delegated_shared_quad_state = NULL; SharedQuadState* output_shared_quad_state = NULL; @@ -390,7 +398,7 @@ 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->CreateSharedQuadState(); + output_shared_quad_state = render_pass->CreateAndAppendSharedQuadState(); output_shared_quad_state->CopyFrom(delegated_shared_quad_state); bool is_root_delegated_render_pass = @@ -427,7 +435,7 @@ void DelegatedRendererLayerImpl::AppendRenderPassQuads( } DCHECK(output_shared_quad_state); - gfx::Rect quad_visible_rect = quad_sink->UnoccludedContentRect( + gfx::Rect quad_visible_rect = occlusion_tracker.UnoccludedContentRect( delegated_quad->visible_rect, output_shared_quad_state->content_to_target_transform); if (quad_visible_rect.IsEmpty()) @@ -460,7 +468,7 @@ void DelegatedRendererLayerImpl::AppendRenderPassQuads( } if (output_quad) - quad_sink->Append(output_quad.Pass()); + render_pass->AppendDrawQuad(output_quad.Pass()); } } diff --git a/cc/layers/delegated_renderer_layer_impl.h b/cc/layers/delegated_renderer_layer_impl.h index 9f7aaf8..8a2bff1 100644 --- a/cc/layers/delegated_renderer_layer_impl.h +++ b/cc/layers/delegated_renderer_layer_impl.h @@ -34,7 +34,8 @@ class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl { virtual void ReleaseResources() OVERRIDE; virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* resource_provider) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; @@ -62,7 +63,7 @@ class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl { private: void ClearChildId(); - void AppendRainbowDebugBorder(QuadSink* quad_sink, + void AppendRainbowDebugBorder(RenderPass* render_pass, AppendQuadsData* append_quads_data); void SetRenderPasses( @@ -76,7 +77,8 @@ class CC_EXPORT DelegatedRendererLayerImpl : public LayerImpl { RenderPass::Id* output_render_pass_id) const; void AppendRenderPassQuads( - QuadSink* quad_sink, + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data, const RenderPass* delegated_render_pass, const gfx::Size& frame_size) const; diff --git a/cc/layers/delegated_renderer_layer_impl_unittest.cc b/cc/layers/delegated_renderer_layer_impl_unittest.cc index 41c301a..93cc6f5 100644 --- a/cc/layers/delegated_renderer_layer_impl_unittest.cc +++ b/cc/layers/delegated_renderer_layer_impl_unittest.cc @@ -5,7 +5,6 @@ #include "cc/layers/delegated_renderer_layer_impl.h" #include "cc/base/scoped_ptr_vector.h" -#include "cc/layers/quad_sink.h" #include "cc/layers/solid_color_layer_impl.h" #include "cc/quads/render_pass_draw_quad.h" #include "cc/quads/solid_color_draw_quad.h" diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc index a8553f2..e11a278 100644 --- a/cc/layers/heads_up_display_layer_impl.cc +++ b/cc/layers/heads_up_display_layer_impl.cc @@ -12,7 +12,6 @@ #include "cc/debug/frame_rate_counter.h" #include "cc/debug/paint_time_counter.h" #include "cc/debug/traced_value.h" -#include "cc/layers/quad_sink.h" #include "cc/output/renderer.h" #include "cc/quads/texture_draw_quad.h" #include "cc/resources/memory_history.h" @@ -105,12 +104,15 @@ bool HeadsUpDisplayLayerImpl::WillDraw(DrawMode draw_mode, return LayerImpl::WillDraw(draw_mode, resource_provider); } -void HeadsUpDisplayLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { +void HeadsUpDisplayLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { if (!hud_resource_->id()) return; - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); gfx::Rect quad_rect(content_bounds()); @@ -133,7 +135,7 @@ void HeadsUpDisplayLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } void HeadsUpDisplayLayerImpl::UpdateHudTexture( @@ -587,7 +589,7 @@ SkRect HeadsUpDisplayLayerImpl::DrawPaintTimeDisplay( void HeadsUpDisplayLayerImpl::DrawDebugRect( SkCanvas* canvas, - SkPaint& paint, + SkPaint* paint, const DebugRect& rect, SkColor stroke_color, SkColor fill_color, @@ -596,14 +598,14 @@ void HeadsUpDisplayLayerImpl::DrawDebugRect( gfx::Rect debug_layer_rect = gfx::ScaleToEnclosingRect( rect.rect, 1.0 / contents_scale_x(), 1.0 / contents_scale_y()); SkIRect sk_rect = RectToSkIRect(debug_layer_rect); - paint.setColor(fill_color); - paint.setStyle(SkPaint::kFill_Style); - canvas->drawIRect(sk_rect, paint); + paint->setColor(fill_color); + paint->setStyle(SkPaint::kFill_Style); + canvas->drawIRect(sk_rect, *paint); - paint.setColor(stroke_color); - paint.setStyle(SkPaint::kStroke_Style); - paint.setStrokeWidth(SkFloatToScalar(stroke_width)); - canvas->drawIRect(sk_rect, paint); + paint->setColor(stroke_color); + paint->setStyle(SkPaint::kStroke_Style); + paint->setStrokeWidth(SkFloatToScalar(stroke_width)); + canvas->drawIRect(sk_rect, *paint); if (label_text.length()) { const int kFontHeight = 12; @@ -723,7 +725,7 @@ void HeadsUpDisplayLayerImpl::DrawDebugRects( } DrawDebugRect(canvas, - paint, + &paint, debug_rects[i], stroke_color, fill_color, @@ -739,7 +741,7 @@ void HeadsUpDisplayLayerImpl::DrawDebugRects( fade_step_--; for (size_t i = 0; i < paint_rects_.size(); ++i) { DrawDebugRect(canvas, - paint, + &paint, paint_rects_[i], DebugColors::PaintRectBorderColor(fade_step_), DebugColors::PaintRectFillColor(fade_step_), diff --git a/cc/layers/heads_up_display_layer_impl.h b/cc/layers/heads_up_display_layer_impl.h index ec51b6e..b5fa355 100644 --- a/cc/layers/heads_up_display_layer_impl.h +++ b/cc/layers/heads_up_display_layer_impl.h @@ -39,7 +39,8 @@ class CC_EXPORT HeadsUpDisplayLayerImpl : public LayerImpl { virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* resource_provider) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; void UpdateHudTexture(DrawMode draw_mode, ResourceProvider* resource_provider); @@ -110,7 +111,7 @@ class CC_EXPORT HeadsUpDisplayLayerImpl : public LayerImpl { int top, int right) const; void DrawDebugRect(SkCanvas* canvas, - SkPaint& paint, + SkPaint* paint, const DebugRect& rect, SkColor stroke_color, SkColor fill_color, diff --git a/cc/layers/heads_up_display_layer_impl_unittest.cc b/cc/layers/heads_up_display_layer_impl_unittest.cc index 2c58e6a..2c057dd 100644 --- a/cc/layers/heads_up_display_layer_impl_unittest.cc +++ b/cc/layers/heads_up_display_layer_impl_unittest.cc @@ -7,7 +7,7 @@ #include "cc/test/fake_impl_proxy.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_output_surface.h" -#include "cc/test/mock_quad_culler.h" +#include "cc/test/mock_occlusion_tracker.h" #include "cc/test/test_shared_bitmap_manager.h" #include "testing/gtest/include/gtest/gtest.h" @@ -19,17 +19,16 @@ void CheckDrawLayer(HeadsUpDisplayLayerImpl* layer, DrawMode draw_mode) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; bool will_draw = layer->WillDraw(draw_mode, resource_provider); if (will_draw) - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); layer->UpdateHudTexture(draw_mode, resource_provider); if (will_draw) layer->DidDraw(resource_provider); size_t expected_quad_list_size = will_draw ? 1 : 0; - EXPECT_EQ(expected_quad_list_size, quad_culler.quad_list().size()); + EXPECT_EQ(expected_quad_list_size, render_pass->quad_list.size()); } TEST(HeadsUpDisplayLayerImplTest, ResourcelessSoftwareDrawAfterResourceLoss) { diff --git a/cc/layers/io_surface_layer_impl.cc b/cc/layers/io_surface_layer_impl.cc index 65fb6b2..8f6c46c 100644 --- a/cc/layers/io_surface_layer_impl.cc +++ b/cc/layers/io_surface_layer_impl.cc @@ -5,11 +5,11 @@ #include "cc/layers/io_surface_layer_impl.h" #include "base/strings/stringprintf.h" -#include "cc/layers/quad_sink.h" #include "cc/output/gl_renderer.h" // For the GLC() macro. #include "cc/output/output_surface.h" #include "cc/quads/io_surface_draw_quad.h" #include "cc/trees/layer_tree_impl.h" +#include "cc/trees/occlusion_tracker.h" #include "gpu/GLES2/gl2extchromium.h" #include "gpu/command_buffer/client/gles2_interface.h" #include "third_party/khronos/GLES2/gl2.h" @@ -64,17 +64,20 @@ bool IOSurfaceLayerImpl::WillDraw(DrawMode draw_mode, return LayerImpl::WillDraw(draw_mode, resource_provider); } -void IOSurfaceLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); +void IOSurfaceLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); AppendDebugBorderQuad( - quad_sink, content_bounds(), shared_quad_state, append_quads_data); + render_pass, content_bounds(), shared_quad_state, append_quads_data); gfx::Rect quad_rect(content_bounds()); gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); - gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect( + gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect( quad_rect, draw_properties().target_space_transform); if (visible_quad_rect.IsEmpty()) return; @@ -87,7 +90,7 @@ void IOSurfaceLayerImpl::AppendQuads(QuadSink* quad_sink, io_surface_size_, io_surface_resource_id_, IOSurfaceDrawQuad::FLIPPED); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } void IOSurfaceLayerImpl::ReleaseResources() { diff --git a/cc/layers/io_surface_layer_impl.h b/cc/layers/io_surface_layer_impl.h index 8ac9a25..ac8142d 100644 --- a/cc/layers/io_surface_layer_impl.h +++ b/cc/layers/io_surface_layer_impl.h @@ -27,7 +27,8 @@ class CC_EXPORT IOSurfaceLayerImpl : public LayerImpl { OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer_tree_impl) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; virtual bool WillDraw(DrawMode draw_mode, diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index fa68275..231f4aa 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc @@ -17,7 +17,6 @@ #include "cc/input/layer_scroll_offset_delegate.h" #include "cc/layers/layer_utils.h" #include "cc/layers/painted_scrollbar_layer_impl.h" -#include "cc/layers/quad_sink.h" #include "cc/output/copy_output_request.h" #include "cc/quads/debug_border_draw_quad.h" #include "cc/trees/layer_tree_host_common.h" @@ -288,14 +287,14 @@ void LayerImpl::GetDebugBorderProperties(SkColor* color, float* width) const { } void LayerImpl::AppendDebugBorderQuad( - QuadSink* quad_sink, + RenderPass* render_pass, const gfx::Size& content_bounds, const SharedQuadState* shared_quad_state, AppendQuadsData* append_quads_data) const { SkColor color; float width; GetDebugBorderProperties(&color, &width); - AppendDebugBorderQuad(quad_sink, + AppendDebugBorderQuad(render_pass, content_bounds, shared_quad_state, append_quads_data, @@ -303,7 +302,7 @@ void LayerImpl::AppendDebugBorderQuad( width); } -void LayerImpl::AppendDebugBorderQuad(QuadSink* quad_sink, +void LayerImpl::AppendDebugBorderQuad(RenderPass* render_pass, const gfx::Size& content_bounds, const SharedQuadState* shared_quad_state, AppendQuadsData* append_quads_data, @@ -318,7 +317,7 @@ void LayerImpl::AppendDebugBorderQuad(QuadSink* quad_sink, DebugBorderDrawQuad::Create(); debug_border_quad->SetNew( shared_quad_state, quad_rect, visible_quad_rect, color, width); - quad_sink->Append(debug_border_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(debug_border_quad.PassAs<DrawQuad>()); } bool LayerImpl::HasDelegatedContent() const { diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index cb18604..6632060 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h @@ -48,7 +48,8 @@ namespace cc { class LayerTreeHostImpl; class LayerTreeImpl; class MicroBenchmarkImpl; -class QuadSink; +template <typename LayerType> +class OcclusionTracker; class Renderer; class ScrollbarAnimationController; class ScrollbarLayerImplBase; @@ -177,7 +178,8 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, // returns true. virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* resource_provider); - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) {} virtual void DidDraw(ResourceProvider* resource_provider); @@ -539,11 +541,11 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, // Get the color and size of the layer's debug border. virtual void GetDebugBorderProperties(SkColor* color, float* width) const; - void AppendDebugBorderQuad(QuadSink* quad_sink, + void AppendDebugBorderQuad(RenderPass* render_pass, const gfx::Size& content_bounds, const SharedQuadState* shared_quad_state, AppendQuadsData* append_quads_data) const; - void AppendDebugBorderQuad(QuadSink* quad_sink, + void AppendDebugBorderQuad(RenderPass* render_pass, const gfx::Size& content_bounds, const SharedQuadState* shared_quad_state, AppendQuadsData* append_quads_data, diff --git a/cc/layers/nine_patch_layer_impl.cc b/cc/layers/nine_patch_layer_impl.cc index 46bd333..86fa415 100644 --- a/cc/layers/nine_patch_layer_impl.cc +++ b/cc/layers/nine_patch_layer_impl.cc @@ -7,9 +7,9 @@ #include "base/strings/stringprintf.h" #include "base/values.h" #include "cc/base/math_util.h" -#include "cc/layers/quad_sink.h" #include "cc/quads/texture_draw_quad.h" #include "cc/trees/layer_tree_impl.h" +#include "cc/trees/occlusion_tracker.h" #include "ui/gfx/rect_f.h" namespace cc { @@ -80,14 +80,17 @@ void NinePatchLayerImpl::CheckGeometryLimitations() { << " image_aperture_ " << image_aperture_.ToString(); } -void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { +void NinePatchLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { CheckGeometryLimitations(); - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); AppendDebugBorderQuad( - quad_sink, content_bounds(), shared_quad_state, append_quads_data); + render_pass, content_bounds(), shared_quad_state, append_quads_data); if (!ui_resource_id_) return; @@ -212,7 +215,7 @@ void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, scoped_ptr<TextureDrawQuad> quad; visible_rect = - quad_sink->UnoccludedContentRect(layer_top_left, draw_transform()); + occlusion_tracker.UnoccludedContentRect(layer_top_left, draw_transform()); if (!visible_rect.IsEmpty()) { quad = TextureDrawQuad::Create(); quad->SetNew(shared_quad_state, @@ -226,11 +229,11 @@ void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } - visible_rect = - quad_sink->UnoccludedContentRect(layer_top_right, draw_transform()); + visible_rect = occlusion_tracker.UnoccludedContentRect(layer_top_right, + draw_transform()); if (!visible_rect.IsEmpty()) { quad = TextureDrawQuad::Create(); quad->SetNew(shared_quad_state, @@ -244,11 +247,11 @@ void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } - visible_rect = - quad_sink->UnoccludedContentRect(layer_bottom_left, draw_transform()); + visible_rect = occlusion_tracker.UnoccludedContentRect(layer_bottom_left, + draw_transform()); if (!visible_rect.IsEmpty()) { quad = TextureDrawQuad::Create(); quad->SetNew(shared_quad_state, @@ -262,11 +265,11 @@ void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } - visible_rect = - quad_sink->UnoccludedContentRect(layer_bottom_right, draw_transform()); + visible_rect = occlusion_tracker.UnoccludedContentRect(layer_bottom_right, + draw_transform()); if (!visible_rect.IsEmpty()) { quad = TextureDrawQuad::Create(); quad->SetNew(shared_quad_state, @@ -280,10 +283,11 @@ void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } - visible_rect = quad_sink->UnoccludedContentRect(layer_top, draw_transform()); + visible_rect = + occlusion_tracker.UnoccludedContentRect(layer_top, draw_transform()); if (!visible_rect.IsEmpty()) { quad = TextureDrawQuad::Create(); quad->SetNew(shared_quad_state, @@ -297,10 +301,11 @@ void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } - visible_rect = quad_sink->UnoccludedContentRect(layer_left, draw_transform()); + visible_rect = + occlusion_tracker.UnoccludedContentRect(layer_left, draw_transform()); if (!visible_rect.IsEmpty()) { quad = TextureDrawQuad::Create(); quad->SetNew(shared_quad_state, @@ -314,11 +319,11 @@ void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } visible_rect = - quad_sink->UnoccludedContentRect(layer_right, draw_transform()); + occlusion_tracker.UnoccludedContentRect(layer_right, draw_transform()); if (!visible_rect.IsEmpty()) { quad = TextureDrawQuad::Create(); quad->SetNew(shared_quad_state, @@ -332,11 +337,11 @@ void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } visible_rect = - quad_sink->UnoccludedContentRect(layer_bottom, draw_transform()); + occlusion_tracker.UnoccludedContentRect(layer_bottom, draw_transform()); if (!visible_rect.IsEmpty()) { quad = TextureDrawQuad::Create(); quad->SetNew(shared_quad_state, @@ -350,12 +355,12 @@ void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } if (fill_center_) { visible_rect = - quad_sink->UnoccludedContentRect(layer_center, draw_transform()); + occlusion_tracker.UnoccludedContentRect(layer_center, draw_transform()); if (!visible_rect.IsEmpty()) { quad = TextureDrawQuad::Create(); quad->SetNew(shared_quad_state, @@ -369,7 +374,7 @@ void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } } } diff --git a/cc/layers/nine_patch_layer_impl.h b/cc/layers/nine_patch_layer_impl.h index fb3e66e..235b182 100644 --- a/cc/layers/nine_patch_layer_impl.h +++ b/cc/layers/nine_patch_layer_impl.h @@ -61,7 +61,8 @@ class CC_EXPORT NinePatchLayerImpl : public UIResourceLayerImpl { OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; virtual base::DictionaryValue* LayerTreeAsJson() const OVERRIDE; diff --git a/cc/layers/nine_patch_layer_impl_unittest.cc b/cc/layers/nine_patch_layer_impl_unittest.cc index b129676..a173ac7 100644 --- a/cc/layers/nine_patch_layer_impl_unittest.cc +++ b/cc/layers/nine_patch_layer_impl_unittest.cc @@ -12,7 +12,6 @@ #include "cc/test/fake_ui_resource_layer_tree_host_impl.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/layer_test_common.h" -#include "cc/test/mock_quad_culler.h" #include "cc/trees/single_thread_proxy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -38,7 +37,6 @@ void NinePatchLayerLayoutTest(const gfx::Size& bitmap_size, size_t expected_quad_size) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); gfx::Rect visible_content_rect(layer_size); gfx::Rect expected_remaining(border.x(), border.y(), @@ -65,10 +63,10 @@ void NinePatchLayerLayoutTest(const gfx::Size& bitmap_size, layer->SetImageBounds(bitmap_size); layer->SetLayout(aperture_rect, border, fill_center); AppendQuadsData data; - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); // Verify quad rects - const QuadList& quads = quad_culler.quad_list(); + const QuadList& quads = render_pass->quad_list; EXPECT_EQ(expected_quad_size, quads.size()); Region remaining(visible_content_rect); diff --git a/cc/layers/painted_scrollbar_layer_impl.cc b/cc/layers/painted_scrollbar_layer_impl.cc index b83419f..1335b32 100644 --- a/cc/layers/painted_scrollbar_layer_impl.cc +++ b/cc/layers/painted_scrollbar_layer_impl.cc @@ -8,11 +8,11 @@ #include "cc/animation/scrollbar_animation_controller.h" #include "cc/layers/layer.h" -#include "cc/layers/quad_sink.h" #include "cc/quads/solid_color_draw_quad.h" #include "cc/quads/texture_draw_quad.h" #include "cc/trees/layer_tree_impl.h" #include "cc/trees/layer_tree_settings.h" +#include "cc/trees/occlusion_tracker.h" #include "ui/gfx/rect_conversions.h" namespace cc { @@ -69,7 +69,8 @@ bool PaintedScrollbarLayerImpl::WillDraw(DrawMode draw_mode, } void PaintedScrollbarLayerImpl::AppendQuads( - QuadSink* quad_sink, + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) { bool premultipled_alpha = true; bool flipped = false; @@ -78,15 +79,16 @@ void PaintedScrollbarLayerImpl::AppendQuads( gfx::Rect bounds_rect(bounds()); gfx::Rect content_bounds_rect(content_bounds()); - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); AppendDebugBorderQuad( - quad_sink, content_bounds(), shared_quad_state, append_quads_data); + render_pass, content_bounds(), shared_quad_state, append_quads_data); gfx::Rect thumb_quad_rect = ComputeThumbQuadRect(); - gfx::Rect visible_thumb_quad_rect = - quad_sink->UnoccludedContentRect(thumb_quad_rect, draw_transform()); + gfx::Rect visible_thumb_quad_rect = occlusion_tracker.UnoccludedContentRect( + thumb_quad_rect, draw_transform()); ResourceProvider::ResourceId thumb_resource_id = layer_tree_impl()->ResourceIdForUIResource(thumb_ui_resource_id_); @@ -108,12 +110,12 @@ void PaintedScrollbarLayerImpl::AppendQuads( SK_ColorTRANSPARENT, opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } gfx::Rect track_quad_rect = content_bounds_rect; - gfx::Rect visible_track_quad_rect = - quad_sink->UnoccludedContentRect(track_quad_rect, draw_transform()); + gfx::Rect visible_track_quad_rect = occlusion_tracker.UnoccludedContentRect( + track_quad_rect, draw_transform()); if (track_resource_id && !visible_track_quad_rect.IsEmpty()) { gfx::Rect opaque_rect(contents_opaque() ? track_quad_rect : gfx::Rect()); const float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; @@ -129,7 +131,7 @@ void PaintedScrollbarLayerImpl::AppendQuads( SK_ColorTRANSPARENT, opacity, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } } diff --git a/cc/layers/painted_scrollbar_layer_impl.h b/cc/layers/painted_scrollbar_layer_impl.h index 16cfa55..4ebefb6 100644 --- a/cc/layers/painted_scrollbar_layer_impl.h +++ b/cc/layers/painted_scrollbar_layer_impl.h @@ -30,7 +30,8 @@ class CC_EXPORT PaintedScrollbarLayerImpl : public ScrollbarLayerImplBase { virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* resource_provider) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; void SetThumbThickness(int thumb_thickness); diff --git a/cc/layers/picture_image_layer_impl_unittest.cc b/cc/layers/picture_image_layer_impl_unittest.cc index e8eb8ff..9dfdf0a 100644 --- a/cc/layers/picture_image_layer_impl_unittest.cc +++ b/cc/layers/picture_image_layer_impl_unittest.cc @@ -5,13 +5,14 @@ #include "cc/layers/picture_image_layer_impl.h" #include "cc/layers/append_quads_data.h" +#include "cc/quads/draw_quad.h" #include "cc/resources/tile_priority.h" #include "cc/test/fake_impl_proxy.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_output_surface.h" #include "cc/test/fake_picture_layer_tiling_client.h" #include "cc/test/impl_side_painting_settings.h" -#include "cc/test/mock_quad_culler.h" +#include "cc/test/mock_occlusion_tracker.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/layer_tree_impl.h" #include "testing/gtest/include/gtest/gtest.h" @@ -148,13 +149,12 @@ TEST_F(PictureImageLayerImplTest, IgnoreIdealContentScale) { gfx::Rect(active_layer->bounds()); MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; active_layer->WillDraw(DRAW_MODE_SOFTWARE, NULL); - active_layer->AppendQuads(&quad_culler, &data); + active_layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); active_layer->DidDraw(NULL); - EXPECT_EQ(DrawQuad::TILED_CONTENT, quad_culler.quad_list()[0]->material); + EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list[0]->material); // Tiles are ready at correct scale, so should not set had_incomplete_tile. EXPECT_FALSE(data.had_incomplete_tile); diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index 624b90a..b058e2b 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc @@ -14,7 +14,6 @@ #include "cc/debug/micro_benchmark_impl.h" #include "cc/debug/traced_value.h" #include "cc/layers/append_quads_data.h" -#include "cc/layers/quad_sink.h" #include "cc/quads/checkerboard_draw_quad.h" #include "cc/quads/debug_border_draw_quad.h" #include "cc/quads/picture_draw_quad.h" @@ -22,6 +21,7 @@ #include "cc/quads/tile_draw_quad.h" #include "cc/resources/tile_manager.h" #include "cc/trees/layer_tree_impl.h" +#include "cc/trees/occlusion_tracker.h" #include "ui/gfx/quad_f.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/size_conversions.h" @@ -135,8 +135,10 @@ void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { needs_push_properties_ = true; } -void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { +void PictureLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { DCHECK(!needs_post_commit_initialization_); float max_contents_scale = MaximumTilingContentsScale(); @@ -150,7 +152,9 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, gfx::ScaleToEnclosingRect(visible_content_rect(), max_contents_scale); scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds)); - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); + PopulateSharedQuadState(shared_quad_state); shared_quad_state->SetAll(scaled_draw_transform, scaled_content_bounds, scaled_visible_content_rect, @@ -164,7 +168,7 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { AppendDebugBorderQuad( - quad_sink, + render_pass, scaled_content_bounds, shared_quad_state, append_quads_data, @@ -173,8 +177,8 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, gfx::Rect geometry_rect = rect; gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); - gfx::Rect visible_geometry_rect = - quad_sink->UnoccludedContentRect(geometry_rect, draw_transform()); + gfx::Rect visible_geometry_rect = occlusion_tracker.UnoccludedContentRect( + geometry_rect, draw_transform()); if (visible_geometry_rect.IsEmpty()) return; @@ -193,13 +197,13 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, quad_content_rect, max_contents_scale, pile_); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); append_quads_data->num_missing_tiles++; return; } AppendDebugBorderQuad( - quad_sink, scaled_content_bounds, shared_quad_state, append_quads_data); + render_pass, scaled_content_bounds, shared_quad_state, append_quads_data); if (ShowDebugBorders()) { for (PictureLayerTilingSet::CoverageIterator iter( @@ -244,7 +248,7 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, visible_geometry_rect, color, width); - quad_sink->Append(debug_border_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(debug_border_quad.PassAs<DrawQuad>()); } } @@ -259,8 +263,8 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, iter; ++iter) { gfx::Rect geometry_rect = iter.geometry_rect(); - gfx::Rect visible_geometry_rect = - quad_sink->UnoccludedContentRect(geometry_rect, draw_transform()); + gfx::Rect visible_geometry_rect = occlusion_tracker.UnoccludedContentRect( + geometry_rect, draw_transform()); if (visible_geometry_rect.IsEmpty()) continue; @@ -341,7 +345,7 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, SkColor color = DebugColors::DefaultCheckerboardColor(); quad->SetNew( shared_quad_state, geometry_rect, visible_geometry_rect, color); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } else { SkColor color = SafeOpaqueBackgroundColor(); scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); @@ -350,7 +354,7 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, visible_geometry_rect, color, false); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } append_quads_data->num_missing_tiles++; @@ -361,7 +365,7 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, continue; } - quad_sink->Append(draw_quad.Pass()); + render_pass->AppendDrawQuad(draw_quad.Pass()); if (iter->priority(ACTIVE_TREE).resolution != HIGH_RESOLUTION) { append_quads_data->approximated_visible_content_area += diff --git a/cc/layers/picture_layer_impl.h b/cc/layers/picture_layer_impl.h index 6b1703e..b9db60f 100644 --- a/cc/layers/picture_layer_impl.h +++ b/cc/layers/picture_layer_impl.h @@ -20,7 +20,6 @@ namespace cc { struct AppendQuadsData; -class QuadSink; class MicroBenchmarkImpl; class Tile; @@ -89,7 +88,8 @@ class CC_EXPORT PictureLayerImpl virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; virtual void UpdateTiles() OVERRIDE; virtual void NotifyTileStateChanged(const Tile* tile) OVERRIDE; diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index bb61f4e4..97ebf54 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc @@ -11,6 +11,7 @@ #include "cc/layers/append_quads_data.h" #include "cc/layers/picture_layer.h" +#include "cc/quads/draw_quad.h" #include "cc/test/fake_content_layer_client.h" #include "cc/test/fake_impl_proxy.h" #include "cc/test/fake_layer_tree_host_impl.h" @@ -20,7 +21,6 @@ #include "cc/test/geometry_test_utils.h" #include "cc/test/impl_side_painting_settings.h" #include "cc/test/layer_test_common.h" -#include "cc/test/mock_quad_culler.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/test/test_web_graphics_context_3d.h" #include "cc/trees/layer_tree_impl.h" @@ -1212,7 +1212,6 @@ TEST_F(PictureLayerImplTest, ClampSingleTileToToMaxTileSize) { TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); gfx::Size tile_size(400, 400); gfx::Size layer_bounds(1300, 1900); @@ -1233,11 +1232,11 @@ TEST_F(PictureLayerImplTest, DisallowTileDrawQuads) { AppendQuadsData data; active_layer_->WillDraw(DRAW_MODE_RESOURCELESS_SOFTWARE, NULL); - active_layer_->AppendQuads(&quad_culler, &data); + active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); active_layer_->DidDraw(NULL); - ASSERT_EQ(1U, quad_culler.quad_list().size()); - EXPECT_EQ(DrawQuad::PICTURE_CONTENT, quad_culler.quad_list()[0]->material); + ASSERT_EQ(1U, render_pass->quad_list.size()); + EXPECT_EQ(DrawQuad::PICTURE_CONTENT, render_pass->quad_list[0]->material); } TEST_F(PictureLayerImplTest, MarkRequiredNullTiles) { @@ -2719,7 +2718,6 @@ TEST_F(NoLowResPictureLayerImplTest, ReleaseResources) { TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); gfx::Size tile_size(400, 400); gfx::Size layer_bounds(1000, 2000); @@ -2744,24 +2742,24 @@ TEST_F(PictureLayerImplTest, SharedQuadStateContainsMaxTilingScale) { SK_MScalar1 / max_contents_scale); AppendQuadsData data; - active_layer_->AppendQuads(&quad_culler, &data); + active_layer_->AppendQuads(render_pass.get(), occlusion_tracker, &data); // SharedQuadState should have be of size 1, as we are doing AppenQuad once. - EXPECT_EQ(1u, quad_culler.shared_quad_state_list().size()); + EXPECT_EQ(1u, render_pass->shared_quad_state_list.size()); // The content_to_target_transform should be scaled by the // MaximumTilingContentsScale on the layer. EXPECT_EQ(scaled_draw_transform.ToString(), - quad_culler.shared_quad_state_list()[0] + render_pass->shared_quad_state_list[0] ->content_to_target_transform.ToString()); // The content_bounds should be scaled by the // MaximumTilingContentsScale on the layer. EXPECT_EQ(gfx::Size(2500u, 5000u).ToString(), - quad_culler.shared_quad_state_list()[0]->content_bounds.ToString()); + render_pass->shared_quad_state_list[0]->content_bounds.ToString()); // The visible_content_rect should be scaled by the // MaximumTilingContentsScale on the layer. EXPECT_EQ( gfx::Rect(0u, 0u, 2500u, 5000u).ToString(), - quad_culler.shared_quad_state_list()[0]->visible_content_rect.ToString()); + render_pass->shared_quad_state_list[0]->visible_content_rect.ToString()); } TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) { diff --git a/cc/layers/quad_sink.cc b/cc/layers/quad_sink.cc deleted file mode 100644 index 23758af..0000000 --- a/cc/layers/quad_sink.cc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/layers/quad_sink.h" - -#include "cc/debug/debug_colors.h" -#include "cc/layers/append_quads_data.h" -#include "cc/layers/layer_impl.h" -#include "cc/quads/debug_border_draw_quad.h" -#include "cc/quads/render_pass.h" -#include "cc/quads/render_pass_draw_quad.h" -#include "cc/trees/occlusion_tracker.h" -#include "third_party/skia/include/core/SkColor.h" -#include "ui/gfx/transform.h" - -namespace cc { - -QuadSink::QuadSink(RenderPass* render_pass, - const OcclusionTracker<LayerImpl>* occlusion_tracker) - : render_pass_(render_pass), - current_shared_quad_state_(NULL), - occlusion_tracker_(occlusion_tracker) { -} - -SharedQuadState* QuadSink::CreateSharedQuadState() { - current_shared_quad_state_ = render_pass_->CreateAndAppendSharedQuadState(); - return current_shared_quad_state_; -} - -gfx::Rect QuadSink::UnoccludedContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform) { - return occlusion_tracker_->UnoccludedContentRect(content_rect, - draw_transform); -} - -gfx::Rect QuadSink::UnoccludedContributingSurfaceContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform) { - return occlusion_tracker_->UnoccludedContributingSurfaceContentRect( - content_rect, draw_transform); -} - -void QuadSink::Append(scoped_ptr<DrawQuad> draw_quad) { - DCHECK(draw_quad->shared_quad_state == 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()); - render_pass_->quad_list.push_back(draw_quad.Pass()); -} - -} // namespace cc diff --git a/cc/layers/quad_sink.h b/cc/layers/quad_sink.h deleted file mode 100644 index c033bfb..0000000 --- a/cc/layers/quad_sink.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_LAYERS_QUAD_SINK_H_ -#define CC_LAYERS_QUAD_SINK_H_ - -#include "base/memory/scoped_ptr.h" -#include "cc/base/cc_export.h" - -namespace gfx { -class Rect; -class Transform; -} - -namespace cc { - -class DrawQuad; -class LayerImpl; -class RenderPass; -class RenderSurfaceImpl; -class SharedQuadState; -template <typename LayerType> -class OcclusionTracker; - -class CC_EXPORT QuadSink { - public: - QuadSink(RenderPass* render_pass, - const OcclusionTracker<LayerImpl>* occlusion_tracker); - ~QuadSink() {} - - // Call this to add a SharedQuadState before appending quads that refer to it. - // Returns a pointer to the given SharedQuadState, that can be set on the - // quads to append. - virtual SharedQuadState* CreateSharedQuadState(); - - virtual gfx::Rect UnoccludedContentRect(const gfx::Rect& content_rect, - const gfx::Transform& draw_transform); - - virtual gfx::Rect UnoccludedContributingSurfaceContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform); - - virtual void Append(scoped_ptr<DrawQuad> draw_quad); - - protected: - RenderPass* render_pass_; - - SharedQuadState* current_shared_quad_state_; - - private: - const OcclusionTracker<LayerImpl>* occlusion_tracker_; - - DISALLOW_COPY_AND_ASSIGN(QuadSink); -}; - -} // namespace cc - -#endif // CC_LAYERS_QUAD_SINK_H_ diff --git a/cc/layers/render_surface_impl.cc b/cc/layers/render_surface_impl.cc index af8c41a..0133b38 100644 --- a/cc/layers/render_surface_impl.cc +++ b/cc/layers/render_surface_impl.cc @@ -12,13 +12,13 @@ #include "cc/debug/debug_colors.h" #include "cc/layers/delegated_renderer_layer_impl.h" #include "cc/layers/layer_impl.h" -#include "cc/layers/quad_sink.h" #include "cc/layers/render_pass_sink.h" #include "cc/quads/debug_border_draw_quad.h" #include "cc/quads/render_pass.h" #include "cc/quads/render_pass_draw_quad.h" #include "cc/quads/shared_quad_state.h" #include "cc/trees/damage_tracker.h" +#include "cc/trees/occlusion_tracker.h" #include "third_party/skia/include/core/SkImageFilter.h" #include "ui/gfx/rect_conversions.h" #include "ui/gfx/transform.h" @@ -136,21 +136,24 @@ void RenderSurfaceImpl::AppendRenderPasses(RenderPassSink* pass_sink) { pass_sink->AppendRenderPass(pass.Pass()); } -void RenderSurfaceImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data, - bool for_replica, - RenderPass::Id render_pass_id) { +void RenderSurfaceImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data, + bool for_replica, + RenderPass::Id render_pass_id) { DCHECK(!for_replica || owning_layer_->has_replica()); const gfx::Transform& draw_transform = for_replica ? replica_draw_transform_ : draw_transform_; gfx::Rect visible_content_rect = - quad_sink->UnoccludedContributingSurfaceContentRect(content_rect_, - draw_transform); + occlusion_tracker.UnoccludedContributingSurfaceContentRect( + content_rect_, draw_transform); if (visible_content_rect.IsEmpty()) return; - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); shared_quad_state->SetAll(draw_transform, content_rect_.size(), content_rect_, @@ -173,7 +176,7 @@ void RenderSurfaceImpl::AppendQuads(QuadSink* quad_sink, DebugBorderDrawQuad::Create(); debug_border_quad->SetNew( shared_quad_state, content_rect_, visible_content_rect, color, width); - quad_sink->Append(debug_border_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(debug_border_quad.PassAs<DrawQuad>()); } // TODO(shawnsingh): By using the same RenderSurfaceImpl for both the content @@ -233,7 +236,7 @@ void RenderSurfaceImpl::AppendQuads(QuadSink* quad_sink, mask_uv_rect, owning_layer_->filters(), owning_layer_->background_filters()); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } } // namespace cc diff --git a/cc/layers/render_surface_impl.h b/cc/layers/render_surface_impl.h index 8cbc4fe..6f7df69 100644 --- a/cc/layers/render_surface_impl.h +++ b/cc/layers/render_surface_impl.h @@ -22,7 +22,8 @@ namespace cc { class DamageTracker; class DelegatedRendererLayerImpl; -class QuadSink; +template <typename LayerType> +class OcclusionTracker; class RenderPassSink; class LayerImpl; template <typename LayerType> @@ -135,7 +136,8 @@ class CC_EXPORT RenderSurfaceImpl { RenderPass::Id RenderPassId(); void AppendRenderPasses(RenderPassSink* pass_sink); - void AppendQuads(QuadSink* quad_sink, + void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data, bool for_replica, RenderPass::Id render_pass_id); diff --git a/cc/layers/render_surface_unittest.cc b/cc/layers/render_surface_unittest.cc index 62c88bcc7..fc259b8 100644 --- a/cc/layers/render_surface_unittest.cc +++ b/cc/layers/render_surface_unittest.cc @@ -11,7 +11,7 @@ #include "cc/test/fake_impl_proxy.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/geometry_test_utils.h" -#include "cc/test/mock_quad_culler.h" +#include "cc/test/mock_occlusion_tracker.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/single_thread_proxy.h" #include "testing/gmock/include/gmock/gmock.h" @@ -109,12 +109,14 @@ TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectSharedQuadState) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller mock_quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData append_quads_data; bool for_replica = false; - render_surface->AppendQuads( - &mock_quad_culler, &append_quads_data, for_replica, RenderPass::Id(2, 0)); + render_surface->AppendQuads(render_pass.get(), + occlusion_tracker, + &append_quads_data, + for_replica, + RenderPass::Id(2, 0)); ASSERT_EQ(1u, render_pass->shared_quad_state_list.size()); SharedQuadState* shared_quad_state = render_pass->shared_quad_state_list[0]; diff --git a/cc/layers/scrollbar_layer_unittest.cc b/cc/layers/scrollbar_layer_unittest.cc index 2d00e01..e7a477b 100644 --- a/cc/layers/scrollbar_layer_unittest.cc +++ b/cc/layers/scrollbar_layer_unittest.cc @@ -20,7 +20,7 @@ #include "cc/test/fake_scrollbar.h" #include "cc/test/geometry_test_utils.h" #include "cc/test/layer_tree_test.h" -#include "cc/test/mock_quad_culler.h" +#include "cc/test/mock_occlusion_tracker.h" #include "cc/test/test_web_graphics_context_3d.h" #include "cc/trees/layer_tree_host.h" #include "cc/trees/layer_tree_impl.h" @@ -296,11 +296,11 @@ TEST(ScrollbarLayerTest, SolidColorDrawQuads) { { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - scrollbar_layer_impl->AppendQuads(&quad_culler, &data); + scrollbar_layer_impl->AppendQuads( + render_pass.get(), occlusion_tracker, &data); - const QuadList& quads = quad_culler.quad_list(); + const QuadList& quads = render_pass->quad_list; ASSERT_EQ(1u, quads.size()); EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); EXPECT_RECT_EQ(gfx::Rect(6, 0, 40, 3), quads[0]->rect); @@ -312,11 +312,11 @@ TEST(ScrollbarLayerTest, SolidColorDrawQuads) { { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - scrollbar_layer_impl->AppendQuads(&quad_culler, &data); + scrollbar_layer_impl->AppendQuads( + render_pass.get(), occlusion_tracker, &data); - const QuadList& quads = quad_culler.quad_list(); + const QuadList& quads = render_pass->quad_list; ASSERT_EQ(1u, quads.size()); EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); EXPECT_RECT_EQ(gfx::Rect(12, 0, 80, 6), quads[0]->rect); @@ -330,11 +330,11 @@ TEST(ScrollbarLayerTest, SolidColorDrawQuads) { { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - scrollbar_layer_impl->AppendQuads(&quad_culler, &data); + scrollbar_layer_impl->AppendQuads( + render_pass.get(), occlusion_tracker, &data); - const QuadList& quads = quad_culler.quad_list(); + const QuadList& quads = render_pass->quad_list; ASSERT_EQ(1u, quads.size()); EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); EXPECT_RECT_EQ(gfx::Rect(8, 0, 20, 3), quads[0]->rect); @@ -389,12 +389,12 @@ TEST(ScrollbarLayerTest, LayerDrivenSolidColorDrawQuads) { { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - scrollbar_layer_impl->AppendQuads(&quad_culler, &data); + scrollbar_layer_impl->AppendQuads( + render_pass.get(), occlusion_tracker, &data); - const QuadList& quads = quad_culler.quad_list(); + const QuadList& quads = render_pass->quad_list; ASSERT_EQ(1u, quads.size()); EXPECT_EQ(DrawQuad::SOLID_COLOR, quads[0]->material); EXPECT_RECT_EQ(gfx::Rect(3, 0, 3, 3), quads[0]->rect); diff --git a/cc/layers/solid_color_layer_impl.cc b/cc/layers/solid_color_layer_impl.cc index 1f44b38..4f0d6db 100644 --- a/cc/layers/solid_color_layer_impl.cc +++ b/cc/layers/solid_color_layer_impl.cc @@ -6,8 +6,8 @@ #include <algorithm> -#include "cc/layers/quad_sink.h" #include "cc/quads/solid_color_draw_quad.h" +#include "cc/trees/occlusion_tracker.h" namespace cc { @@ -22,13 +22,16 @@ scoped_ptr<LayerImpl> SolidColorLayerImpl::CreateLayerImpl( return SolidColorLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); } -void SolidColorLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); +void SolidColorLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); AppendDebugBorderQuad( - quad_sink, content_bounds(), shared_quad_state, append_quads_data); + render_pass, content_bounds(), shared_quad_state, append_quads_data); // We create a series of smaller quads instead of just one large one so that // the culler can reduce the total pixels drawn. @@ -40,7 +43,7 @@ void SolidColorLayerImpl::AppendQuads(QuadSink* quad_sink, y, std::min(width - x, tile_size_), std::min(height - y, tile_size_)); - gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect( + gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect( quad_rect, draw_properties().target_space_transform); if (visible_quad_rect.IsEmpty()) continue; @@ -51,7 +54,7 @@ void SolidColorLayerImpl::AppendQuads(QuadSink* quad_sink, visible_quad_rect, background_color(), false); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } } } diff --git a/cc/layers/solid_color_layer_impl.h b/cc/layers/solid_color_layer_impl.h index d83c7b0..97d40db 100644 --- a/cc/layers/solid_color_layer_impl.h +++ b/cc/layers/solid_color_layer_impl.h @@ -22,7 +22,8 @@ class CC_EXPORT SolidColorLayerImpl : public LayerImpl { // LayerImpl overrides. virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; protected: diff --git a/cc/layers/solid_color_layer_impl_unittest.cc b/cc/layers/solid_color_layer_impl_unittest.cc index b01c343..e82fa5d 100644 --- a/cc/layers/solid_color_layer_impl_unittest.cc +++ b/cc/layers/solid_color_layer_impl_unittest.cc @@ -12,7 +12,6 @@ #include "cc/test/fake_impl_proxy.h" #include "cc/test/fake_layer_tree_host.h" #include "cc/test/layer_test_common.h" -#include "cc/test/mock_quad_culler.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/single_thread_proxy.h" #include "testing/gmock/include/gmock/gmock.h" @@ -24,7 +23,6 @@ namespace { TEST(SolidColorLayerImplTest, VerifyTilingCompleteAndNoOverlap) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); gfx::Size layer_size = gfx::Size(800, 600); gfx::Rect visible_content_rect = gfx::Rect(layer_size); @@ -41,9 +39,9 @@ TEST(SolidColorLayerImplTest, VerifyTilingCompleteAndNoOverlap) { layer->draw_properties().render_target = layer.get(); AppendQuadsData data; - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); - LayerTestCommon::VerifyQuadsExactlyCoverRect(quad_culler.quad_list(), + LayerTestCommon::VerifyQuadsExactlyCoverRect(render_pass->quad_list, visible_content_rect); } @@ -52,7 +50,6 @@ TEST(SolidColorLayerImplTest, VerifyCorrectBackgroundColorInQuad) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); gfx::Size layer_size = gfx::Size(100, 100); gfx::Rect visible_content_rect = gfx::Rect(layer_size); @@ -70,10 +67,10 @@ TEST(SolidColorLayerImplTest, VerifyCorrectBackgroundColorInQuad) { layer->draw_properties().render_target = layer.get(); AppendQuadsData data; - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); - ASSERT_EQ(quad_culler.quad_list().size(), 1U); - EXPECT_EQ(SolidColorDrawQuad::MaterialCast(quad_culler.quad_list()[0])->color, + ASSERT_EQ(render_pass->quad_list.size(), 1U); + EXPECT_EQ(SolidColorDrawQuad::MaterialCast(render_pass->quad_list[0])->color, test_color); } @@ -82,7 +79,6 @@ TEST(SolidColorLayerImplTest, VerifyCorrectOpacityInQuad) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); gfx::Size layer_size = gfx::Size(100, 100); gfx::Rect visible_content_rect = gfx::Rect(layer_size); @@ -100,12 +96,12 @@ TEST(SolidColorLayerImplTest, VerifyCorrectOpacityInQuad) { layer->draw_properties().render_target = layer.get(); AppendQuadsData data; - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); - ASSERT_EQ(quad_culler.quad_list().size(), 1U); - EXPECT_EQ(opacity, - SolidColorDrawQuad::MaterialCast(quad_culler.quad_list()[0]) - ->opacity()); + ASSERT_EQ(render_pass->quad_list.size(), 1U); + EXPECT_EQ( + opacity, + SolidColorDrawQuad::MaterialCast(render_pass->quad_list[0])->opacity()); } TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { @@ -145,14 +141,13 @@ TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - layer_impl->AppendQuads(&quad_culler, &data); + layer_impl->AppendQuads(render_pass.get(), occlusion_tracker, &data); - ASSERT_EQ(quad_culler.quad_list().size(), 1U); + ASSERT_EQ(render_pass->quad_list.size(), 1U); EXPECT_EQ(visible_content_rect.ToString(), - quad_culler.quad_list()[0]->opaque_rect.ToString()); + render_pass->quad_list[0]->opaque_rect.ToString()); } EXPECT_TRUE(layer->contents_opaque()); @@ -173,14 +168,13 @@ TEST(SolidColorLayerImplTest, VerifyOpaqueRect) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - layer_impl->AppendQuads(&quad_culler, &data); + layer_impl->AppendQuads(render_pass.get(), occlusion_tracker, &data); - ASSERT_EQ(quad_culler.quad_list().size(), 1U); + ASSERT_EQ(render_pass->quad_list.size(), 1U); EXPECT_EQ(gfx::Rect().ToString(), - quad_culler.quad_list()[0]->opaque_rect.ToString()); + render_pass->quad_list[0]->opaque_rect.ToString()); } } diff --git a/cc/layers/solid_color_scrollbar_layer_impl.cc b/cc/layers/solid_color_scrollbar_layer_impl.cc index 1e255ab..e618094 100644 --- a/cc/layers/solid_color_scrollbar_layer_impl.cc +++ b/cc/layers/solid_color_scrollbar_layer_impl.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "cc/layers/quad_sink.h" #include "cc/layers/solid_color_scrollbar_layer_impl.h" #include "cc/quads/solid_color_draw_quad.h" #include "cc/trees/layer_tree_impl.h" #include "cc/trees/layer_tree_settings.h" +#include "cc/trees/occlusion_tracker.h" namespace cc { @@ -94,16 +94,19 @@ bool SolidColorScrollbarLayerImpl::IsThumbResizable() const { return true; } -void SolidColorScrollbarLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); +void SolidColorScrollbarLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); AppendDebugBorderQuad( - quad_sink, content_bounds(), shared_quad_state, append_quads_data); + render_pass, content_bounds(), shared_quad_state, append_quads_data); gfx::Rect thumb_quad_rect(ComputeThumbQuadRect()); - gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect( + gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect( thumb_quad_rect, draw_properties().target_space_transform); if (visible_quad_rect.IsEmpty()) return; @@ -111,7 +114,7 @@ void SolidColorScrollbarLayerImpl::AppendQuads(QuadSink* quad_sink, scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); quad->SetNew( shared_quad_state, thumb_quad_rect, visible_quad_rect, color_, false); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } } // namespace cc diff --git a/cc/layers/solid_color_scrollbar_layer_impl.h b/cc/layers/solid_color_scrollbar_layer_impl.h index 4cea04b..91f1ac3 100644 --- a/cc/layers/solid_color_scrollbar_layer_impl.h +++ b/cc/layers/solid_color_scrollbar_layer_impl.h @@ -27,10 +27,10 @@ class CC_EXPORT SolidColorScrollbarLayerImpl : public ScrollbarLayerImplBase { OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; - protected: SolidColorScrollbarLayerImpl(LayerTreeImpl* tree_impl, int id, diff --git a/cc/layers/surface_layer_impl.cc b/cc/layers/surface_layer_impl.cc index 6891c14..6ef2431 100644 --- a/cc/layers/surface_layer_impl.cc +++ b/cc/layers/surface_layer_impl.cc @@ -5,8 +5,8 @@ #include "cc/layers/surface_layer_impl.h" #include "cc/debug/debug_colors.h" -#include "cc/layers/quad_sink.h" #include "cc/quads/surface_draw_quad.h" +#include "cc/trees/occlusion_tracker.h" namespace cc { @@ -36,25 +36,28 @@ void SurfaceLayerImpl::PushPropertiesTo(LayerImpl* layer) { layer_impl->SetSurfaceId(surface_id_); } -void SurfaceLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); +void SurfaceLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); AppendDebugBorderQuad( - quad_sink, content_bounds(), shared_quad_state, append_quads_data); + render_pass, content_bounds(), shared_quad_state, append_quads_data); if (surface_id_.is_null()) return; scoped_ptr<SurfaceDrawQuad> quad = SurfaceDrawQuad::Create(); gfx::Rect quad_rect(content_bounds()); - gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect( + gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect( quad_rect, draw_properties().target_space_transform); if (visible_quad_rect.IsEmpty()) return; quad->SetNew(shared_quad_state, quad_rect, visible_quad_rect, surface_id_); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } void SurfaceLayerImpl::GetDebugBorderProperties(SkColor* color, diff --git a/cc/layers/surface_layer_impl.h b/cc/layers/surface_layer_impl.h index 82ac227..65120aa 100644 --- a/cc/layers/surface_layer_impl.h +++ b/cc/layers/surface_layer_impl.h @@ -25,7 +25,8 @@ class CC_EXPORT SurfaceLayerImpl : public LayerImpl { virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; protected: diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc index abbab25..d29b23b 100644 --- a/cc/layers/texture_layer_impl.cc +++ b/cc/layers/texture_layer_impl.cc @@ -7,13 +7,13 @@ #include <vector> #include "base/strings/stringprintf.h" -#include "cc/layers/quad_sink.h" #include "cc/output/renderer.h" #include "cc/quads/texture_draw_quad.h" #include "cc/resources/platform_color.h" #include "cc/resources/scoped_resource.h" #include "cc/resources/single_release_callback.h" #include "cc/trees/layer_tree_impl.h" +#include "cc/trees/occlusion_tracker.h" namespace cc { @@ -139,15 +139,18 @@ bool TextureLayerImpl::WillDraw(DrawMode draw_mode, LayerImpl::WillDraw(draw_mode, resource_provider); } -void TextureLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { +void TextureLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { DCHECK(external_texture_resource_ || valid_texture_copy_); - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); AppendDebugBorderQuad( - quad_sink, content_bounds(), shared_quad_state, append_quads_data); + render_pass, content_bounds(), shared_quad_state, append_quads_data); SkColor bg_color = blend_background_color_ ? background_color() : SK_ColorTRANSPARENT; @@ -155,7 +158,7 @@ void TextureLayerImpl::AppendQuads(QuadSink* quad_sink, gfx::Rect quad_rect(content_bounds()); gfx::Rect opaque_rect = opaque ? quad_rect : gfx::Rect(); - gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect( + gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect( quad_rect, draw_properties().target_space_transform); if (visible_quad_rect.IsEmpty()) return; @@ -174,7 +177,7 @@ void TextureLayerImpl::AppendQuads(QuadSink* quad_sink, bg_color, vertex_opacity_, flipped_); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } Region TextureLayerImpl::VisibleContentOpaqueRegion() const { diff --git a/cc/layers/texture_layer_impl.h b/cc/layers/texture_layer_impl.h index 82eec95..f27fe48 100644 --- a/cc/layers/texture_layer_impl.h +++ b/cc/layers/texture_layer_impl.h @@ -28,7 +28,8 @@ class CC_EXPORT TextureLayerImpl : public LayerImpl { virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* resource_provider) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; virtual Region VisibleContentOpaqueRegion() const OVERRIDE; virtual void ReleaseResources() OVERRIDE; diff --git a/cc/layers/tiled_layer_impl.cc b/cc/layers/tiled_layer_impl.cc index 6aacd1e..f02c9e5 100644 --- a/cc/layers/tiled_layer_impl.cc +++ b/cc/layers/tiled_layer_impl.cc @@ -9,12 +9,12 @@ #include "cc/base/math_util.h" #include "cc/debug/debug_colors.h" #include "cc/layers/append_quads_data.h" -#include "cc/layers/quad_sink.h" #include "cc/quads/checkerboard_draw_quad.h" #include "cc/quads/debug_border_draw_quad.h" #include "cc/quads/solid_color_draw_quad.h" #include "cc/quads/tile_draw_quad.h" #include "cc/resources/layer_tiling_data.h" +#include "cc/trees/occlusion_tracker.h" #include "third_party/khronos/GLES2/gl2.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/quad_f.h" @@ -151,18 +151,21 @@ bool TiledLayerImpl::WillDraw(DrawMode draw_mode, return LayerImpl::WillDraw(draw_mode, resource_provider); } -void TiledLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { +void TiledLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { DCHECK(tiler_); DCHECK(!tiler_->has_empty_bounds()); DCHECK(!visible_content_rect().IsEmpty()); gfx::Rect content_rect = visible_content_rect(); - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); AppendDebugBorderQuad( - quad_sink, content_bounds(), shared_quad_state, append_quads_data); + render_pass, content_bounds(), shared_quad_state, append_quads_data); int left, top, right, bottom; tiler_->ContentRectToTileIndices(content_rect, &left, &top, &right, &bottom); @@ -190,7 +193,7 @@ void TiledLayerImpl::AppendQuads(QuadSink* quad_sink, visible_tile_rect, border_color, border_width); - quad_sink->Append(debug_border_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(debug_border_quad.PassAs<DrawQuad>()); } } } @@ -210,7 +213,7 @@ void TiledLayerImpl::AppendQuads(QuadSink* quad_sink, continue; gfx::Rect visible_tile_rect = - quad_sink->UnoccludedContentRect(tile_rect, draw_transform()); + occlusion_tracker.UnoccludedContentRect(tile_rect, draw_transform()); if (visible_tile_rect.IsEmpty()) continue; @@ -228,7 +231,7 @@ void TiledLayerImpl::AppendQuads(QuadSink* quad_sink, CheckerboardDrawQuad::Create(); checkerboard_quad->SetNew( shared_quad_state, tile_rect, visible_tile_rect, checker_color); - quad_sink->Append(checkerboard_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(checkerboard_quad.PassAs<DrawQuad>()); append_quads_data->num_missing_tiles++; continue; } @@ -257,7 +260,7 @@ void TiledLayerImpl::AppendQuads(QuadSink* quad_sink, tex_coord_rect, texture_size, tile->contents_swizzled()); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } } } diff --git a/cc/layers/tiled_layer_impl.h b/cc/layers/tiled_layer_impl.h index f4ed1e8..7fc4347 100644 --- a/cc/layers/tiled_layer_impl.h +++ b/cc/layers/tiled_layer_impl.h @@ -28,7 +28,8 @@ class CC_EXPORT TiledLayerImpl : public LayerImpl { virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* resource_provider) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE; diff --git a/cc/layers/tiled_layer_impl_unittest.cc b/cc/layers/tiled_layer_impl_unittest.cc index 7fa7d0f..a952636 100644 --- a/cc/layers/tiled_layer_impl_unittest.cc +++ b/cc/layers/tiled_layer_impl_unittest.cc @@ -10,7 +10,6 @@ #include "cc/test/fake_impl_proxy.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/layer_test_common.h" -#include "cc/test/mock_quad_culler.h" #include "cc/trees/single_thread_proxy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -76,9 +75,8 @@ class TiledLayerImplTest : public testing::Test { layer->SetBounds(layer_size); MockOcclusionTracker<LayerImpl> occlusion_tracker; - MockQuadCuller quad_culler(render_pass, &occlusion_tracker); AppendQuadsData data; - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass, occlusion_tracker, &data); } protected: @@ -100,14 +98,13 @@ TEST_F(TiledLayerImplTest, EmptyQuadList) { CreateLayer(tile_size, layer_size, LayerTilingData::NO_BORDER_TEXELS); MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; EXPECT_TRUE(layer->WillDraw(DRAW_MODE_HARDWARE, NULL)); - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); layer->DidDraw(NULL); unsigned num_tiles = num_tiles_x * num_tiles_y; - EXPECT_EQ(quad_culler.quad_list().size(), num_tiles); + EXPECT_EQ(render_pass->quad_list.size(), num_tiles); } // Layer with empty visible layer rect produces no quads @@ -118,7 +115,6 @@ TEST_F(TiledLayerImplTest, EmptyQuadList) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); EXPECT_FALSE(layer->WillDraw(DRAW_MODE_HARDWARE, NULL)); } @@ -133,13 +129,12 @@ TEST_F(TiledLayerImplTest, EmptyQuadList) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; EXPECT_TRUE(layer->WillDraw(DRAW_MODE_HARDWARE, NULL)); - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); layer->DidDraw(NULL); - EXPECT_EQ(quad_culler.quad_list().size(), 0u); + EXPECT_EQ(render_pass->quad_list.size(), 0u); } // Layer with skips draw produces no quads @@ -150,11 +145,10 @@ TEST_F(TiledLayerImplTest, EmptyQuadList) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - layer->AppendQuads(&quad_culler, &data); - EXPECT_EQ(quad_culler.quad_list().size(), 0u); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); + EXPECT_EQ(render_pass->quad_list.size(), 0u); } } @@ -172,15 +166,14 @@ TEST_F(TiledLayerImplTest, Checkerboarding) { { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - layer->AppendQuads(&quad_culler, &data); - EXPECT_EQ(quad_culler.quad_list().size(), 4u); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); + EXPECT_EQ(render_pass->quad_list.size(), 4u); EXPECT_EQ(0u, data.num_missing_tiles); - for (size_t i = 0; i < quad_culler.quad_list().size(); ++i) - EXPECT_EQ(quad_culler.quad_list()[i]->material, DrawQuad::TILED_CONTENT); + for (size_t i = 0; i < render_pass->quad_list.size(); ++i) + EXPECT_EQ(render_pass->quad_list[i]->material, DrawQuad::TILED_CONTENT); } for (int i = 0; i < num_tiles_x; ++i) @@ -191,14 +184,13 @@ TEST_F(TiledLayerImplTest, Checkerboarding) { { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); EXPECT_LT(0u, data.num_missing_tiles); - EXPECT_EQ(quad_culler.quad_list().size(), 4u); - for (size_t i = 0; i < quad_culler.quad_list().size(); ++i) - EXPECT_NE(quad_culler.quad_list()[i]->material, DrawQuad::TILED_CONTENT); + EXPECT_EQ(render_pass->quad_list.size(), 4u); + for (size_t i = 0; i < render_pass->quad_list.size(); ++i) + EXPECT_NE(render_pass->quad_list[i]->material, DrawQuad::TILED_CONTENT); } } diff --git a/cc/layers/ui_resource_layer_impl.cc b/cc/layers/ui_resource_layer_impl.cc index d2ec1e4..7b06a3e 100644 --- a/cc/layers/ui_resource_layer_impl.cc +++ b/cc/layers/ui_resource_layer_impl.cc @@ -7,9 +7,9 @@ #include "base/strings/stringprintf.h" #include "base/values.h" #include "cc/base/math_util.h" -#include "cc/layers/quad_sink.h" #include "cc/quads/texture_draw_quad.h" #include "cc/trees/layer_tree_impl.h" +#include "cc/trees/occlusion_tracker.h" #include "ui/gfx/rect_f.h" namespace cc { @@ -91,13 +91,16 @@ bool UIResourceLayerImpl::WillDraw(DrawMode draw_mode, return LayerImpl::WillDraw(draw_mode, resource_provider); } -void UIResourceLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); +void UIResourceLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); AppendDebugBorderQuad( - quad_sink, content_bounds(), shared_quad_state, append_quads_data); + render_pass, content_bounds(), shared_quad_state, append_quads_data); if (!ui_resource_id_) return; @@ -118,7 +121,7 @@ void UIResourceLayerImpl::AppendQuads(QuadSink* quad_sink, gfx::Rect quad_rect(bounds()); gfx::Rect opaque_rect(opaque ? quad_rect : gfx::Rect()); - gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect( + gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect( quad_rect, draw_properties().target_space_transform); if (visible_quad_rect.IsEmpty()) return; @@ -135,7 +138,7 @@ void UIResourceLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, vertex_opacity_, flipped); - quad_sink->Append(quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } const char* UIResourceLayerImpl::LayerTypeAsString() const { diff --git a/cc/layers/ui_resource_layer_impl.h b/cc/layers/ui_resource_layer_impl.h index c61df47..2bdf818 100644 --- a/cc/layers/ui_resource_layer_impl.h +++ b/cc/layers/ui_resource_layer_impl.h @@ -45,7 +45,8 @@ class CC_EXPORT UIResourceLayerImpl : public LayerImpl { virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* resource_provider) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; virtual base::DictionaryValue* LayerTreeAsJson() const OVERRIDE; diff --git a/cc/layers/ui_resource_layer_impl_unittest.cc b/cc/layers/ui_resource_layer_impl_unittest.cc index cd0d7bf..59c1300 100644 --- a/cc/layers/ui_resource_layer_impl_unittest.cc +++ b/cc/layers/ui_resource_layer_impl_unittest.cc @@ -4,13 +4,13 @@ #include "cc/layers/append_quads_data.h" #include "cc/layers/ui_resource_layer_impl.h" +#include "cc/quads/draw_quad.h" #include "cc/resources/ui_resource_bitmap.h" #include "cc/resources/ui_resource_client.h" #include "cc/test/fake_impl_proxy.h" #include "cc/test/fake_layer_tree_host_impl.h" #include "cc/test/fake_ui_resource_layer_tree_host_impl.h" #include "cc/test/layer_test_common.h" -#include "cc/test/mock_quad_culler.h" #include "cc/test/test_shared_bitmap_manager.h" #include "cc/trees/single_thread_proxy.h" #include "testing/gmock/include/gmock/gmock.h" @@ -47,13 +47,12 @@ void QuadSizeTest(scoped_ptr<UIResourceLayerImpl> layer, size_t expected_quad_size) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); // Verify quad rects - const QuadList& quads = quad_culler.quad_list(); + const QuadList& quads = render_pass->quad_list; EXPECT_EQ(expected_quad_size, quads.size()); } @@ -89,13 +88,12 @@ void OpaqueBoundsTest(scoped_ptr<UIResourceLayerImpl> layer, const gfx::Rect& expected_opaque_bounds) { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - layer->AppendQuads(&quad_culler, &data); + layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); // Verify quad rects - const QuadList& quads = quad_culler.quad_list(); + const QuadList& quads = render_pass->quad_list; EXPECT_GE(quads.size(), (size_t)0); gfx::Rect opaque_rect = quads.at(0)->opaque_rect; EXPECT_EQ(expected_opaque_bounds, opaque_rect); diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc index 4abf85b..bb46a84 100644 --- a/cc/layers/video_layer_impl.cc +++ b/cc/layers/video_layer_impl.cc @@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/logging.h" -#include "cc/layers/quad_sink.h" #include "cc/layers/video_frame_provider_client_impl.h" #include "cc/quads/io_surface_draw_quad.h" #include "cc/quads/stream_video_draw_quad.h" @@ -15,6 +14,7 @@ #include "cc/resources/resource_provider.h" #include "cc/resources/single_release_callback.h" #include "cc/trees/layer_tree_impl.h" +#include "cc/trees/occlusion_tracker.h" #include "cc/trees/proxy.h" #include "media/base/video_frame.h" @@ -124,22 +124,25 @@ bool VideoLayerImpl::WillDraw(DrawMode draw_mode, return true; } -void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { +void VideoLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { DCHECK(frame_.get()); - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); AppendDebugBorderQuad( - quad_sink, content_bounds(), shared_quad_state, append_quads_data); + render_pass, content_bounds(), shared_quad_state, append_quads_data); gfx::Rect quad_rect(content_bounds()); gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); gfx::Rect visible_rect = frame_->visible_rect(); gfx::Size coded_size = frame_->coded_size(); - gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect( + gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect( quad_rect, draw_properties().target_space_transform); if (visible_quad_rect.IsEmpty()) return; @@ -178,7 +181,7 @@ void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, opacity, flipped); - quad_sink->Append(texture_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(texture_quad.PassAs<DrawQuad>()); break; } case VideoFrameExternalResources::YUV_RESOURCE: { @@ -203,7 +206,7 @@ void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, frame_resources_[2], frame_resources_.size() > 3 ? frame_resources_[3] : 0, color_space); - quad_sink->Append(yuv_video_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(yuv_video_quad.PassAs<DrawQuad>()); break; } case VideoFrameExternalResources::RGB_RESOURCE: { @@ -227,7 +230,7 @@ void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, SK_ColorTRANSPARENT, opacity, flipped); - quad_sink->Append(texture_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(texture_quad.PassAs<DrawQuad>()); break; } case VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE: { @@ -245,7 +248,7 @@ void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, visible_quad_rect, frame_resources_[0], scale * provider_client_impl_->stream_texture_matrix()); - quad_sink->Append(stream_video_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(stream_video_quad.PassAs<DrawQuad>()); break; } case VideoFrameExternalResources::IO_SURFACE: { @@ -261,7 +264,7 @@ void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, visible_rect.size(), frame_resources_[0], IOSurfaceDrawQuad::UNFLIPPED); - quad_sink->Append(io_surface_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(io_surface_quad.PassAs<DrawQuad>()); break; } #if defined(VIDEO_HOLE) @@ -286,7 +289,7 @@ void VideoLayerImpl::AppendQuads(QuadSink* quad_sink, false, SK_ColorTRANSPARENT, true); - quad_sink->Append(solid_color_draw_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(solid_color_draw_quad.PassAs<DrawQuad>()); break; } #endif // defined(VIDEO_HOLE) diff --git a/cc/layers/video_layer_impl.h b/cc/layers/video_layer_impl.h index f8df7cbd..dd09589 100644 --- a/cc/layers/video_layer_impl.h +++ b/cc/layers/video_layer_impl.h @@ -33,7 +33,8 @@ class CC_EXPORT VideoLayerImpl : public LayerImpl { virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; virtual bool WillDraw(DrawMode draw_mode, ResourceProvider* resource_provider) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; virtual void DidDraw(ResourceProvider* resource_provider) OVERRIDE; virtual void DidBecomeActive() OVERRIDE; diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index 445695c..aafbb35 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -15,7 +15,6 @@ #include "cc/test/fake_output_surface.h" #include "cc/test/fake_output_surface_client.h" #include "cc/test/fake_renderer_client.h" -#include "cc/test/mock_quad_culler.h" #include "cc/test/pixel_test.h" #include "cc/test/render_pass_test_common.h" #include "cc/test/render_pass_test_utils.h" diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc index 536b2ef1..9bd7ab1 100644 --- a/cc/output/software_renderer_unittest.cc +++ b/cc/output/software_renderer_unittest.cc @@ -5,7 +5,6 @@ #include "cc/output/software_renderer.h" #include "base/run_loop.h" -#include "cc/layers/quad_sink.h" #include "cc/output/compositor_frame_metadata.h" #include "cc/output/copy_output_request.h" #include "cc/output/copy_output_result.h" diff --git a/cc/quads/render_pass.cc b/cc/quads/render_pass.cc index afcc6e8..5c12422 100644 --- a/cc/quads/render_pass.cc +++ b/cc/quads/render_pass.cc @@ -175,6 +175,10 @@ SharedQuadState* RenderPass::CreateAndAppendSharedQuadState() { } void RenderPass::AppendDrawQuad(scoped_ptr<DrawQuad> draw_quad) { + DCHECK(!shared_quad_state_list.empty()); + DCHECK(!draw_quad->rect.IsEmpty()); + DCHECK(!draw_quad->visible_rect.IsEmpty()); + quad_list.push_back(draw_quad.Pass()); } diff --git a/cc/test/fake_picture_layer_impl.cc b/cc/test/fake_picture_layer_impl.cc index 8514bc3..3e92bd5 100644 --- a/cc/test/fake_picture_layer_impl.cc +++ b/cc/test/fake_picture_layer_impl.cc @@ -41,9 +41,12 @@ scoped_ptr<LayerImpl> FakePictureLayerImpl::CreateLayerImpl( new FakePictureLayerImpl(tree_impl, id())).PassAs<LayerImpl>(); } -void FakePictureLayerImpl::AppendQuads(QuadSink* quad_sink, - AppendQuadsData* append_quads_data) { - PictureLayerImpl::AppendQuads(quad_sink, append_quads_data); +void FakePictureLayerImpl::AppendQuads( + RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, + AppendQuadsData* append_quads_data) { + PictureLayerImpl::AppendQuads( + render_pass, occlusion_tracker, append_quads_data); ++append_quads_count_; } diff --git a/cc/test/fake_picture_layer_impl.h b/cc/test/fake_picture_layer_impl.h index 04661c4..14310c7 100644 --- a/cc/test/fake_picture_layer_impl.h +++ b/cc/test/fake_picture_layer_impl.h @@ -35,7 +35,8 @@ class FakePictureLayerImpl : public PictureLayerImpl { virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) OVERRIDE; - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE; virtual gfx::Size CalculateTileSize( const gfx::Size& content_bounds) const OVERRIDE; diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc index 4daca5d..7a0de16 100644 --- a/cc/test/layer_test_common.cc +++ b/cc/test/layer_test_common.cc @@ -10,6 +10,7 @@ #include "cc/quads/draw_quad.h" #include "cc/quads/render_pass.h" #include "cc/test/fake_output_surface.h" +#include "cc/test/mock_occlusion_tracker.h" #include "cc/trees/layer_tree_host_common.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/point_conversions.h" @@ -102,9 +103,7 @@ void LayerTestCommon::VerifyQuadsCoverRectWithOcclusion( LayerTestCommon::LayerImplTest::LayerImplTest() : host_(FakeLayerTreeHost::Create()), root_layer_impl_(LayerImpl::Create(host_->host_impl()->active_tree(), 1)), - render_pass_(RenderPass::Create()), - quad_culler_(make_scoped_ptr( - new MockQuadCuller(render_pass_.get(), &occlusion_tracker_))) { + render_pass_(RenderPass::Create()) { scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d(); host_->host_impl()->InitializeRenderer( output_surface.PassAs<OutputSurface>()); @@ -125,10 +124,11 @@ void LayerTestCommon::LayerImplTest::AppendQuadsWithOcclusion( const gfx::Rect& occluded) { AppendQuadsData data; - quad_culler_->clear_lists(); - quad_culler_->set_occluded_target_rect(occluded); + render_pass_->quad_list.clear(); + render_pass_->shared_quad_state_list.clear(); + occlusion_tracker_.set_occluded_target_rect(occluded); layer_impl->WillDraw(DRAW_MODE_HARDWARE, resource_provider()); - layer_impl->AppendQuads(quad_culler_.get(), &data); + layer_impl->AppendQuads(render_pass_.get(), occlusion_tracker_, &data); layer_impl->DidDraw(resource_provider()); } @@ -138,10 +138,11 @@ void LayerTestCommon::LayerImplTest::AppendQuadsForPassWithOcclusion( const gfx::Rect& occluded) { AppendQuadsData data(id); - quad_culler_->clear_lists(); - quad_culler_->set_occluded_target_rect(occluded); + render_pass_->quad_list.clear(); + render_pass_->shared_quad_state_list.clear(); + occlusion_tracker_.set_occluded_target_rect(occluded); layer_impl->WillDraw(DRAW_MODE_HARDWARE, resource_provider()); - layer_impl->AppendQuads(quad_culler_.get(), &data); + layer_impl->AppendQuads(render_pass_.get(), occlusion_tracker_, &data); layer_impl->DidDraw(resource_provider()); } @@ -150,11 +151,14 @@ void LayerTestCommon::LayerImplTest::AppendSurfaceQuadsWithOcclusion( const gfx::Rect& occluded) { AppendQuadsData data; - quad_culler_->clear_lists(); - quad_culler_->set_occluded_target_rect_for_contributing_surface(occluded); + render_pass_->quad_list.clear(); + render_pass_->shared_quad_state_list.clear(); + occlusion_tracker_.set_occluded_target_rect_for_contributing_surface( + occluded); bool for_replica = false; RenderPass::Id id(1, 1); - surface_impl->AppendQuads(quad_culler_.get(), &data, for_replica, id); + surface_impl->AppendQuads( + render_pass_.get(), occlusion_tracker_, &data, for_replica, id); } } // namespace cc diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h index d3f2ab3..3b967ec 100644 --- a/cc/test/layer_test_common.h +++ b/cc/test/layer_test_common.h @@ -7,8 +7,9 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" +#include "cc/quads/render_pass.h" #include "cc/test/fake_layer_tree_host.h" -#include "cc/test/mock_quad_culler.h" +#include "cc/test/mock_occlusion_tracker.h" #include "cc/trees/layer_tree_host_impl.h" #define EXPECT_SET_NEEDS_COMMIT(expect, code_to_test) \ @@ -113,14 +114,13 @@ class LayerTestCommon { LayerImpl* root_layer() const { return root_layer_impl_.get(); } FakeLayerTreeHostImpl* host_impl() const { return host_->host_impl(); } Proxy* proxy() const { return host_->host_impl()->proxy(); } - const QuadList& quad_list() const { return quad_culler_->quad_list(); } + const QuadList& quad_list() const { return render_pass_->quad_list; } private: scoped_ptr<FakeLayerTreeHost> host_; scoped_ptr<LayerImpl> root_layer_impl_; scoped_ptr<RenderPass> render_pass_; MockOcclusionTracker<LayerImpl> occlusion_tracker_; - scoped_ptr<MockQuadCuller> quad_culler_; }; }; diff --git a/cc/test/mock_occlusion_tracker.h b/cc/test/mock_occlusion_tracker.h index 6a88bce..649eb76 100644 --- a/cc/test/mock_occlusion_tracker.h +++ b/cc/test/mock_occlusion_tracker.h @@ -41,6 +41,9 @@ class MockOcclusionTracker : public OcclusionTracker<LayerType> { LayerType>::stack_[OcclusionTracker<LayerType>::stack_.size() - 2] .occlusion_from_inside_target = occluded; } + + private: + DISALLOW_COPY_AND_ASSIGN(MockOcclusionTracker); }; } // namespace cc diff --git a/cc/test/mock_quad_culler.cc b/cc/test/mock_quad_culler.cc deleted file mode 100644 index e1b140b..0000000 --- a/cc/test/mock_quad_culler.cc +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "cc/test/mock_quad_culler.h" - -namespace cc { - -MockQuadCuller::MockQuadCuller( - RenderPass* render_pass, - MockOcclusionTracker<LayerImpl>* occlusion_tracker) - : QuadSink(render_pass, occlusion_tracker), - occlusion_tracker_(occlusion_tracker) { -} - -MockQuadCuller::~MockQuadCuller() {} - -gfx::Rect MockQuadCuller::UnoccludedContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform) { - return occlusion_tracker_->UnoccludedContentRect(content_rect, - draw_transform); -} - -gfx::Rect MockQuadCuller::UnoccludedContributingSurfaceContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform) { - return occlusion_tracker_->UnoccludedContributingSurfaceContentRect( - content_rect, draw_transform); -} - -} // namespace cc - diff --git a/cc/test/mock_quad_culler.h b/cc/test/mock_quad_culler.h deleted file mode 100644 index ca2f0aa..0000000 --- a/cc/test/mock_quad_culler.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CC_TEST_MOCK_QUAD_CULLER_H_ -#define CC_TEST_MOCK_QUAD_CULLER_H_ - -#include "base/memory/scoped_ptr.h" -#include "cc/layers/quad_sink.h" -#include "cc/quads/draw_quad.h" -#include "cc/quads/render_pass.h" -#include "cc/test/mock_occlusion_tracker.h" - -namespace cc { -class LayerImpl; - -class MockQuadCuller : public QuadSink { - public: - virtual ~MockQuadCuller(); - - MockQuadCuller(RenderPass* render_pass, - MockOcclusionTracker<LayerImpl>* occlusion_tracker); - - virtual gfx::Rect UnoccludedContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform) OVERRIDE; - - virtual gfx::Rect UnoccludedContributingSurfaceContentRect( - const gfx::Rect& content_rect, - const gfx::Transform& draw_transform) OVERRIDE; - - const QuadList& quad_list() const { return render_pass_->quad_list; } - const SharedQuadStateList& shared_quad_state_list() const { - return render_pass_->shared_quad_state_list; - } - - void set_occluded_target_rect(const gfx::Rect& occluded) { - occlusion_tracker_->set_occluded_target_rect(occluded); - } - - void set_occluded_target_rect_for_contributing_surface( - const gfx::Rect& occluded) { - occlusion_tracker_->set_occluded_target_rect_for_contributing_surface( - occluded); - } - - void clear_lists() { - render_pass_->quad_list.clear(); - render_pass_->shared_quad_state_list.clear(); - } - - private: - MockOcclusionTracker<LayerImpl>* occlusion_tracker_; -}; - -} // namespace cc - -#endif // CC_TEST_MOCK_QUAD_CULLER_H_ diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc index 7ea3a7a..5e85298 100644 --- a/cc/test/render_pass_test_utils.cc +++ b/cc/test/render_pass_test_utils.cc @@ -4,7 +4,6 @@ #include "cc/test/render_pass_test_utils.h" -#include "cc/layers/quad_sink.h" #include "cc/quads/render_pass_draw_quad.h" #include "cc/quads/shared_quad_state.h" #include "cc/quads/solid_color_draw_quad.h" diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 790613a..5248919 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -32,7 +32,6 @@ #include "cc/layers/layer_impl.h" #include "cc/layers/layer_iterator.h" #include "cc/layers/painted_scrollbar_layer_impl.h" -#include "cc/layers/quad_sink.h" #include "cc/layers/render_surface_impl.h" #include "cc/layers/scrollbar_layer_impl_base.h" #include "cc/output/compositor_frame_metadata.h" @@ -573,8 +572,7 @@ static void AppendQuadsForLayer( LayerImpl* layer, const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) { - QuadSink quad_culler(target_render_pass, &occlusion_tracker); - layer->AppendQuads(&quad_culler, append_quads_data); + layer->AppendQuads(target_render_pass, occlusion_tracker, append_quads_data); } static void AppendQuadsForRenderSurfaceLayer( @@ -583,10 +581,9 @@ static void AppendQuadsForRenderSurfaceLayer( const RenderPass* contributing_render_pass, const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) { - QuadSink quad_culler(target_render_pass, &occlusion_tracker); - bool is_replica = false; - layer->render_surface()->AppendQuads(&quad_culler, + layer->render_surface()->AppendQuads(target_render_pass, + occlusion_tracker, append_quads_data, is_replica, contributing_render_pass->id); @@ -594,7 +591,8 @@ static void AppendQuadsForRenderSurfaceLayer( // Add replica after the surface so that it appears below the surface. if (layer->has_replica()) { is_replica = true; - layer->render_surface()->AppendQuads(&quad_culler, + layer->render_surface()->AppendQuads(target_render_pass, + occlusion_tracker, append_quads_data, is_replica, contributing_render_pass->id); @@ -626,8 +624,6 @@ static void AppendQuadsToFillScreen( screen_background_color_region.Intersect(root_scroll_layer_rect); } - QuadSink quad_culler(target_render_pass, &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. // TODO(danakj): Make the gutter quads generated by the solid color layer @@ -636,7 +632,8 @@ static void AppendQuadsToFillScreen( gfx::Rect root_target_rect = root_layer->render_surface()->content_rect(); float opacity = 1.f; int sorting_context_id = 0; - SharedQuadState* shared_quad_state = quad_culler.CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + target_render_pass->CreateAndAppendSharedQuadState(); shared_quad_state->SetAll(gfx::Transform(), root_target_rect.size(), root_target_rect, @@ -659,7 +656,7 @@ static void AppendQuadsToFillScreen( visible_screen_space_rect, screen_background_color, false); - quad_culler.Append(quad.PassAs<DrawQuad>()); + target_render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>()); } for (Region::Iterator fill_rects(overhang_region); fill_rects.has_rect(); @@ -687,7 +684,7 @@ static void AppendQuadsToFillScreen( screen_background_color, vertex_opacity, false); - quad_culler.Append(tex_quad.PassAs<DrawQuad>()); + target_render_pass->AppendDrawQuad(tex_quad.PassAs<DrawQuad>()); } } diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index f415c51..ff993f3 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc @@ -20,7 +20,6 @@ #include "cc/layers/io_surface_layer_impl.h" #include "cc/layers/layer_impl.h" #include "cc/layers/painted_scrollbar_layer_impl.h" -#include "cc/layers/quad_sink.h" #include "cc/layers/render_surface_impl.h" #include "cc/layers/solid_color_layer_impl.h" #include "cc/layers/solid_color_scrollbar_layer_impl.h" @@ -1654,10 +1653,11 @@ class DidDrawCheckLayer : public LayerImpl { return LayerImpl::WillDraw(draw_mode, provider); } - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE { append_quads_called_ = true; - LayerImpl::AppendQuads(quad_sink, append_quads_data); + LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); } virtual void DidDraw(ResourceProvider* provider) OVERRIDE { @@ -1875,9 +1875,10 @@ class MissingTextureAnimatingLayer : public DidDrawCheckLayer { resource_provider)); } - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE { - LayerImpl::AppendQuads(quad_sink, append_quads_data); + LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); if (had_incomplete_tile_) append_quads_data->had_incomplete_tile = true; if (tile_missing_) @@ -3482,7 +3483,8 @@ class BlendStateCheckLayer : public LayerImpl { resource_provider)); } - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE { quads_appended_ = true; @@ -3493,7 +3495,8 @@ class BlendStateCheckLayer : public LayerImpl { opaque_rect = opaque_content_rect_; gfx::Rect visible_quad_rect = quad_rect_; - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); scoped_ptr<TileDrawQuad> test_blending_draw_quad = TileDrawQuad::Create(); @@ -3508,7 +3511,7 @@ class BlendStateCheckLayer : public LayerImpl { test_blending_draw_quad->visible_rect = quad_visible_rect_; EXPECT_EQ(blend_, test_blending_draw_quad->ShouldDrawWithBlending()); EXPECT_EQ(has_render_surface_, !!render_surface()); - quad_sink->Append(test_blending_draw_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(test_blending_draw_quad.PassAs<DrawQuad>()); } void SetExpectation(bool blend, bool has_render_surface) { @@ -4240,9 +4243,11 @@ class FakeLayerWithQuads : public LayerImpl { return scoped_ptr<LayerImpl>(new FakeLayerWithQuads(tree_impl, id)); } - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE { - SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); + SharedQuadState* shared_quad_state = + render_pass->CreateAndAppendSharedQuadState(); PopulateSharedQuadState(shared_quad_state); SkColor gray = SkColorSetRGB(100, 100, 100); @@ -4251,7 +4256,7 @@ class FakeLayerWithQuads : public LayerImpl { scoped_ptr<SolidColorDrawQuad> my_quad = SolidColorDrawQuad::Create(); my_quad->SetNew( shared_quad_state, quad_rect, visible_quad_rect, gray, false); - quad_sink->Append(my_quad.PassAs<DrawQuad>()); + render_pass->AppendDrawQuad(my_quad.PassAs<DrawQuad>()); } private: 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 b7eb516..1553fa0 100644 --- a/cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc +++ b/cc/trees/layer_tree_host_pixeltest_on_demand_raster.cc @@ -8,7 +8,7 @@ #include "cc/layers/picture_layer_impl.h" #include "cc/quads/draw_quad.h" #include "cc/test/layer_tree_pixel_test.h" -#include "cc/test/mock_quad_culler.h" +#include "cc/test/mock_occlusion_tracker.h" #include "cc/trees/layer_tree_impl.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColor.h" @@ -43,10 +43,9 @@ class LayerTreeHostOnDemandRasterPixelTest : public LayerTreePixelTest { MockOcclusionTracker<LayerImpl> occlusion_tracker; scoped_ptr<RenderPass> render_pass = RenderPass::Create(); - MockQuadCuller quad_culler(render_pass.get(), &occlusion_tracker); AppendQuadsData data; - picture_layer->AppendQuads(&quad_culler, &data); + picture_layer->AppendQuads(render_pass.get(), occlusion_tracker, &data); for (size_t i = 0; i < render_pass->quad_list.size(); ++i) EXPECT_EQ(render_pass->quad_list[i]->material, DrawQuad::PICTURE_CONTENT); diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 6b781cb..b194491 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -1659,7 +1659,8 @@ class EvictionTestLayerImpl : public LayerImpl { } virtual ~EvictionTestLayerImpl() {} - virtual void AppendQuads(QuadSink* quad_sink, + virtual void AppendQuads(RenderPass* render_pass, + const OcclusionTracker<LayerImpl>& occlusion_tracker, AppendQuadsData* append_quads_data) OVERRIDE { ASSERT_TRUE(has_texture_); ASSERT_NE(0u, layer_tree_impl()->resource_provider()->num_resources()); @@ -4632,7 +4633,7 @@ class LayerTreeHostTestHighResRequiredAfterEvictingUIResources }; // This test is flaky, see http://crbug.com/386199 -//MULTI_THREAD_TEST_F(LayerTreeHostTestHighResRequiredAfterEvictingUIResources); +// MULTI_THREAD_TEST_F(LayerTreeHostTestHighResRequiredAfterEvictingUIResources) class LayerTreeHostTestGpuRasterizationDefault : public LayerTreeHostTest { protected: |