Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: cc/layers/layer.h

Issue 2502373003: stop using SkXfermode -- use SkBlendMode instead (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 14 matching lines...) Expand all
25 #include "cc/layers/layer_position_constraint.h" 25 #include "cc/layers/layer_position_constraint.h"
26 #include "cc/layers/paint_properties.h" 26 #include "cc/layers/paint_properties.h"
27 #include "cc/output/filter_operations.h" 27 #include "cc/output/filter_operations.h"
28 #include "cc/trees/element_id.h" 28 #include "cc/trees/element_id.h"
29 #include "cc/trees/layer_tree.h" 29 #include "cc/trees/layer_tree.h"
30 #include "cc/trees/mutator_host_client.h" 30 #include "cc/trees/mutator_host_client.h"
31 #include "cc/trees/property_tree.h" 31 #include "cc/trees/property_tree.h"
32 #include "cc/trees/target_property.h" 32 #include "cc/trees/target_property.h"
33 #include "third_party/skia/include/core/SkColor.h" 33 #include "third_party/skia/include/core/SkColor.h"
34 #include "third_party/skia/include/core/SkPicture.h" 34 #include "third_party/skia/include/core/SkPicture.h"
35 #include "third_party/skia/include/core/SkXfermode.h"
36 #include "ui/gfx/geometry/point3_f.h" 35 #include "ui/gfx/geometry/point3_f.h"
37 #include "ui/gfx/geometry/rect.h" 36 #include "ui/gfx/geometry/rect.h"
38 #include "ui/gfx/geometry/rect_f.h" 37 #include "ui/gfx/geometry/rect_f.h"
39 #include "ui/gfx/geometry/scroll_offset.h" 38 #include "ui/gfx/geometry/scroll_offset.h"
40 #include "ui/gfx/transform.h" 39 #include "ui/gfx/transform.h"
41 40
42 namespace gfx { 41 namespace gfx {
43 class BoxF; 42 class BoxF;
44 } 43 }
45 44
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect); 132 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect);
134 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); } 133 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); }
135 134
136 virtual void SetOpacity(float opacity); 135 virtual void SetOpacity(float opacity);
137 float opacity() const { return inputs_.opacity; } 136 float opacity() const { return inputs_.opacity; }
138 float EffectiveOpacity() const; 137 float EffectiveOpacity() const;
139 virtual bool OpacityCanAnimateOnImplThread() const; 138 virtual bool OpacityCanAnimateOnImplThread() const;
140 139
141 virtual bool AlwaysUseActiveTreeOpacity() const; 140 virtual bool AlwaysUseActiveTreeOpacity() const;
142 141
143 void SetBlendMode(SkXfermode::Mode blend_mode); 142 void SetBlendMode(SkBlendMode blend_mode);
144 SkXfermode::Mode blend_mode() const { return inputs_.blend_mode; } 143 SkBlendMode blend_mode() const { return inputs_.blend_mode; }
145 144
146 void set_draw_blend_mode(SkXfermode::Mode blend_mode) { 145 void set_draw_blend_mode(SkBlendMode blend_mode) {
147 if (draw_blend_mode_ == blend_mode) 146 if (draw_blend_mode_ == blend_mode)
148 return; 147 return;
149 draw_blend_mode_ = blend_mode; 148 draw_blend_mode_ = blend_mode;
150 SetNeedsPushProperties(); 149 SetNeedsPushProperties();
151 } 150 }
152 SkXfermode::Mode draw_blend_mode() const { return draw_blend_mode_; } 151 SkBlendMode draw_blend_mode() const { return draw_blend_mode_; }
153 152
154 // A layer is root for an isolated group when it and all its descendants are 153 // A layer is root for an isolated group when it and all its descendants are
155 // drawn over a black and fully transparent background, creating an isolated 154 // drawn over a black and fully transparent background, creating an isolated
156 // group. It should be used along with SetBlendMode(), in order to restrict 155 // group. It should be used along with SetBlendMode(), in order to restrict
157 // layers within the group to blend with layers outside this group. 156 // layers within the group to blend with layers outside this group.
158 void SetIsRootForIsolatedGroup(bool root); 157 void SetIsRootForIsolatedGroup(bool root);
159 bool is_root_for_isolated_group() const { 158 bool is_root_for_isolated_group() const {
160 return inputs_.is_root_for_isolated_group; 159 return inputs_.is_root_for_isolated_group;
161 } 160 }
162 161
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // is not available and the update rect will remain empty. 590 // is not available and the update rect will remain empty.
592 // Note this rect is in layer space (not content space). 591 // Note this rect is in layer space (not content space).
593 gfx::Rect update_rect; 592 gfx::Rect update_rect;
594 593
595 gfx::Size bounds; 594 gfx::Size bounds;
596 bool masks_to_bounds; 595 bool masks_to_bounds;
597 596
598 scoped_refptr<Layer> mask_layer; 597 scoped_refptr<Layer> mask_layer;
599 598
600 float opacity; 599 float opacity;
601 SkXfermode::Mode blend_mode; 600 SkBlendMode blend_mode;
602 601
603 bool is_root_for_isolated_group : 1; 602 bool is_root_for_isolated_group : 1;
604 603
605 bool contents_opaque : 1; 604 bool contents_opaque : 1;
606 605
607 gfx::PointF position; 606 gfx::PointF position;
608 gfx::Transform transform; 607 gfx::Transform transform;
609 gfx::Point3F transform_origin; 608 gfx::Point3F transform_origin;
610 609
611 bool is_drawable : 1; 610 bool is_drawable : 1;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 bool should_flatten_transform_from_property_tree_ : 1; 684 bool should_flatten_transform_from_property_tree_ : 1;
686 bool draws_content_ : 1; 685 bool draws_content_ : 1;
687 bool use_local_transform_for_backface_visibility_ : 1; 686 bool use_local_transform_for_backface_visibility_ : 1;
688 bool should_check_backface_visibility_ : 1; 687 bool should_check_backface_visibility_ : 1;
689 bool force_render_surface_for_testing_ : 1; 688 bool force_render_surface_for_testing_ : 1;
690 bool subtree_property_changed_ : 1; 689 bool subtree_property_changed_ : 1;
691 bool may_contain_video_ : 1; 690 bool may_contain_video_ : 1;
692 SkColor safe_opaque_background_color_; 691 SkColor safe_opaque_background_color_;
693 // draw_blend_mode may be different than blend_mode_, 692 // draw_blend_mode may be different than blend_mode_,
694 // when a RenderSurface re-parents the layer's blend_mode. 693 // when a RenderSurface re-parents the layer's blend_mode.
695 SkXfermode::Mode draw_blend_mode_; 694 SkBlendMode draw_blend_mode_;
696 std::unique_ptr<std::set<Layer*>> scroll_children_; 695 std::unique_ptr<std::set<Layer*>> scroll_children_;
697 696
698 std::unique_ptr<std::set<Layer*>> clip_children_; 697 std::unique_ptr<std::set<Layer*>> clip_children_;
699 698
700 PaintProperties paint_properties_; 699 PaintProperties paint_properties_;
701 700
702 // These all act like draw properties, so don't need push properties. 701 // These all act like draw properties, so don't need push properties.
703 gfx::Rect visible_layer_rect_; 702 gfx::Rect visible_layer_rect_;
704 size_t num_unclipped_descendants_; 703 size_t num_unclipped_descendants_;
705 704
706 DISALLOW_COPY_AND_ASSIGN(Layer); 705 DISALLOW_COPY_AND_ASSIGN(Layer);
707 }; 706 };
708 707
709 } // namespace cc 708 } // namespace cc
710 709
711 #endif // CC_LAYERS_LAYER_H_ 710 #endif // CC_LAYERS_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698