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

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

Issue 2859483006: cc: Enable composited border-radius scrolling.
Patch Set: Fix webkit unit tests. Created 3 years, 7 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/trees/layer_tree_settings.h » ('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/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 15 matching lines...) Expand all
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_layer_space, 32 const Occlusion& occlusion_in_layer_space,
33 SharedQuadState* shared_quad_state, 33 SharedQuadState* shared_quad_state,
34 const gfx::Rect& visible_layer_rect, 34 const gfx::Rect& visible_layer_rect,
35 SkColor color, 35 SkColor color,
36 AppendQuadsData* append_quads_data) { 36 AppendQuadsData* append_quads_data,
37 Layer::LayerMaskType mask_type) {
37 float alpha = 38 float alpha =
38 (SkColorGetA(color) * (1.0f / 255.0f)) * shared_quad_state->opacity; 39 (SkColorGetA(color) * (1.0f / 255.0f)) * shared_quad_state->opacity;
39 DCHECK_EQ(SkBlendMode::kSrcOver, shared_quad_state->blend_mode); 40 DCHECK_EQ(SkBlendMode::kSrcOver, shared_quad_state->blend_mode);
40 if (alpha < std::numeric_limits<float>::epsilon()) 41 if (alpha < std::numeric_limits<float>::epsilon() &&
42 mask_type != Layer::LayerMaskType::MULTI_TEXTURE_MASK)
enne (OOO) 2017/05/12 17:51:33 Why must these noop solid color quads not be skipp
sunxd 2017/05/15 17:57:36 It was because mask layer's opacity is not calcula
41 return; 43 return;
42 // We create a series of smaller quads instead of just one large one so that 44 // We create a series of smaller quads instead of just one large one so that
43 // the culler can reduce the total pixels drawn. 45 // the culler can reduce the total pixels drawn.
44 int right = visible_layer_rect.right(); 46 int right = visible_layer_rect.right();
45 int bottom = visible_layer_rect.bottom(); 47 int bottom = visible_layer_rect.bottom();
46 for (int x = visible_layer_rect.x(); x < visible_layer_rect.right(); 48 for (int x = visible_layer_rect.x(); x < visible_layer_rect.right();
47 x += kSolidQuadTileSize) { 49 x += kSolidQuadTileSize) {
48 for (int y = visible_layer_rect.y(); y < visible_layer_rect.bottom(); 50 for (int y = visible_layer_rect.y(); y < visible_layer_rect.bottom();
49 y += kSolidQuadTileSize) { 51 y += kSolidQuadTileSize) {
50 gfx::Rect quad_rect(x, 52 gfx::Rect quad_rect(x,
(...skipping 23 matching lines...) Expand all
74 render_pass->CreateAndAppendSharedQuadState(); 76 render_pass->CreateAndAppendSharedQuadState();
75 PopulateSharedQuadState(shared_quad_state); 77 PopulateSharedQuadState(shared_quad_state);
76 78
77 AppendDebugBorderQuad(render_pass, bounds(), shared_quad_state, 79 AppendDebugBorderQuad(render_pass, bounds(), shared_quad_state,
78 append_quads_data); 80 append_quads_data);
79 81
80 // TODO(hendrikw): We need to pass the visible content rect rather than 82 // TODO(hendrikw): We need to pass the visible content rect rather than
81 // |bounds()| here. 83 // |bounds()| here.
82 AppendSolidQuads(render_pass, draw_properties().occlusion_in_content_space, 84 AppendSolidQuads(render_pass, draw_properties().occlusion_in_content_space,
83 shared_quad_state, gfx::Rect(bounds()), background_color(), 85 shared_quad_state, gfx::Rect(bounds()), background_color(),
84 append_quads_data); 86 append_quads_data, Layer::LayerMaskType::NOT_MASK);
85 } 87 }
86 88
87 const char* SolidColorLayerImpl::LayerTypeAsString() const { 89 const char* SolidColorLayerImpl::LayerTypeAsString() const {
88 return "cc::SolidColorLayerImpl"; 90 return "cc::SolidColorLayerImpl";
89 } 91 }
90 92
91 } // namespace cc 93 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/solid_color_layer_impl.h ('k') | cc/trees/layer_tree_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698