Chromium Code Reviews| 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_(WebKit::CompositingReasonUnknown), | |
| 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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 639 } | 640 } |
| 640 | 641 |
| 641 void Layer::PushPropertiesTo(LayerImpl* layer) { | 642 void Layer::PushPropertiesTo(LayerImpl* layer) { |
| 642 layer->SetAnchorPoint(anchor_point_); | 643 layer->SetAnchorPoint(anchor_point_); |
| 643 layer->SetAnchorPointZ(anchor_point_z_); | 644 layer->SetAnchorPointZ(anchor_point_z_); |
| 644 layer->SetBackgroundColor(background_color_); | 645 layer->SetBackgroundColor(background_color_); |
| 645 layer->SetBounds(paint_properties_.bounds); | 646 layer->SetBounds(paint_properties_.bounds); |
| 646 layer->SetContentBounds(content_bounds()); | 647 layer->SetContentBounds(content_bounds()); |
| 647 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 648 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
| 648 layer->SetDebugName(debug_name_); | 649 layer->SetDebugName(debug_name_); |
| 650 layer->SetCompositingReasons(compositing_reasons_); | |
| 649 layer->SetDoubleSided(double_sided_); | 651 layer->SetDoubleSided(double_sided_); |
| 650 layer->SetDrawCheckerboardForMissingTiles( | 652 layer->SetDrawCheckerboardForMissingTiles( |
| 651 draw_checkerboard_for_missing_tiles_); | 653 draw_checkerboard_for_missing_tiles_); |
| 652 layer->SetForceRenderSurface(force_render_surface_); | 654 layer->SetForceRenderSurface(force_render_surface_); |
| 653 layer->SetDrawsContent(DrawsContent()); | 655 layer->SetDrawsContent(DrawsContent()); |
| 654 layer->SetFilters(filters()); | 656 layer->SetFilters(filters()); |
| 655 layer->SetFilter(filter()); | 657 layer->SetFilter(filter()); |
| 656 layer->SetBackgroundFilters(background_filters()); | 658 layer->SetBackgroundFilters(background_filters()); |
| 657 layer->SetMasksToBounds(masks_to_bounds_); | 659 layer->SetMasksToBounds(masks_to_bounds_); |
| 658 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 660 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 740 | 742 |
| 741 bool Layer::NeedMoreUpdates() { | 743 bool Layer::NeedMoreUpdates() { |
| 742 return false; | 744 return false; |
| 743 } | 745 } |
| 744 | 746 |
| 745 void Layer::SetDebugName(const std::string& debug_name) { | 747 void Layer::SetDebugName(const std::string& debug_name) { |
| 746 debug_name_ = debug_name; | 748 debug_name_ = debug_name; |
| 747 SetNeedsCommit(); | 749 SetNeedsCommit(); |
| 748 } | 750 } |
| 749 | 751 |
| 752 void Layer::SetCompositingReasons(WebKit::WebCompositingReasons reasons) { | |
|
danakj
2013/05/15 14:02:43
Add this to the layer unittests?
| |
| 753 compositing_reasons_ = reasons; | |
| 754 SetNeedsCommit(); | |
| 755 } | |
| 756 | |
| 750 void Layer::CreateRenderSurface() { | 757 void Layer::CreateRenderSurface() { |
| 751 DCHECK(!draw_properties_.render_surface); | 758 DCHECK(!draw_properties_.render_surface); |
| 752 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); | 759 draw_properties_.render_surface = make_scoped_ptr(new RenderSurface(this)); |
| 753 draw_properties_.render_target = this; | 760 draw_properties_.render_target = this; |
| 754 } | 761 } |
| 755 | 762 |
| 756 void Layer::ClearRenderSurface() { | 763 void Layer::ClearRenderSurface() { |
| 757 draw_properties_.render_surface.reset(); | 764 draw_properties_.render_surface.reset(); |
| 758 } | 765 } |
| 759 | 766 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 844 | 851 |
| 845 ScrollbarLayer* Layer::ToScrollbarLayer() { | 852 ScrollbarLayer* Layer::ToScrollbarLayer() { |
| 846 return NULL; | 853 return NULL; |
| 847 } | 854 } |
| 848 | 855 |
| 849 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 856 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
| 850 return layer_tree_host_->rendering_stats_instrumentation(); | 857 return layer_tree_host_->rendering_stats_instrumentation(); |
| 851 } | 858 } |
| 852 | 859 |
| 853 } // namespace cc | 860 } // namespace cc |
| OLD | NEW |