OLD | NEW |
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/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); | 181 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); |
182 current_draw_mode_ = draw_mode; | 182 current_draw_mode_ = draw_mode; |
183 return true; | 183 return true; |
184 } | 184 } |
185 | 185 |
186 void LayerImpl::DidDraw(ResourceProvider* resource_provider) { | 186 void LayerImpl::DidDraw(ResourceProvider* resource_provider) { |
187 DCHECK_NE(DRAW_MODE_NONE, current_draw_mode_); | 187 DCHECK_NE(DRAW_MODE_NONE, current_draw_mode_); |
188 current_draw_mode_ = DRAW_MODE_NONE; | 188 current_draw_mode_ = DRAW_MODE_NONE; |
189 } | 189 } |
190 | 190 |
191 bool LayerImpl::ShowDebugBorders() const { | 191 bool LayerImpl::ShowDebugBorders(DebugBorderType type) const { |
192 return layer_tree_impl()->debug_state().show_debug_borders; | 192 return layer_tree_impl()->debug_state().show_debug_borders.test(type); |
193 } | 193 } |
194 | 194 |
195 void LayerImpl::GetDebugBorderProperties(SkColor* color, float* width) const { | 195 void LayerImpl::GetDebugBorderProperties(SkColor* color, float* width) const { |
196 float device_scale_factor = | 196 float device_scale_factor = |
197 layer_tree_impl() ? layer_tree_impl()->device_scale_factor() : 1; | 197 layer_tree_impl() ? layer_tree_impl()->device_scale_factor() : 1; |
198 | 198 |
199 if (draws_content_) { | 199 if (draws_content_) { |
200 *color = DebugColors::ContentLayerBorderColor(); | 200 *color = DebugColors::ContentLayerBorderColor(); |
201 *width = DebugColors::ContentLayerBorderWidth(device_scale_factor); | 201 *width = DebugColors::ContentLayerBorderWidth(device_scale_factor); |
202 return; | 202 return; |
(...skipping 20 matching lines...) Expand all Loading... |
223 AppendDebugBorderQuad(render_pass, bounds, shared_quad_state, | 223 AppendDebugBorderQuad(render_pass, bounds, shared_quad_state, |
224 append_quads_data, color, width); | 224 append_quads_data, color, width); |
225 } | 225 } |
226 | 226 |
227 void LayerImpl::AppendDebugBorderQuad(RenderPass* render_pass, | 227 void LayerImpl::AppendDebugBorderQuad(RenderPass* render_pass, |
228 const gfx::Size& bounds, | 228 const gfx::Size& bounds, |
229 const SharedQuadState* shared_quad_state, | 229 const SharedQuadState* shared_quad_state, |
230 AppendQuadsData* append_quads_data, | 230 AppendQuadsData* append_quads_data, |
231 SkColor color, | 231 SkColor color, |
232 float width) const { | 232 float width) const { |
233 if (!ShowDebugBorders()) | 233 if (!ShowDebugBorders(DebugBorderType::LAYER)) |
234 return; | 234 return; |
235 | 235 |
236 gfx::Rect quad_rect(bounds); | 236 gfx::Rect quad_rect(bounds); |
237 gfx::Rect visible_quad_rect(quad_rect); | 237 gfx::Rect visible_quad_rect(quad_rect); |
238 DebugBorderDrawQuad* debug_border_quad = | 238 DebugBorderDrawQuad* debug_border_quad = |
239 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); | 239 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); |
240 debug_border_quad->SetNew( | 240 debug_border_quad->SetNew( |
241 shared_quad_state, quad_rect, visible_quad_rect, color, width); | 241 shared_quad_state, quad_rect, visible_quad_rect, color, width); |
242 if (contents_opaque()) { | 242 if (contents_opaque()) { |
243 // When opaque, draw a second inner border that is thicker than the outer | 243 // When opaque, draw a second inner border that is thicker than the outer |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 | 976 |
977 ScrollTree& LayerImpl::GetScrollTree() const { | 977 ScrollTree& LayerImpl::GetScrollTree() const { |
978 return GetPropertyTrees()->scroll_tree; | 978 return GetPropertyTrees()->scroll_tree; |
979 } | 979 } |
980 | 980 |
981 TransformTree& LayerImpl::GetTransformTree() const { | 981 TransformTree& LayerImpl::GetTransformTree() const { |
982 return GetPropertyTrees()->transform_tree; | 982 return GetPropertyTrees()->transform_tree; |
983 } | 983 } |
984 | 984 |
985 } // namespace cc | 985 } // namespace cc |
OLD | NEW |