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