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

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

Issue 675903002: cc: SolidColorLayerImpl::AppendSolidQuads takes the visible content rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed the code that set the visible rect Created 6 years, 2 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
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/append_quads_data.h" 9 #include "cc/layers/append_quads_data.h"
10 #include "cc/quads/solid_color_draw_quad.h" 10 #include "cc/quads/solid_color_draw_quad.h"
(...skipping 13 matching lines...) Expand all
24 24
25 scoped_ptr<LayerImpl> SolidColorLayerImpl::CreateLayerImpl( 25 scoped_ptr<LayerImpl> SolidColorLayerImpl::CreateLayerImpl(
26 LayerTreeImpl* tree_impl) { 26 LayerTreeImpl* tree_impl) {
27 return SolidColorLayerImpl::Create(tree_impl, id()); 27 return SolidColorLayerImpl::Create(tree_impl, id());
28 } 28 }
29 29
30 void SolidColorLayerImpl::AppendSolidQuads( 30 void SolidColorLayerImpl::AppendSolidQuads(
31 RenderPass* render_pass, 31 RenderPass* render_pass,
32 const Occlusion& occlusion_in_content_space, 32 const Occlusion& occlusion_in_content_space,
33 SharedQuadState* shared_quad_state, 33 SharedQuadState* shared_quad_state,
34 const gfx::Size& content_bounds, 34 const gfx::Rect& visible_content_rect,
35 SkColor color, 35 SkColor color,
36 AppendQuadsData* append_quads_data) { 36 AppendQuadsData* append_quads_data) {
37 // We create a series of smaller quads instead of just one large one so that 37 // We create a series of smaller quads instead of just one large one so that
38 // the culler can reduce the total pixels drawn. 38 // the culler can reduce the total pixels drawn.
39 int width = content_bounds.width(); 39 int width = visible_content_rect.width();
40 int height = content_bounds.height(); 40 int height = visible_content_rect.height();
41 for (int x = 0; x < width; x += kSolidQuadTileSize) { 41 for (int x = visible_content_rect.x(); x < visible_content_rect.right();
42 for (int y = 0; y < height; y += kSolidQuadTileSize) { 42 x += kSolidQuadTileSize) {
43 for (int y = visible_content_rect.y(); y < visible_content_rect.bottom();
44 y += kSolidQuadTileSize) {
43 gfx::Rect quad_rect(x, 45 gfx::Rect quad_rect(x,
44 y, 46 y,
45 std::min(width - x, kSolidQuadTileSize), 47 std::min(width - x, kSolidQuadTileSize),
46 std::min(height - y, kSolidQuadTileSize)); 48 std::min(height - y, kSolidQuadTileSize));
47 gfx::Rect visible_quad_rect = 49 gfx::Rect visible_quad_rect =
48 occlusion_in_content_space.GetUnoccludedContentRect(quad_rect); 50 occlusion_in_content_space.GetUnoccludedContentRect(quad_rect);
49 if (visible_quad_rect.IsEmpty()) 51 if (visible_quad_rect.IsEmpty())
50 continue; 52 continue;
51 53
52 append_quads_data->visible_content_area += 54 append_quads_data->visible_content_area +=
(...skipping 14 matching lines...) Expand all
67 SharedQuadState* shared_quad_state = 69 SharedQuadState* shared_quad_state =
68 render_pass->CreateAndAppendSharedQuadState(); 70 render_pass->CreateAndAppendSharedQuadState();
69 PopulateSharedQuadState(shared_quad_state); 71 PopulateSharedQuadState(shared_quad_state);
70 72
71 AppendDebugBorderQuad( 73 AppendDebugBorderQuad(
72 render_pass, content_bounds(), shared_quad_state, append_quads_data); 74 render_pass, content_bounds(), shared_quad_state, append_quads_data);
73 75
74 AppendSolidQuads(render_pass, 76 AppendSolidQuads(render_pass,
75 occlusion_in_content_space, 77 occlusion_in_content_space,
76 shared_quad_state, 78 shared_quad_state,
77 content_bounds(), 79 gfx::Rect(content_bounds()),
danakj 2014/10/23 23:27:28 why isn't this the visible rect too? same problem
danakj 2014/10/23 23:38:21 please leave a TODO pointing to a bug.
hendrikw 2014/10/23 23:53:48 Acknowledged.
78 background_color(), 80 background_color(),
79 append_quads_data); 81 append_quads_data);
80 } 82 }
81 83
82 const char* SolidColorLayerImpl::LayerTypeAsString() const { 84 const char* SolidColorLayerImpl::LayerTypeAsString() const {
83 return "cc::SolidColorLayerImpl"; 85 return "cc::SolidColorLayerImpl";
84 } 86 }
85 87
86 } // namespace cc 88 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698