OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "cc/animation/animation.h" | 10 #include "cc/animation/animation.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 336 } |
337 | 337 |
338 void Layer::SetBackgroundColor(SkColor background_color) { | 338 void Layer::SetBackgroundColor(SkColor background_color) { |
339 DCHECK(IsPropertyChangeAllowed()); | 339 DCHECK(IsPropertyChangeAllowed()); |
340 if (background_color_ == background_color) | 340 if (background_color_ == background_color) |
341 return; | 341 return; |
342 background_color_ = background_color; | 342 background_color_ = background_color; |
343 SetNeedsCommit(); | 343 SetNeedsCommit(); |
344 } | 344 } |
345 | 345 |
| 346 SkColor Layer::SafeOpaqueBackgroundColor() const { |
| 347 SkColor color = background_color(); |
| 348 if (SkColorGetA(color) == 255 && !contents_opaque()) { |
| 349 color = SK_ColorTRANSPARENT; |
| 350 } else if (SkColorGetA(color) != 255 && contents_opaque()) { |
| 351 for (const Layer* layer = parent(); layer; |
| 352 layer = layer->parent()) { |
| 353 color = layer->background_color(); |
| 354 if (SkColorGetA(color) == 255) |
| 355 break; |
| 356 } |
| 357 if (SkColorGetA(color) != 255) |
| 358 color = layer_tree_host_->background_color(); |
| 359 if (SkColorGetA(color) != 255) |
| 360 color = SkColorSetA(color, 255); |
| 361 } |
| 362 return color; |
| 363 } |
| 364 |
346 void Layer::CalculateContentsScale( | 365 void Layer::CalculateContentsScale( |
347 float ideal_contents_scale, | 366 float ideal_contents_scale, |
348 float device_scale_factor, | 367 float device_scale_factor, |
349 float page_scale_factor, | 368 float page_scale_factor, |
350 bool animating_transform_to_screen, | 369 bool animating_transform_to_screen, |
351 float* contents_scale_x, | 370 float* contents_scale_x, |
352 float* contents_scale_y, | 371 float* contents_scale_y, |
353 gfx::Size* content_bounds) { | 372 gfx::Size* content_bounds) { |
354 *contents_scale_x = 1; | 373 *contents_scale_x = 1; |
355 *contents_scale_y = 1; | 374 *contents_scale_y = 1; |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 | 875 |
857 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 876 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
858 return layer_tree_host_->rendering_stats_instrumentation(); | 877 return layer_tree_host_->rendering_stats_instrumentation(); |
859 } | 878 } |
860 | 879 |
861 bool Layer::SupportsLCDText() const { | 880 bool Layer::SupportsLCDText() const { |
862 return false; | 881 return false; |
863 } | 882 } |
864 | 883 |
865 } // namespace cc | 884 } // namespace cc |
OLD | NEW |