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