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

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: Added compositor_bindungs 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (host) { 118 if (host) {
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 && (!filters_.IsEmpty() || !background_filters_.IsEmpty())) 128 if (host && (!filters_.IsEmpty() || !background_filters_.IsEmpty() ||
129 !uses_default_blend_mode()))
127 layer_tree_host_->set_needs_filter_context(); 130 layer_tree_host_->set_needs_filter_context();
128 } 131 }
129 132
130 void Layer::SetNeedsUpdate() { 133 void Layer::SetNeedsUpdate() {
131 if (layer_tree_host_ && !ignore_set_needs_commit_) 134 if (layer_tree_host_ && !ignore_set_needs_commit_)
132 layer_tree_host_->SetNeedsUpdateLayers(); 135 layer_tree_host_->SetNeedsUpdateLayers();
133 } 136 }
134 137
135 void Layer::SetNeedsCommit() { 138 void Layer::SetNeedsCommit() {
136 if (!layer_tree_host_) 139 if (!layer_tree_host_)
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 499 }
497 500
498 bool Layer::OpacityIsAnimating() const { 501 bool Layer::OpacityIsAnimating() const {
499 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity); 502 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity);
500 } 503 }
501 504
502 bool Layer::OpacityCanAnimateOnImplThread() const { 505 bool Layer::OpacityCanAnimateOnImplThread() const {
503 return false; 506 return false;
504 } 507 }
505 508
509 void Layer::SetBlendMode(SkXfermode::Mode blendMode) {
enne (OOO) 2013/10/11 18:14:35 blend_mode
rosca 2013/10/16 14:54:47 Done.
510 if (blend_mode_ == blendMode)
511 return;
512 blend_mode_ = blendMode;
513 SetNeedsCommit();
514 if (!uses_default_blend_mode() && layer_tree_host_)
515 layer_tree_host_->set_needs_filter_context();
516 }
517
518 void Layer::SetIsRootForIsolatedGroup(bool root) {
519 if (is_root_for_isolated_group_ == root)
520 return;
521 is_root_for_isolated_group_ = root;
522 SetNeedsCommit();
523 }
524
506 void Layer::SetContentsOpaque(bool opaque) { 525 void Layer::SetContentsOpaque(bool opaque) {
507 DCHECK(IsPropertyChangeAllowed()); 526 DCHECK(IsPropertyChangeAllowed());
508 if (contents_opaque_ == opaque) 527 if (contents_opaque_ == opaque)
509 return; 528 return;
510 contents_opaque_ = opaque; 529 contents_opaque_ = opaque;
511 SetNeedsCommit(); 530 SetNeedsCommit();
512 } 531 }
513 532
514 void Layer::SetPosition(gfx::PointF position) { 533 void Layer::SetPosition(gfx::PointF position) {
515 DCHECK(IsPropertyChangeAllowed()); 534 DCHECK(IsPropertyChangeAllowed());
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 layer->SetBackgroundFilters(background_filters()); 830 layer->SetBackgroundFilters(background_filters());
812 layer->SetMasksToBounds(masks_to_bounds_); 831 layer->SetMasksToBounds(masks_to_bounds_);
813 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); 832 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_);
814 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); 833 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
815 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); 834 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
816 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); 835 layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
817 layer->SetContentsOpaque(contents_opaque_); 836 layer->SetContentsOpaque(contents_opaque_);
818 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) 837 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating())
819 layer->SetOpacity(opacity_); 838 layer->SetOpacity(opacity_);
820 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly())); 839 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly()));
840 layer->SetBlendMode(blend_mode_);
841 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_);
821 layer->SetPosition(position_); 842 layer->SetPosition(position_);
822 layer->SetIsContainerForFixedPositionLayers( 843 layer->SetIsContainerForFixedPositionLayers(
823 IsContainerForFixedPositionLayers()); 844 IsContainerForFixedPositionLayers());
824 layer->SetFixedContainerSizeDelta(gfx::Vector2dF()); 845 layer->SetFixedContainerSizeDelta(gfx::Vector2dF());
825 layer->SetPositionConstraint(position_constraint_); 846 layer->SetPositionConstraint(position_constraint_);
826 layer->SetPreserves3d(preserves_3d()); 847 layer->SetPreserves3d(preserves_3d());
827 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 848 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
828 layer->SetSublayerTransform(sublayer_transform_); 849 layer->SetSublayerTransform(sublayer_transform_);
829 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) 850 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating())
830 layer->SetTransform(transform_); 851 layer->SetTransform(transform_);
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 (*it)->clip_parent_ = NULL; 1099 (*it)->clip_parent_ = NULL;
1079 } 1100 }
1080 1101
1081 if (clip_parent_) 1102 if (clip_parent_)
1082 clip_parent_->RemoveClipChild(this); 1103 clip_parent_->RemoveClipChild(this);
1083 1104
1084 clip_parent_ = NULL; 1105 clip_parent_ = NULL;
1085 } 1106 }
1086 1107
1087 } // namespace cc 1108 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698