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