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 #ifndef CC_LAYERS_LAYER_H_ | 5 #ifndef CC_LAYERS_LAYER_H_ |
6 #define CC_LAYERS_LAYER_H_ | 6 #define CC_LAYERS_LAYER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "cc/layers/layer_lists.h" | 22 #include "cc/layers/layer_lists.h" |
23 #include "cc/layers/layer_position_constraint.h" | 23 #include "cc/layers/layer_position_constraint.h" |
24 #include "cc/layers/paint_properties.h" | 24 #include "cc/layers/paint_properties.h" |
25 #include "cc/layers/render_surface.h" | 25 #include "cc/layers/render_surface.h" |
26 #include "cc/output/filter_operations.h" | 26 #include "cc/output/filter_operations.h" |
27 #include "cc/trees/occlusion_tracker.h" | 27 #include "cc/trees/occlusion_tracker.h" |
28 #include "skia/ext/refptr.h" | 28 #include "skia/ext/refptr.h" |
29 #include "third_party/skia/include/core/SkColor.h" | 29 #include "third_party/skia/include/core/SkColor.h" |
30 #include "third_party/skia/include/core/SkImageFilter.h" | 30 #include "third_party/skia/include/core/SkImageFilter.h" |
31 #include "third_party/skia/include/core/SkPicture.h" | 31 #include "third_party/skia/include/core/SkPicture.h" |
| 32 #include "third_party/skia/include/core/SkXfermode.h" |
32 #include "ui/gfx/rect.h" | 33 #include "ui/gfx/rect.h" |
33 #include "ui/gfx/rect_f.h" | 34 #include "ui/gfx/rect_f.h" |
34 #include "ui/gfx/transform.h" | 35 #include "ui/gfx/transform.h" |
35 | 36 |
36 namespace gfx { | 37 namespace gfx { |
37 class BoxF; | 38 class BoxF; |
38 } | 39 } |
39 | 40 |
40 namespace cc { | 41 namespace cc { |
41 | 42 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 const Layer* mask_layer() const { return mask_layer_.get(); } | 120 const Layer* mask_layer() const { return mask_layer_.get(); } |
120 | 121 |
121 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect); | 122 virtual void SetNeedsDisplayRect(const gfx::RectF& dirty_rect); |
122 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::RectF(bounds())); } | 123 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::RectF(bounds())); } |
123 | 124 |
124 void SetOpacity(float opacity); | 125 void SetOpacity(float opacity); |
125 float opacity() const { return opacity_; } | 126 float opacity() const { return opacity_; } |
126 bool OpacityIsAnimating() const; | 127 bool OpacityIsAnimating() const; |
127 virtual bool OpacityCanAnimateOnImplThread() const; | 128 virtual bool OpacityCanAnimateOnImplThread() const; |
128 | 129 |
| 130 void SetBlendMode(SkXfermode::Mode blend_mode); |
| 131 SkXfermode::Mode blend_mode() const { return blend_mode_; } |
| 132 |
| 133 bool uses_default_blend_mode() const { |
| 134 return blend_mode_ == SkXfermode::kSrcOver_Mode; |
| 135 } |
| 136 |
| 137 // A layer is root for an isolated group when it and all its descendants are |
| 138 // drawn over a black and fully transparent background, creating an isolated |
| 139 // group. It should be used along with SetBlendMode(), in order to restrict |
| 140 // layers within the group to blend with layers outside this group. |
| 141 void SetIsRootForIsolatedGroup(bool root); |
| 142 bool is_root_for_isolated_group() const { |
| 143 return is_root_for_isolated_group_; |
| 144 } |
| 145 |
129 void SetFilters(const FilterOperations& filters); | 146 void SetFilters(const FilterOperations& filters); |
130 const FilterOperations& filters() const { return filters_; } | 147 const FilterOperations& filters() const { return filters_; } |
131 bool FilterIsAnimating() const; | 148 bool FilterIsAnimating() const; |
132 | 149 |
133 // Background filters are filters applied to what is behind this layer, when | 150 // Background filters are filters applied to what is behind this layer, when |
134 // they are viewed through non-opaque regions in this layer. They are used | 151 // they are viewed through non-opaque regions in this layer. They are used |
135 // through the WebLayer interface, and are not exposed to HTML. | 152 // through the WebLayer interface, and are not exposed to HTML. |
136 void SetBackgroundFilters(const FilterOperations& filters); | 153 void SetBackgroundFilters(const FilterOperations& filters); |
137 const FilterOperations& background_filters() const { | 154 const FilterOperations& background_filters() const { |
138 return background_filters_; | 155 return background_filters_; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 void SetNeedsCommit(); | 469 void SetNeedsCommit(); |
453 // Called when there's been a change in layer structure. Implies both | 470 // Called when there's been a change in layer structure. Implies both |
454 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties. | 471 // SetNeedsUpdate and SetNeedsCommit, but not SetNeedsPushProperties. |
455 void SetNeedsFullTreeSync(); | 472 void SetNeedsFullTreeSync(); |
456 | 473 |
457 // Called when the next commit should wait until the pending tree is activated | 474 // Called when the next commit should wait until the pending tree is activated |
458 // before finishing the commit and unblocking the main thread. Used to ensure | 475 // before finishing the commit and unblocking the main thread. Used to ensure |
459 // unused resources on the impl thread are returned before commit completes. | 476 // unused resources on the impl thread are returned before commit completes. |
460 void SetNextCommitWaitsForActivation(); | 477 void SetNextCommitWaitsForActivation(); |
461 | 478 |
| 479 // Called when the blend mode or filters have been changed. |
| 480 void SetNeedsFilterContextIfNeeded(); |
| 481 |
462 void SetNeedsPushProperties(); | 482 void SetNeedsPushProperties(); |
463 void AddDependentNeedsPushProperties(); | 483 void AddDependentNeedsPushProperties(); |
464 void RemoveDependentNeedsPushProperties(); | 484 void RemoveDependentNeedsPushProperties(); |
465 bool parent_should_know_need_push_properties() const { | 485 bool parent_should_know_need_push_properties() const { |
466 return needs_push_properties() || descendant_needs_push_properties(); | 486 return needs_push_properties() || descendant_needs_push_properties(); |
467 } | 487 } |
468 | 488 |
469 bool IsPropertyChangeAllowed() const; | 489 bool IsPropertyChangeAllowed() const; |
470 | 490 |
471 // If this layer has a scroll parent, it removes |this| from its list of | 491 // If this layer has a scroll parent, it removes |this| from its list of |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 bool have_wheel_event_handlers_; | 565 bool have_wheel_event_handlers_; |
546 bool user_scrollable_horizontal_; | 566 bool user_scrollable_horizontal_; |
547 bool user_scrollable_vertical_; | 567 bool user_scrollable_vertical_; |
548 Region non_fast_scrollable_region_; | 568 Region non_fast_scrollable_region_; |
549 Region touch_event_handler_region_; | 569 Region touch_event_handler_region_; |
550 gfx::PointF position_; | 570 gfx::PointF position_; |
551 gfx::PointF anchor_point_; | 571 gfx::PointF anchor_point_; |
552 SkColor background_color_; | 572 SkColor background_color_; |
553 CompositingReasons compositing_reasons_; | 573 CompositingReasons compositing_reasons_; |
554 float opacity_; | 574 float opacity_; |
| 575 SkXfermode::Mode blend_mode_; |
| 576 bool is_root_for_isolated_group_; |
555 FilterOperations filters_; | 577 FilterOperations filters_; |
556 FilterOperations background_filters_; | 578 FilterOperations background_filters_; |
557 float anchor_point_z_; | 579 float anchor_point_z_; |
558 bool is_container_for_fixed_position_layers_; | 580 bool is_container_for_fixed_position_layers_; |
559 LayerPositionConstraint position_constraint_; | 581 LayerPositionConstraint position_constraint_; |
560 bool is_drawable_; | 582 bool is_drawable_; |
561 bool hide_layer_and_subtree_; | 583 bool hide_layer_and_subtree_; |
562 bool masks_to_bounds_; | 584 bool masks_to_bounds_; |
563 bool contents_opaque_; | 585 bool contents_opaque_; |
564 bool double_sided_; | 586 bool double_sided_; |
(...skipping 25 matching lines...) Expand all Loading... |
590 DrawProperties<Layer> draw_properties_; | 612 DrawProperties<Layer> draw_properties_; |
591 | 613 |
592 PaintProperties paint_properties_; | 614 PaintProperties paint_properties_; |
593 | 615 |
594 DISALLOW_COPY_AND_ASSIGN(Layer); | 616 DISALLOW_COPY_AND_ASSIGN(Layer); |
595 }; | 617 }; |
596 | 618 |
597 } // namespace cc | 619 } // namespace cc |
598 | 620 |
599 #endif // CC_LAYERS_LAYER_H_ | 621 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |