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

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: Adding compositor pixel tests, clang-format 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() ||
enne (OOO) 2013/11/01 18:49:02 Can you combine all these conditions in a single "
rosca 2013/11/04 17:14:34 Done.
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 blend_mode) {
510 if (blend_mode_ == blend_mode)
511 return;
512 blend_mode_ = blend_mode;
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 layer->SetBackgroundFilters(background_filters()); 832 layer->SetBackgroundFilters(background_filters());
814 layer->SetMasksToBounds(masks_to_bounds_); 833 layer->SetMasksToBounds(masks_to_bounds_);
815 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); 834 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_);
816 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); 835 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
817 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); 836 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
818 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); 837 layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
819 layer->SetContentsOpaque(contents_opaque_); 838 layer->SetContentsOpaque(contents_opaque_);
820 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating()) 839 if (!layer->OpacityIsAnimatingOnImplOnly() && !OpacityIsAnimating())
821 layer->SetOpacity(opacity_); 840 layer->SetOpacity(opacity_);
822 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly())); 841 DCHECK(!(OpacityIsAnimating() && layer->OpacityIsAnimatingOnImplOnly()));
842 layer->SetBlendMode(blend_mode_);
843 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_);
823 layer->SetPosition(position_); 844 layer->SetPosition(position_);
824 layer->SetIsContainerForFixedPositionLayers( 845 layer->SetIsContainerForFixedPositionLayers(
825 IsContainerForFixedPositionLayers()); 846 IsContainerForFixedPositionLayers());
826 layer->SetFixedContainerSizeDelta(gfx::Vector2dF()); 847 layer->SetFixedContainerSizeDelta(gfx::Vector2dF());
827 layer->SetPositionConstraint(position_constraint_); 848 layer->SetPositionConstraint(position_constraint_);
828 layer->SetPreserves3d(preserves_3d()); 849 layer->SetPreserves3d(preserves_3d());
829 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 850 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
830 layer->SetSublayerTransform(sublayer_transform_); 851 layer->SetSublayerTransform(sublayer_transform_);
831 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) 852 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating())
832 layer->SetTransform(transform_); 853 layer->SetTransform(transform_);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 clip_parent_->RemoveClipChild(this); 1105 clip_parent_->RemoveClipChild(this);
1085 1106
1086 clip_parent_ = NULL; 1107 clip_parent_ = NULL;
1087 } 1108 }
1088 1109
1089 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { 1110 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
1090 benchmark->RunOnLayer(this); 1111 benchmark->RunOnLayer(this);
1091 } 1112 }
1092 1113
1093 } // namespace cc 1114 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | cc/output/gl_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698