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

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

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moving blend_mode property to SharedQuadState Created 7 years, 2 months 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 #include "cc/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 27 matching lines...) Expand all
38 ignore_set_needs_commit_(false), 38 ignore_set_needs_commit_(false),
39 parent_(NULL), 39 parent_(NULL),
40 layer_tree_host_(NULL), 40 layer_tree_host_(NULL),
41 scrollable_(false), 41 scrollable_(false),
42 should_scroll_on_main_thread_(false), 42 should_scroll_on_main_thread_(false),
43 have_wheel_event_handlers_(false), 43 have_wheel_event_handlers_(false),
44 anchor_point_(0.5f, 0.5f), 44 anchor_point_(0.5f, 0.5f),
45 background_color_(0), 45 background_color_(0),
46 compositing_reasons_(kCompositingReasonUnknown), 46 compositing_reasons_(kCompositingReasonUnknown),
47 opacity_(1.f), 47 opacity_(1.f),
48 blend_mode_(SkXfermode::kSrcOver_Mode),
49 is_root_for_isolated_group_(false),
48 anchor_point_z_(0.f), 50 anchor_point_z_(0.f),
49 is_container_for_fixed_position_layers_(false), 51 is_container_for_fixed_position_layers_(false),
50 is_drawable_(false), 52 is_drawable_(false),
51 hide_layer_and_subtree_(false), 53 hide_layer_and_subtree_(false),
52 masks_to_bounds_(false), 54 masks_to_bounds_(false),
53 contents_opaque_(false), 55 contents_opaque_(false),
54 double_sided_(true), 56 double_sided_(true),
55 preserves_3d_(false), 57 preserves_3d_(false),
56 use_parent_backface_visibility_(false), 58 use_parent_backface_visibility_(false),
57 draw_checkerboard_for_missing_tiles_(false), 59 draw_checkerboard_for_missing_tiles_(false),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 layer_animation_controller_->SetAnimationRegistrar( 119 layer_animation_controller_->SetAnimationRegistrar(
118 host->animation_registrar()); 120 host->animation_registrar());
119 121
120 if (host->settings().layer_transforms_should_scale_layer_contents) 122 if (host->settings().layer_transforms_should_scale_layer_contents)
121 reset_raster_scale_to_unknown(); 123 reset_raster_scale_to_unknown();
122 } 124 }
123 125
124 if (host && layer_animation_controller_->has_any_animation()) 126 if (host && layer_animation_controller_->has_any_animation())
125 host->SetNeedsCommit(); 127 host->SetNeedsCommit();
126 if (host && 128 if (host &&
127 (!filters_.IsEmpty() || !background_filters_.IsEmpty() || filter_)) 129 (!filters_.IsEmpty() || !background_filters_.IsEmpty() || filter_ ||
130 has_blend_mode()))
128 layer_tree_host_->set_needs_filter_context(); 131 layer_tree_host_->set_needs_filter_context();
129 } 132 }
130 133
131 void Layer::SetNeedsUpdate() { 134 void Layer::SetNeedsUpdate() {
132 if (layer_tree_host_ && !ignore_set_needs_commit_) 135 if (layer_tree_host_ && !ignore_set_needs_commit_)
133 layer_tree_host_->SetNeedsUpdateLayers(); 136 layer_tree_host_->SetNeedsUpdateLayers();
134 } 137 }
135 138
136 void Layer::SetNeedsCommit() { 139 void Layer::SetNeedsCommit() {
137 if (!layer_tree_host_) 140 if (!layer_tree_host_)
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 } 512 }
510 513
511 bool Layer::OpacityIsAnimating() const { 514 bool Layer::OpacityIsAnimating() const {
512 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity); 515 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity);
513 } 516 }
514 517
515 bool Layer::OpacityCanAnimateOnImplThread() const { 518 bool Layer::OpacityCanAnimateOnImplThread() const {
516 return false; 519 return false;
517 } 520 }
518 521
522 void Layer::SetBlendMode(SkXfermode::Mode blendMode) {
523 if (blend_mode_ == blendMode)
524 return;
525 blend_mode_ = blendMode;
526 SetNeedsCommit();
527 if (has_blend_mode() && layer_tree_host_)
528 layer_tree_host_->set_needs_filter_context();
529 }
530
531 void Layer::SetIsRootForIsolatedGroup(bool root) {
532 if (is_root_for_isolated_group_ == root)
533 return;
534 is_root_for_isolated_group_ = root;
535 SetNeedsCommit();
536 }
537
519 void Layer::SetContentsOpaque(bool opaque) { 538 void Layer::SetContentsOpaque(bool opaque) {
520 DCHECK(IsPropertyChangeAllowed()); 539 DCHECK(IsPropertyChangeAllowed());
521 if (contents_opaque_ == opaque) 540 if (contents_opaque_ == opaque)
522 return; 541 return;
523 contents_opaque_ = opaque; 542 contents_opaque_ = opaque;
524 SetNeedsCommit(); 543 SetNeedsCommit();
525 } 544 }
526 545
527 void Layer::SetPosition(gfx::PointF position) { 546 void Layer::SetPosition(gfx::PointF position) {
528 DCHECK(IsPropertyChangeAllowed()); 547 DCHECK(IsPropertyChangeAllowed());
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 layer->SetBackgroundFilters(background_filters()); 844 layer->SetBackgroundFilters(background_filters());
826 layer->SetMasksToBounds(masks_to_bounds_); 845 layer->SetMasksToBounds(masks_to_bounds_);
827 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); 846 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_);
828 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); 847 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
829 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); 848 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
830 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); 849 layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
831 layer->SetContentsOpaque(contents_opaque_); 850 layer->SetContentsOpaque(contents_opaque_);
832 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) 851 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating())
833 layer->SetOpacity(opacity_); 852 layer->SetOpacity(opacity_);
834 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly())); 853 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly()));
854 layer->SetBlendMode(blend_mode_);
855 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_);
835 layer->SetPosition(position_); 856 layer->SetPosition(position_);
836 layer->SetIsContainerForFixedPositionLayers( 857 layer->SetIsContainerForFixedPositionLayers(
837 IsContainerForFixedPositionLayers()); 858 IsContainerForFixedPositionLayers());
838 layer->SetFixedContainerSizeDelta(gfx::Vector2dF()); 859 layer->SetFixedContainerSizeDelta(gfx::Vector2dF());
839 layer->SetPositionConstraint(position_constraint_); 860 layer->SetPositionConstraint(position_constraint_);
840 layer->SetPreserves3d(preserves_3d()); 861 layer->SetPreserves3d(preserves_3d());
841 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 862 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
842 layer->SetSublayerTransform(sublayer_transform_); 863 layer->SetSublayerTransform(sublayer_transform_);
843 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) 864 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating())
844 layer->SetTransform(transform_); 865 layer->SetTransform(transform_);
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 (*it)->clip_parent_ = NULL; 1113 (*it)->clip_parent_ = NULL;
1093 } 1114 }
1094 1115
1095 if (clip_parent_) 1116 if (clip_parent_)
1096 clip_parent_->RemoveClipChild(this); 1117 clip_parent_->RemoveClipChild(this);
1097 1118
1098 clip_parent_ = NULL; 1119 clip_parent_ = NULL;
1099 } 1120 }
1100 1121
1101 } // namespace cc 1122 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698