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

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

Issue 2502373003: stop using SkXfermode -- use SkBlendMode instead (Closed)
Patch Set: rebase 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
« no previous file with comments | « cc/ipc/struct_traits_unittest.cc ('k') | cc/layers/layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 base { 41 namespace base {
43 namespace trace_event { 42 namespace trace_event {
44 class ConvertableToTraceFormat; 43 class ConvertableToTraceFormat;
45 } 44 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect); 122 virtual void SetNeedsDisplayRect(const gfx::Rect& dirty_rect);
124 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); } 123 void SetNeedsDisplay() { SetNeedsDisplayRect(gfx::Rect(bounds())); }
125 124
126 virtual void SetOpacity(float opacity); 125 virtual void SetOpacity(float opacity);
127 float opacity() const { return inputs_.opacity; } 126 float opacity() const { return inputs_.opacity; }
128 float EffectiveOpacity() const; 127 float EffectiveOpacity() const;
129 virtual bool OpacityCanAnimateOnImplThread() const; 128 virtual bool OpacityCanAnimateOnImplThread() const;
130 129
131 virtual bool AlwaysUseActiveTreeOpacity() const; 130 virtual bool AlwaysUseActiveTreeOpacity() const;
132 131
133 void SetBlendMode(SkXfermode::Mode blend_mode); 132 void SetBlendMode(SkBlendMode blend_mode);
134 SkXfermode::Mode blend_mode() const { return inputs_.blend_mode; } 133 SkBlendMode blend_mode() const { return inputs_.blend_mode; }
135 134
136 void set_draw_blend_mode(SkXfermode::Mode blend_mode) { 135 void set_draw_blend_mode(SkBlendMode blend_mode) {
137 if (draw_blend_mode_ == blend_mode) 136 if (draw_blend_mode_ == blend_mode)
138 return; 137 return;
139 draw_blend_mode_ = blend_mode; 138 draw_blend_mode_ = blend_mode;
140 SetNeedsPushProperties(); 139 SetNeedsPushProperties();
141 } 140 }
142 SkXfermode::Mode draw_blend_mode() const { return draw_blend_mode_; } 141 SkBlendMode draw_blend_mode() const { return draw_blend_mode_; }
143 142
144 // A layer is root for an isolated group when it and all its descendants are 143 // A layer is root for an isolated group when it and all its descendants are
145 // drawn over a black and fully transparent background, creating an isolated 144 // drawn over a black and fully transparent background, creating an isolated
146 // group. It should be used along with SetBlendMode(), in order to restrict 145 // group. It should be used along with SetBlendMode(), in order to restrict
147 // layers within the group to blend with layers outside this group. 146 // layers within the group to blend with layers outside this group.
148 void SetIsRootForIsolatedGroup(bool root); 147 void SetIsRootForIsolatedGroup(bool root);
149 bool is_root_for_isolated_group() const { 148 bool is_root_for_isolated_group() const {
150 return inputs_.is_root_for_isolated_group; 149 return inputs_.is_root_for_isolated_group;
151 } 150 }
152 151
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // is not available and the update rect will remain empty. 580 // is not available and the update rect will remain empty.
582 // Note this rect is in layer space (not content space). 581 // Note this rect is in layer space (not content space).
583 gfx::Rect update_rect; 582 gfx::Rect update_rect;
584 583
585 gfx::Size bounds; 584 gfx::Size bounds;
586 bool masks_to_bounds; 585 bool masks_to_bounds;
587 586
588 scoped_refptr<Layer> mask_layer; 587 scoped_refptr<Layer> mask_layer;
589 588
590 float opacity; 589 float opacity;
591 SkXfermode::Mode blend_mode; 590 SkBlendMode blend_mode;
592 591
593 bool is_root_for_isolated_group : 1; 592 bool is_root_for_isolated_group : 1;
594 593
595 bool contents_opaque : 1; 594 bool contents_opaque : 1;
596 595
597 gfx::PointF position; 596 gfx::PointF position;
598 gfx::Transform transform; 597 gfx::Transform transform;
599 gfx::Point3F transform_origin; 598 gfx::Point3F transform_origin;
600 599
601 bool is_drawable : 1; 600 bool is_drawable : 1;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 bool should_flatten_transform_from_property_tree_ : 1; 674 bool should_flatten_transform_from_property_tree_ : 1;
676 bool draws_content_ : 1; 675 bool draws_content_ : 1;
677 bool use_local_transform_for_backface_visibility_ : 1; 676 bool use_local_transform_for_backface_visibility_ : 1;
678 bool should_check_backface_visibility_ : 1; 677 bool should_check_backface_visibility_ : 1;
679 bool force_render_surface_for_testing_ : 1; 678 bool force_render_surface_for_testing_ : 1;
680 bool subtree_property_changed_ : 1; 679 bool subtree_property_changed_ : 1;
681 bool may_contain_video_ : 1; 680 bool may_contain_video_ : 1;
682 SkColor safe_opaque_background_color_; 681 SkColor safe_opaque_background_color_;
683 // draw_blend_mode may be different than blend_mode_, 682 // draw_blend_mode may be different than blend_mode_,
684 // when a RenderSurface re-parents the layer's blend_mode. 683 // when a RenderSurface re-parents the layer's blend_mode.
685 SkXfermode::Mode draw_blend_mode_; 684 SkBlendMode draw_blend_mode_;
686 std::unique_ptr<std::set<Layer*>> scroll_children_; 685 std::unique_ptr<std::set<Layer*>> scroll_children_;
687 686
688 std::unique_ptr<std::set<Layer*>> clip_children_; 687 std::unique_ptr<std::set<Layer*>> clip_children_;
689 688
690 PaintProperties paint_properties_; 689 PaintProperties paint_properties_;
691 690
692 // These all act like draw properties, so don't need push properties. 691 // These all act like draw properties, so don't need push properties.
693 gfx::Rect visible_layer_rect_; 692 gfx::Rect visible_layer_rect_;
694 size_t num_unclipped_descendants_; 693 size_t num_unclipped_descendants_;
695 694
696 DISALLOW_COPY_AND_ASSIGN(Layer); 695 DISALLOW_COPY_AND_ASSIGN(Layer);
697 }; 696 };
698 697
699 } // namespace cc 698 } // namespace cc
700 699
701 #endif // CC_LAYERS_LAYER_H_ 700 #endif // CC_LAYERS_LAYER_H_
OLDNEW
« no previous file with comments | « cc/ipc/struct_traits_unittest.cc ('k') | cc/layers/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698