Chromium Code Reviews| 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 SolidColorDrawQuad* solid_quad = | |
| 366 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | |
| 367 // The inner fill is more transparent then the border. | |
| 368 SkColor fill_color = SkColorSetA( | |
| 369 colors[i % kNumColors], | |
| 370 static_cast<uint8_t>(SkColorGetA(colors[i % kNumColors]) * 0.1f)); | |
|
vmpstr
2015/02/11 22:22:22
nit: make 0.1 a kConstant above? maybe?
danakj
2015/02/11 23:44:01
Done.
| |
| 371 gfx::Rect fill_rect(x, 0, width, content_bounds().height()); | |
|
vmpstr
2015/02/11 22:22:22
Can you put a comment saying that blah blah vertic
danakj
2015/02/11 23:44:01
Done.
| |
| 372 solid_quad->SetNew(shared_quad_state, fill_rect, fill_rect, fill_color, | |
| 373 force_anti_aliasing_off); | |
| 374 } | |
| 364 } | 375 } |
| 365 if (!left.IsEmpty()) { | 376 if (!left.IsEmpty()) { |
| 377 bool force_anti_aliasing_off = false; | |
| 366 SolidColorDrawQuad* left_quad = | 378 SolidColorDrawQuad* left_quad = |
| 367 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 379 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 368 left_quad->SetNew(shared_quad_state, | 380 left_quad->SetNew(shared_quad_state, left, left, |
| 369 left, | |
| 370 left, | |
| 371 colors[kNumColors - 1 - (i % kNumColors)], | 381 colors[kNumColors - 1 - (i % kNumColors)], |
| 372 false); | 382 force_anti_aliasing_off); |
| 373 | 383 |
| 374 SolidColorDrawQuad* right_quad = | 384 SolidColorDrawQuad* right_quad = |
| 375 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 385 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 376 right_quad->SetNew( | 386 right_quad->SetNew(shared_quad_state, right, right, |
| 377 shared_quad_state, right, right, colors[i % kNumColors], false); | 387 colors[i % kNumColors], force_anti_aliasing_off); |
| 378 } | 388 } |
| 379 } | 389 } |
| 380 } | 390 } |
| 381 | 391 |
| 382 void DelegatedRendererLayerImpl::AppendRenderPassQuads( | 392 void DelegatedRendererLayerImpl::AppendRenderPassQuads( |
| 383 RenderPass* render_pass, | 393 RenderPass* render_pass, |
| 384 const Occlusion& occlusion_in_content_space, | 394 const Occlusion& occlusion_in_content_space, |
| 385 const RenderPass* delegated_render_pass, | 395 const RenderPass* delegated_render_pass, |
| 386 const gfx::Size& frame_size) const { | 396 const gfx::Size& frame_size) const { |
| 387 const SharedQuadState* delegated_shared_quad_state = nullptr; | 397 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_) { | 497 if (own_child_id_) { |
| 488 ResourceProvider* provider = layer_tree_impl()->resource_provider(); | 498 ResourceProvider* provider = layer_tree_impl()->resource_provider(); |
| 489 provider->DestroyChild(child_id_); | 499 provider->DestroyChild(child_id_); |
| 490 } | 500 } |
| 491 | 501 |
| 492 resources_.clear(); | 502 resources_.clear(); |
| 493 child_id_ = 0; | 503 child_id_ = 0; |
| 494 } | 504 } |
| 495 | 505 |
| 496 } // namespace cc | 506 } // namespace cc |
| OLD | NEW |