| 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 28 matching lines...) Expand all Loading... |
| 39 scrollable_(false), | 39 scrollable_(false), |
| 40 should_scroll_on_main_thread_(false), | 40 should_scroll_on_main_thread_(false), |
| 41 have_wheel_event_handlers_(false), | 41 have_wheel_event_handlers_(false), |
| 42 anchor_point_(0.5f, 0.5f), | 42 anchor_point_(0.5f, 0.5f), |
| 43 background_color_(0), | 43 background_color_(0), |
| 44 compositing_reasons_(kCompositingReasonUnknown), | 44 compositing_reasons_(kCompositingReasonUnknown), |
| 45 opacity_(1.f), | 45 opacity_(1.f), |
| 46 anchor_point_z_(0.f), | 46 anchor_point_z_(0.f), |
| 47 is_container_for_fixed_position_layers_(false), | 47 is_container_for_fixed_position_layers_(false), |
| 48 is_drawable_(false), | 48 is_drawable_(false), |
| 49 hide_layer_and_subtree_(false), |
| 49 masks_to_bounds_(false), | 50 masks_to_bounds_(false), |
| 50 contents_opaque_(false), | 51 contents_opaque_(false), |
| 51 double_sided_(true), | 52 double_sided_(true), |
| 52 preserves_3d_(false), | 53 preserves_3d_(false), |
| 53 use_parent_backface_visibility_(false), | 54 use_parent_backface_visibility_(false), |
| 54 draw_checkerboard_for_missing_tiles_(false), | 55 draw_checkerboard_for_missing_tiles_(false), |
| 55 force_render_surface_(false), | 56 force_render_surface_(false), |
| 56 replica_layer_(NULL), | 57 replica_layer_(NULL), |
| 57 raster_scale_(0.f), | 58 raster_scale_(0.f), |
| 58 layer_scroll_client_(NULL) { | 59 layer_scroll_client_(NULL) { |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 605 |
| 605 void Layer::SetIsDrawable(bool is_drawable) { | 606 void Layer::SetIsDrawable(bool is_drawable) { |
| 606 DCHECK(IsPropertyChangeAllowed()); | 607 DCHECK(IsPropertyChangeAllowed()); |
| 607 if (is_drawable_ == is_drawable) | 608 if (is_drawable_ == is_drawable) |
| 608 return; | 609 return; |
| 609 | 610 |
| 610 is_drawable_ = is_drawable; | 611 is_drawable_ = is_drawable; |
| 611 SetNeedsCommit(); | 612 SetNeedsCommit(); |
| 612 } | 613 } |
| 613 | 614 |
| 615 void Layer::SetHideLayerAndSubtree(bool hide) { |
| 616 DCHECK(IsPropertyChangeAllowed()); |
| 617 if (hide_layer_and_subtree_ == hide) |
| 618 return; |
| 619 |
| 620 hide_layer_and_subtree_ = hide; |
| 621 SetNeedsCommit(); |
| 622 } |
| 623 |
| 614 void Layer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { | 624 void Layer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { |
| 615 update_rect_.Union(dirty_rect); | 625 update_rect_.Union(dirty_rect); |
| 616 needs_display_ = true; | 626 needs_display_ = true; |
| 617 | 627 |
| 618 // Simply mark the contents as dirty. For non-root layers, the call to | 628 // Simply mark the contents as dirty. For non-root layers, the call to |
| 619 // SetNeedsCommit will schedule a fresh compositing pass. | 629 // SetNeedsCommit will schedule a fresh compositing pass. |
| 620 // For the root layer, SetNeedsCommit has no effect. | 630 // For the root layer, SetNeedsCommit has no effect. |
| 621 if (DrawsContent() && !update_rect_.IsEmpty()) | 631 if (DrawsContent() && !update_rect_.IsEmpty()) |
| 622 SetNeedsCommit(); | 632 SetNeedsCommit(); |
| 623 } | 633 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 layer->SetBounds(paint_properties_.bounds); | 682 layer->SetBounds(paint_properties_.bounds); |
| 673 layer->SetContentBounds(content_bounds()); | 683 layer->SetContentBounds(content_bounds()); |
| 674 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 684 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
| 675 layer->SetDebugName(debug_name_); | 685 layer->SetDebugName(debug_name_); |
| 676 layer->SetCompositingReasons(compositing_reasons_); | 686 layer->SetCompositingReasons(compositing_reasons_); |
| 677 layer->SetDoubleSided(double_sided_); | 687 layer->SetDoubleSided(double_sided_); |
| 678 layer->SetDrawCheckerboardForMissingTiles( | 688 layer->SetDrawCheckerboardForMissingTiles( |
| 679 draw_checkerboard_for_missing_tiles_); | 689 draw_checkerboard_for_missing_tiles_); |
| 680 layer->SetForceRenderSurface(force_render_surface_); | 690 layer->SetForceRenderSurface(force_render_surface_); |
| 681 layer->SetDrawsContent(DrawsContent()); | 691 layer->SetDrawsContent(DrawsContent()); |
| 692 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
| 682 layer->SetFilters(filters()); | 693 layer->SetFilters(filters()); |
| 683 layer->SetFilter(filter()); | 694 layer->SetFilter(filter()); |
| 684 layer->SetBackgroundFilters(background_filters()); | 695 layer->SetBackgroundFilters(background_filters()); |
| 685 layer->SetMasksToBounds(masks_to_bounds_); | 696 layer->SetMasksToBounds(masks_to_bounds_); |
| 686 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 697 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
| 687 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); | 698 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); |
| 688 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); | 699 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); |
| 689 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); | 700 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); |
| 690 layer->SetContentsOpaque(contents_opaque_); | 701 layer->SetContentsOpaque(contents_opaque_); |
| 691 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) | 702 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 | 893 |
| 883 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 894 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
| 884 return layer_tree_host_->rendering_stats_instrumentation(); | 895 return layer_tree_host_->rendering_stats_instrumentation(); |
| 885 } | 896 } |
| 886 | 897 |
| 887 bool Layer::SupportsLCDText() const { | 898 bool Layer::SupportsLCDText() const { |
| 888 return false; | 899 return false; |
| 889 } | 900 } |
| 890 | 901 |
| 891 } // namespace cc | 902 } // namespace cc |
| OLD | NEW |