Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: cc/layers/solid_color_layer_impl.cc

Issue 308193003: Removed QuadSink and MockQuadCuller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plumLayerImpl
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/solid_color_layer_impl.h ('k') | cc/layers/solid_color_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/solid_color_layer_impl.h" 5 #include "cc/layers/solid_color_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "cc/layers/quad_sink.h"
10 #include "cc/quads/solid_color_draw_quad.h" 9 #include "cc/quads/solid_color_draw_quad.h"
10 #include "cc/trees/occlusion_tracker.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 SolidColorLayerImpl::SolidColorLayerImpl(LayerTreeImpl* tree_impl, int id) 14 SolidColorLayerImpl::SolidColorLayerImpl(LayerTreeImpl* tree_impl, int id)
15 : LayerImpl(tree_impl, id), 15 : LayerImpl(tree_impl, id),
16 tile_size_(256) {} 16 tile_size_(256) {}
17 17
18 SolidColorLayerImpl::~SolidColorLayerImpl() {} 18 SolidColorLayerImpl::~SolidColorLayerImpl() {}
19 19
20 scoped_ptr<LayerImpl> SolidColorLayerImpl::CreateLayerImpl( 20 scoped_ptr<LayerImpl> SolidColorLayerImpl::CreateLayerImpl(
21 LayerTreeImpl* tree_impl) { 21 LayerTreeImpl* tree_impl) {
22 return SolidColorLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); 22 return SolidColorLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
23 } 23 }
24 24
25 void SolidColorLayerImpl::AppendQuads(QuadSink* quad_sink, 25 void SolidColorLayerImpl::AppendQuads(
26 AppendQuadsData* append_quads_data) { 26 RenderPass* render_pass,
27 SharedQuadState* shared_quad_state = quad_sink->CreateSharedQuadState(); 27 const OcclusionTracker<LayerImpl>& occlusion_tracker,
28 AppendQuadsData* append_quads_data) {
29 SharedQuadState* shared_quad_state =
30 render_pass->CreateAndAppendSharedQuadState();
28 PopulateSharedQuadState(shared_quad_state); 31 PopulateSharedQuadState(shared_quad_state);
29 32
30 AppendDebugBorderQuad( 33 AppendDebugBorderQuad(
31 quad_sink, content_bounds(), shared_quad_state, append_quads_data); 34 render_pass, content_bounds(), shared_quad_state, append_quads_data);
32 35
33 // We create a series of smaller quads instead of just one large one so that 36 // We create a series of smaller quads instead of just one large one so that
34 // the culler can reduce the total pixels drawn. 37 // the culler can reduce the total pixels drawn.
35 int width = content_bounds().width(); 38 int width = content_bounds().width();
36 int height = content_bounds().height(); 39 int height = content_bounds().height();
37 for (int x = 0; x < width; x += tile_size_) { 40 for (int x = 0; x < width; x += tile_size_) {
38 for (int y = 0; y < height; y += tile_size_) { 41 for (int y = 0; y < height; y += tile_size_) {
39 gfx::Rect quad_rect(x, 42 gfx::Rect quad_rect(x,
40 y, 43 y,
41 std::min(width - x, tile_size_), 44 std::min(width - x, tile_size_),
42 std::min(height - y, tile_size_)); 45 std::min(height - y, tile_size_));
43 gfx::Rect visible_quad_rect = quad_sink->UnoccludedContentRect( 46 gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect(
44 quad_rect, draw_properties().target_space_transform); 47 quad_rect, draw_properties().target_space_transform);
45 if (visible_quad_rect.IsEmpty()) 48 if (visible_quad_rect.IsEmpty())
46 continue; 49 continue;
47 50
48 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); 51 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
49 quad->SetNew(shared_quad_state, 52 quad->SetNew(shared_quad_state,
50 quad_rect, 53 quad_rect,
51 visible_quad_rect, 54 visible_quad_rect,
52 background_color(), 55 background_color(),
53 false); 56 false);
54 quad_sink->Append(quad.PassAs<DrawQuad>()); 57 render_pass->AppendDrawQuad(quad.PassAs<DrawQuad>());
55 } 58 }
56 } 59 }
57 } 60 }
58 61
59 const char* SolidColorLayerImpl::LayerTypeAsString() const { 62 const char* SolidColorLayerImpl::LayerTypeAsString() const {
60 return "cc::SolidColorLayerImpl"; 63 return "cc::SolidColorLayerImpl";
61 } 64 }
62 65
63 } // namespace cc 66 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/solid_color_layer_impl.h ('k') | cc/layers/solid_color_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698