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

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

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unittests fixed Created 7 years 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/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "cc/animation/animation_registrar.h" 9 #include "cc/animation/animation_registrar.h"
10 #include "cc/animation/scrollbar_animation_controller.h" 10 #include "cc/animation/scrollbar_animation_controller.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 have_wheel_event_handlers_(false), 46 have_wheel_event_handlers_(false),
47 user_scrollable_horizontal_(true), 47 user_scrollable_horizontal_(true),
48 user_scrollable_vertical_(true), 48 user_scrollable_vertical_(true),
49 background_color_(0), 49 background_color_(0),
50 stacking_order_changed_(false), 50 stacking_order_changed_(false),
51 double_sided_(true), 51 double_sided_(true),
52 layer_property_changed_(false), 52 layer_property_changed_(false),
53 masks_to_bounds_(false), 53 masks_to_bounds_(false),
54 contents_opaque_(false), 54 contents_opaque_(false),
55 opacity_(1.0), 55 opacity_(1.0),
56 blend_mode_(SkXfermode::kSrcOver_Mode),
57 is_root_for_isolated_group_(false),
56 preserves_3d_(false), 58 preserves_3d_(false),
57 use_parent_backface_visibility_(false), 59 use_parent_backface_visibility_(false),
58 draw_checkerboard_for_missing_tiles_(false), 60 draw_checkerboard_for_missing_tiles_(false),
59 draws_content_(false), 61 draws_content_(false),
60 hide_layer_and_subtree_(false), 62 hide_layer_and_subtree_(false),
61 force_render_surface_(false), 63 force_render_surface_(false),
62 is_container_for_fixed_position_layers_(false), 64 is_container_for_fixed_position_layers_(false),
63 draw_depth_(0.f), 65 draw_depth_(0.f),
64 compositing_reasons_(kCompositingReasonUnknown), 66 compositing_reasons_(kCompositingReasonUnknown),
65 current_draw_mode_(DRAW_MODE_NONE), 67 current_draw_mode_(DRAW_MODE_NONE),
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 draw_properties_.render_surface.reset(); 241 draw_properties_.render_surface.reset();
240 } 242 }
241 243
242 scoped_ptr<SharedQuadState> LayerImpl::CreateSharedQuadState() const { 244 scoped_ptr<SharedQuadState> LayerImpl::CreateSharedQuadState() const {
243 scoped_ptr<SharedQuadState> state = SharedQuadState::Create(); 245 scoped_ptr<SharedQuadState> state = SharedQuadState::Create();
244 state->SetAll(draw_properties_.target_space_transform, 246 state->SetAll(draw_properties_.target_space_transform,
245 draw_properties_.content_bounds, 247 draw_properties_.content_bounds,
246 draw_properties_.visible_content_rect, 248 draw_properties_.visible_content_rect,
247 draw_properties_.clip_rect, 249 draw_properties_.clip_rect,
248 draw_properties_.is_clipped, 250 draw_properties_.is_clipped,
249 draw_properties_.opacity); 251 draw_properties_.opacity,
252 blend_mode_);
250 return state.Pass(); 253 return state.Pass();
251 } 254 }
252 255
253 bool LayerImpl::WillDraw(DrawMode draw_mode, 256 bool LayerImpl::WillDraw(DrawMode draw_mode,
254 ResourceProvider* resource_provider) { 257 ResourceProvider* resource_provider) {
255 // WillDraw/DidDraw must be matched. 258 // WillDraw/DidDraw must be matched.
256 DCHECK_NE(DRAW_MODE_NONE, draw_mode); 259 DCHECK_NE(DRAW_MODE_NONE, draw_mode);
257 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); 260 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_);
258 current_draw_mode_ = draw_mode; 261 current_draw_mode_ = draw_mode;
259 return true; 262 return true;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); 520 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_);
518 layer->SetFilters(filters()); 521 layer->SetFilters(filters());
519 layer->SetBackgroundFilters(background_filters()); 522 layer->SetBackgroundFilters(background_filters());
520 layer->SetMasksToBounds(masks_to_bounds_); 523 layer->SetMasksToBounds(masks_to_bounds_);
521 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); 524 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_);
522 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); 525 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
523 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); 526 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
524 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); 527 layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
525 layer->SetContentsOpaque(contents_opaque_); 528 layer->SetContentsOpaque(contents_opaque_);
526 layer->SetOpacity(opacity_); 529 layer->SetOpacity(opacity_);
530 layer->SetBlendMode(blend_mode_);
531 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_);
527 layer->SetPosition(position_); 532 layer->SetPosition(position_);
528 layer->SetIsContainerForFixedPositionLayers( 533 layer->SetIsContainerForFixedPositionLayers(
529 is_container_for_fixed_position_layers_); 534 is_container_for_fixed_position_layers_);
530 layer->SetFixedContainerSizeDelta(fixed_container_size_delta_); 535 layer->SetFixedContainerSizeDelta(fixed_container_size_delta_);
531 layer->SetPositionConstraint(position_constraint_); 536 layer->SetPositionConstraint(position_constraint_);
532 layer->SetPreserves3d(preserves_3d()); 537 layer->SetPreserves3d(preserves_3d());
533 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 538 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
534 layer->SetSublayerTransform(sublayer_transform_); 539 layer->SetSublayerTransform(sublayer_transform_);
535 layer->SetTransform(transform_); 540 layer->SetTransform(transform_);
536 541
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 bool LayerImpl::OpacityIsAnimating() const { 878 bool LayerImpl::OpacityIsAnimating() const {
874 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity); 879 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity);
875 } 880 }
876 881
877 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { 882 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const {
878 Animation* opacity_animation = 883 Animation* opacity_animation =
879 layer_animation_controller_->GetAnimation(Animation::Opacity); 884 layer_animation_controller_->GetAnimation(Animation::Opacity);
880 return opacity_animation && opacity_animation->is_impl_only(); 885 return opacity_animation && opacity_animation->is_impl_only();
881 } 886 }
882 887
888 void LayerImpl::SetBlendMode(SkXfermode::Mode blend_mode) {
889 if (blend_mode_ == blend_mode)
890 return;
891
892 blend_mode_ = blend_mode;
893 NoteLayerPropertyChangedForSubtree();
894 }
895
896 void LayerImpl::SetIsRootForIsolatedGroup(bool root) {
897 if (is_root_for_isolated_group_ == root)
898 return;
899
900 is_root_for_isolated_group_ = root;
901 }
902
883 void LayerImpl::SetPosition(gfx::PointF position) { 903 void LayerImpl::SetPosition(gfx::PointF position) {
884 if (position_ == position) 904 if (position_ == position)
885 return; 905 return;
886 906
887 position_ = position; 907 position_ = position;
888 NoteLayerPropertyChangedForSubtree(); 908 NoteLayerPropertyChangedForSubtree();
889 } 909 }
890 910
891 void LayerImpl::SetPreserves3d(bool preserves3_d) { 911 void LayerImpl::SetPreserves3d(bool preserves3_d) {
892 if (preserves_3d_ == preserves3_d) 912 if (preserves_3d_ == preserves3_d)
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 1294
1275 if (reasons & kCompositingReasonLayerForMask) 1295 if (reasons & kCompositingReasonLayerForMask)
1276 reason_list->AppendString("Is a mask layer"); 1296 reason_list->AppendString("Is a mask layer");
1277 1297
1278 if (reasons & kCompositingReasonOverflowScrollingParent) 1298 if (reasons & kCompositingReasonOverflowScrollingParent)
1279 reason_list->AppendString("Scroll parent is not an ancestor"); 1299 reason_list->AppendString("Scroll parent is not an ancestor");
1280 1300
1281 if (reasons & kCompositingReasonOutOfFlowClipping) 1301 if (reasons & kCompositingReasonOutOfFlowClipping)
1282 reason_list->AppendString("Has clipping ancestor"); 1302 reason_list->AppendString("Has clipping ancestor");
1283 1303
1304 if (reasons & kCompositingReasonIsolateCompositedDescendants)
1305 reason_list->AppendString("Should isolate composited descendants");
1306
1284 return reason_list.PassAs<base::Value>(); 1307 return reason_list.PassAs<base::Value>();
1285 } 1308 }
1286 1309
1287 void LayerImpl::AsValueInto(base::DictionaryValue* state) const { 1310 void LayerImpl::AsValueInto(base::DictionaryValue* state) const {
1288 TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this); 1311 TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this);
1289 state->SetInteger("layer_id", id()); 1312 state->SetInteger("layer_id", id());
1290 state->SetString("layer_name", debug_name()); 1313 state->SetString("layer_name", debug_name());
1291 state->Set("bounds", MathUtil::AsValue(bounds()).release()); 1314 state->Set("bounds", MathUtil::AsValue(bounds()).release());
1292 state->SetInteger("draws_content", DrawsContent()); 1315 state->SetInteger("draws_content", DrawsContent());
1293 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); 1316 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 1372 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
1350 AsValueInto(state.get()); 1373 AsValueInto(state.get());
1351 return state.PassAs<base::Value>(); 1374 return state.PassAs<base::Value>();
1352 } 1375 }
1353 1376
1354 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { 1377 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) {
1355 benchmark->RunOnLayer(this); 1378 benchmark->RunOnLayer(this);
1356 } 1379 }
1357 1380
1358 } // namespace cc 1381 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698