| 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 "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 float width) const { | 320 float width) const { |
| 321 if (!ShowDebugBorders()) | 321 if (!ShowDebugBorders()) |
| 322 return; | 322 return; |
| 323 | 323 |
| 324 gfx::Rect quad_rect(content_bounds); | 324 gfx::Rect quad_rect(content_bounds); |
| 325 gfx::Rect visible_quad_rect(quad_rect); | 325 gfx::Rect visible_quad_rect(quad_rect); |
| 326 DebugBorderDrawQuad* debug_border_quad = | 326 DebugBorderDrawQuad* debug_border_quad = |
| 327 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); | 327 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); |
| 328 debug_border_quad->SetNew( | 328 debug_border_quad->SetNew( |
| 329 shared_quad_state, quad_rect, visible_quad_rect, color, width); | 329 shared_quad_state, quad_rect, visible_quad_rect, color, width); |
| 330 if (contents_opaque()) { |
| 331 // When opaque, draw a second inner border that is thicker than the outer |
| 332 // border, but more transparent. |
| 333 static const float kFillOpacity = 0.3f; |
| 334 SkColor fill_color = SkColorSetA( |
| 335 color, static_cast<uint8_t>(SkColorGetA(color) * kFillOpacity)); |
| 336 float fill_width = width * 3; |
| 337 gfx::Rect fill_rect = quad_rect; |
| 338 fill_rect.Inset(fill_width / 2.f, fill_width / 2.f); |
| 339 gfx::Rect visible_fill_rect = |
| 340 gfx::IntersectRects(visible_quad_rect, fill_rect); |
| 341 DebugBorderDrawQuad* fill_quad = |
| 342 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); |
| 343 fill_quad->SetNew(shared_quad_state, fill_rect, visible_fill_rect, |
| 344 fill_color, fill_width); |
| 345 } |
| 330 } | 346 } |
| 331 | 347 |
| 332 bool LayerImpl::HasDelegatedContent() const { | 348 bool LayerImpl::HasDelegatedContent() const { |
| 333 return false; | 349 return false; |
| 334 } | 350 } |
| 335 | 351 |
| 336 bool LayerImpl::HasContributingDelegatedRenderPasses() const { | 352 bool LayerImpl::HasContributingDelegatedRenderPasses() const { |
| 337 return false; | 353 return false; |
| 338 } | 354 } |
| 339 | 355 |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 SetNeedsPushProperties(); | 1572 SetNeedsPushProperties(); |
| 1557 layer_tree_impl()->set_needs_update_draw_properties(); | 1573 layer_tree_impl()->set_needs_update_draw_properties(); |
| 1558 if (should_have_render_surface) { | 1574 if (should_have_render_surface) { |
| 1559 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); | 1575 render_surface_ = make_scoped_ptr(new RenderSurfaceImpl(this)); |
| 1560 return; | 1576 return; |
| 1561 } | 1577 } |
| 1562 render_surface_.reset(); | 1578 render_surface_.reset(); |
| 1563 } | 1579 } |
| 1564 | 1580 |
| 1565 } // namespace cc | 1581 } // namespace cc |
| OLD | NEW |