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

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

Issue 2859483006: cc: Enable composited border-radius scrolling.
Patch Set: Calculate mask layer opacity. 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
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())
41 return; 42 return;
42 // We create a series of smaller quads instead of just one large one so that 43 // We create a series of smaller quads instead of just one large one so that
43 // the culler can reduce the total pixels drawn. 44 // the culler can reduce the total pixels drawn.
44 int right = visible_layer_rect.right(); 45 int right = visible_layer_rect.right();
45 int bottom = visible_layer_rect.bottom(); 46 int bottom = visible_layer_rect.bottom();
46 for (int x = visible_layer_rect.x(); x < visible_layer_rect.right(); 47 for (int x = visible_layer_rect.x(); x < visible_layer_rect.right();
(...skipping 27 matching lines...) Expand all
74 render_pass->CreateAndAppendSharedQuadState(); 75 render_pass->CreateAndAppendSharedQuadState();
75 PopulateSharedQuadState(shared_quad_state); 76 PopulateSharedQuadState(shared_quad_state);
76 77
77 AppendDebugBorderQuad(render_pass, bounds(), shared_quad_state, 78 AppendDebugBorderQuad(render_pass, bounds(), shared_quad_state,
78 append_quads_data); 79 append_quads_data);
79 80
80 // TODO(hendrikw): We need to pass the visible content rect rather than 81 // TODO(hendrikw): We need to pass the visible content rect rather than
81 // |bounds()| here. 82 // |bounds()| here.
82 AppendSolidQuads(render_pass, draw_properties().occlusion_in_content_space, 83 AppendSolidQuads(render_pass, draw_properties().occlusion_in_content_space,
83 shared_quad_state, gfx::Rect(bounds()), background_color(), 84 shared_quad_state, gfx::Rect(bounds()), background_color(),
84 append_quads_data); 85 append_quads_data, Layer::LayerMaskType::NOT_MASK);
85 } 86 }
86 87
87 const char* SolidColorLayerImpl::LayerTypeAsString() const { 88 const char* SolidColorLayerImpl::LayerTypeAsString() const {
88 return "cc::SolidColorLayerImpl"; 89 return "cc::SolidColorLayerImpl";
89 } 90 }
90 91
91 } // namespace cc 92 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698