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 22 matching lines...) Expand all Loading... |
33 stacking_order_changed_(false), | 33 stacking_order_changed_(false), |
34 layer_id_(s_next_layer_id++), | 34 layer_id_(s_next_layer_id++), |
35 ignore_set_needs_commit_(false), | 35 ignore_set_needs_commit_(false), |
36 parent_(NULL), | 36 parent_(NULL), |
37 layer_tree_host_(NULL), | 37 layer_tree_host_(NULL), |
38 scrollable_(false), | 38 scrollable_(false), |
39 should_scroll_on_main_thread_(false), | 39 should_scroll_on_main_thread_(false), |
40 have_wheel_event_handlers_(false), | 40 have_wheel_event_handlers_(false), |
41 anchor_point_(0.5f, 0.5f), | 41 anchor_point_(0.5f, 0.5f), |
42 background_color_(0), | 42 background_color_(0), |
| 43 compositing_reasons_(kCompositingReasonUnknown), |
43 opacity_(1.f), | 44 opacity_(1.f), |
44 anchor_point_z_(0.f), | 45 anchor_point_z_(0.f), |
45 is_container_for_fixed_position_layers_(false), | 46 is_container_for_fixed_position_layers_(false), |
46 is_drawable_(false), | 47 is_drawable_(false), |
47 masks_to_bounds_(false), | 48 masks_to_bounds_(false), |
48 contents_opaque_(false), | 49 contents_opaque_(false), |
49 double_sided_(true), | 50 double_sided_(true), |
50 preserves_3d_(false), | 51 preserves_3d_(false), |
51 use_parent_backface_visibility_(false), | 52 use_parent_backface_visibility_(false), |
52 draw_checkerboard_for_missing_tiles_(false), | 53 draw_checkerboard_for_missing_tiles_(false), |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 } | 637 } |
637 | 638 |
638 void Layer::PushPropertiesTo(LayerImpl* layer) { | 639 void Layer::PushPropertiesTo(LayerImpl* layer) { |
639 layer->SetAnchorPoint(anchor_point_); | 640 layer->SetAnchorPoint(anchor_point_); |
640 layer->SetAnchorPointZ(anchor_point_z_); | 641 layer->SetAnchorPointZ(anchor_point_z_); |
641 layer->SetBackgroundColor(background_color_); | 642 layer->SetBackgroundColor(background_color_); |
642 layer->SetBounds(paint_properties_.bounds); | 643 layer->SetBounds(paint_properties_.bounds); |
643 layer->SetContentBounds(content_bounds()); | 644 layer->SetContentBounds(content_bounds()); |
644 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 645 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
645 layer->SetDebugName(debug_name_); | 646 layer->SetDebugName(debug_name_); |
| 647 layer->SetCompositingReasons(compositing_reasons_); |
646 layer->SetDoubleSided(double_sided_); | 648 layer->SetDoubleSided(double_sided_); |
647 layer->SetDrawCheckerboardForMissingTiles( | 649 layer->SetDrawCheckerboardForMissingTiles( |
648 draw_checkerboard_for_missing_tiles_); | 650 draw_checkerboard_for_missing_tiles_); |
649 layer->SetForceRenderSurface(force_render_surface_); | 651 layer->SetForceRenderSurface(force_render_surface_); |
650 layer->SetDrawsContent(DrawsContent()); | 652 layer->SetDrawsContent(DrawsContent()); |
651 layer->SetFilters(filters()); | 653 layer->SetFilters(filters()); |
652 layer->SetFilter(filter()); | 654 layer->SetFilter(filter()); |
653 layer->SetBackgroundFilters(background_filters()); | 655 layer->SetBackgroundFilters(background_filters()); |
654 layer->SetMasksToBounds(masks_to_bounds_); | 656 layer->SetMasksToBounds(masks_to_bounds_); |
655 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 657 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 744 |
743 bool Layer::NeedMoreUpdates() { | 745 bool Layer::NeedMoreUpdates() { |
744 return false; | 746 return false; |
745 } | 747 } |
746 | 748 |
747 void Layer::SetDebugName(const std::string& debug_name) { | 749 void Layer::SetDebugName(const std::string& debug_name) { |
748 debug_name_ = debug_name; | 750 debug_name_ = debug_name; |
749 SetNeedsCommit(); | 751 SetNeedsCommit(); |
750 } | 752 } |
751 | 753 |
| 754 void Layer::SetCompositingReasons(CompositingReasons reasons) { |
| 755 compositing_reasons_ = reasons; |
| 756 } |
| 757 |
752 void Layer::CreateRenderSurface() { | 758 void Layer::CreateRenderSurface() { |
753 DCHECK(!draw_properties_.render_surface); | 759 DCHECK(!draw_properties_.render_surface); |
754 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); | 760 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); |
755 draw_properties_.render_target = this; | 761 draw_properties_.render_target = this; |
756 } | 762 } |
757 | 763 |
758 void Layer::ClearRenderSurface() { | 764 void Layer::ClearRenderSurface() { |
759 draw_properties_.render_surface.reset(); | 765 draw_properties_.render_surface.reset(); |
760 } | 766 } |
761 | 767 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 | 856 |
851 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 857 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
852 return layer_tree_host_->rendering_stats_instrumentation(); | 858 return layer_tree_host_->rendering_stats_instrumentation(); |
853 } | 859 } |
854 | 860 |
855 bool Layer::SupportsLCDText() const { | 861 bool Layer::SupportsLCDText() const { |
856 return false; | 862 return false; |
857 } | 863 } |
858 | 864 |
859 } // namespace cc | 865 } // namespace cc |
OLD | NEW |