| 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/delegated_renderer_layer_impl.h" | 5 #include "cc/layers/delegated_renderer_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 gfx::Rect left(0, y, border_width, height); | 342 gfx::Rect left(0, y, border_width, height); |
| 343 gfx::Rect right(content_bounds().width() - border_width, | 343 gfx::Rect right(content_bounds().width() - border_width, |
| 344 y, | 344 y, |
| 345 border_width, | 345 border_width, |
| 346 height); | 346 height); |
| 347 | 347 |
| 348 if (top.IsEmpty() && left.IsEmpty()) | 348 if (top.IsEmpty() && left.IsEmpty()) |
| 349 break; | 349 break; |
| 350 | 350 |
| 351 if (!top.IsEmpty()) { | 351 if (!top.IsEmpty()) { |
| 352 bool force_anti_aliasing_off = false; |
| 352 SolidColorDrawQuad* top_quad = | 353 SolidColorDrawQuad* top_quad = |
| 353 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 354 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 354 top_quad->SetNew( | 355 top_quad->SetNew(shared_quad_state, top, top, colors[i % kNumColors], |
| 355 shared_quad_state, top, top, colors[i % kNumColors], false); | 356 force_anti_aliasing_off); |
| 356 | 357 |
| 357 SolidColorDrawQuad* bottom_quad = | 358 SolidColorDrawQuad* bottom_quad = |
| 358 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 359 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 359 bottom_quad->SetNew(shared_quad_state, | 360 bottom_quad->SetNew(shared_quad_state, bottom, bottom, |
| 360 bottom, | |
| 361 bottom, | |
| 362 colors[kNumColors - 1 - (i % kNumColors)], | 361 colors[kNumColors - 1 - (i % kNumColors)], |
| 363 false); | 362 force_anti_aliasing_off); |
| 363 |
| 364 if (contents_opaque()) { |
| 365 // Draws a stripe filling the layer vertically with the same color and |
| 366 // width as the horizontal stipes along the layer's top border. |
| 367 SolidColorDrawQuad* solid_quad = |
| 368 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 369 // The inner fill is more transparent then the border. |
| 370 static const float kFillOpacity = 0.1f; |
| 371 SkColor fill_color = SkColorSetA( |
| 372 colors[i % kNumColors], |
| 373 static_cast<uint8_t>(SkColorGetA(colors[i % kNumColors]) * |
| 374 kFillOpacity)); |
| 375 gfx::Rect fill_rect(x, 0, width, content_bounds().height()); |
| 376 solid_quad->SetNew(shared_quad_state, fill_rect, fill_rect, fill_color, |
| 377 force_anti_aliasing_off); |
| 378 } |
| 364 } | 379 } |
| 365 if (!left.IsEmpty()) { | 380 if (!left.IsEmpty()) { |
| 381 bool force_anti_aliasing_off = false; |
| 366 SolidColorDrawQuad* left_quad = | 382 SolidColorDrawQuad* left_quad = |
| 367 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 383 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 368 left_quad->SetNew(shared_quad_state, | 384 left_quad->SetNew(shared_quad_state, left, left, |
| 369 left, | |
| 370 left, | |
| 371 colors[kNumColors - 1 - (i % kNumColors)], | 385 colors[kNumColors - 1 - (i % kNumColors)], |
| 372 false); | 386 force_anti_aliasing_off); |
| 373 | 387 |
| 374 SolidColorDrawQuad* right_quad = | 388 SolidColorDrawQuad* right_quad = |
| 375 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 389 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 376 right_quad->SetNew( | 390 right_quad->SetNew(shared_quad_state, right, right, |
| 377 shared_quad_state, right, right, colors[i % kNumColors], false); | 391 colors[i % kNumColors], force_anti_aliasing_off); |
| 378 } | 392 } |
| 379 } | 393 } |
| 380 } | 394 } |
| 381 | 395 |
| 382 void DelegatedRendererLayerImpl::AppendRenderPassQuads( | 396 void DelegatedRendererLayerImpl::AppendRenderPassQuads( |
| 383 RenderPass* render_pass, | 397 RenderPass* render_pass, |
| 384 const Occlusion& occlusion_in_content_space, | 398 const Occlusion& occlusion_in_content_space, |
| 385 const RenderPass* delegated_render_pass, | 399 const RenderPass* delegated_render_pass, |
| 386 const gfx::Size& frame_size) const { | 400 const gfx::Size& frame_size) const { |
| 387 const SharedQuadState* delegated_shared_quad_state = nullptr; | 401 const SharedQuadState* delegated_shared_quad_state = nullptr; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 if (own_child_id_) { | 501 if (own_child_id_) { |
| 488 ResourceProvider* provider = layer_tree_impl()->resource_provider(); | 502 ResourceProvider* provider = layer_tree_impl()->resource_provider(); |
| 489 provider->DestroyChild(child_id_); | 503 provider->DestroyChild(child_id_); |
| 490 } | 504 } |
| 491 | 505 |
| 492 resources_.clear(); | 506 resources_.clear(); |
| 493 child_id_ = 0; | 507 child_id_ = 0; |
| 494 } | 508 } |
| 495 | 509 |
| 496 } // namespace cc | 510 } // namespace cc |
| OLD | NEW |