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

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: rebase Created 7 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 have_wheel_event_handlers_(false), 44 have_wheel_event_handlers_(false),
45 user_scrollable_horizontal_(true), 45 user_scrollable_horizontal_(true),
46 user_scrollable_vertical_(true), 46 user_scrollable_vertical_(true),
47 background_color_(0), 47 background_color_(0),
48 stacking_order_changed_(false), 48 stacking_order_changed_(false),
49 double_sided_(true), 49 double_sided_(true),
50 layer_property_changed_(false), 50 layer_property_changed_(false),
51 masks_to_bounds_(false), 51 masks_to_bounds_(false),
52 contents_opaque_(false), 52 contents_opaque_(false),
53 opacity_(1.0), 53 opacity_(1.0),
54 blend_mode_(SkXfermode::kSrcOver_Mode),
55 is_root_for_isolated_group_(false),
54 preserves_3d_(false), 56 preserves_3d_(false),
55 use_parent_backface_visibility_(false), 57 use_parent_backface_visibility_(false),
56 draw_checkerboard_for_missing_tiles_(false), 58 draw_checkerboard_for_missing_tiles_(false),
57 draws_content_(false), 59 draws_content_(false),
58 hide_layer_and_subtree_(false), 60 hide_layer_and_subtree_(false),
59 force_render_surface_(false), 61 force_render_surface_(false),
60 is_container_for_fixed_position_layers_(false), 62 is_container_for_fixed_position_layers_(false),
61 draw_depth_(0.f), 63 draw_depth_(0.f),
62 compositing_reasons_(kCompositingReasonUnknown), 64 compositing_reasons_(kCompositingReasonUnknown),
63 current_draw_mode_(DRAW_MODE_NONE), 65 current_draw_mode_(DRAW_MODE_NONE),
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 draw_properties_.render_surface.reset(); 239 draw_properties_.render_surface.reset();
238 } 240 }
239 241
240 scoped_ptr<SharedQuadState> LayerImpl::CreateSharedQuadState() const { 242 scoped_ptr<SharedQuadState> LayerImpl::CreateSharedQuadState() const {
241 scoped_ptr<SharedQuadState> state = SharedQuadState::Create(); 243 scoped_ptr<SharedQuadState> state = SharedQuadState::Create();
242 state->SetAll(draw_properties_.target_space_transform, 244 state->SetAll(draw_properties_.target_space_transform,
243 draw_properties_.content_bounds, 245 draw_properties_.content_bounds,
244 draw_properties_.visible_content_rect, 246 draw_properties_.visible_content_rect,
245 draw_properties_.clip_rect, 247 draw_properties_.clip_rect,
246 draw_properties_.is_clipped, 248 draw_properties_.is_clipped,
247 draw_properties_.opacity); 249 draw_properties_.opacity,
250 blend_mode_);
248 return state.Pass(); 251 return state.Pass();
249 } 252 }
250 253
251 bool LayerImpl::WillDraw(DrawMode draw_mode, 254 bool LayerImpl::WillDraw(DrawMode draw_mode,
252 ResourceProvider* resource_provider) { 255 ResourceProvider* resource_provider) {
253 // WillDraw/DidDraw must be matched. 256 // WillDraw/DidDraw must be matched.
254 DCHECK_NE(DRAW_MODE_NONE, draw_mode); 257 DCHECK_NE(DRAW_MODE_NONE, draw_mode);
255 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); 258 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_);
256 current_draw_mode_ = draw_mode; 259 current_draw_mode_ = draw_mode;
257 return true; 260 return true;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); 518 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_);
516 layer->SetFilters(filters()); 519 layer->SetFilters(filters());
517 layer->SetBackgroundFilters(background_filters()); 520 layer->SetBackgroundFilters(background_filters());
518 layer->SetMasksToBounds(masks_to_bounds_); 521 layer->SetMasksToBounds(masks_to_bounds_);
519 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); 522 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_);
520 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_); 523 layer->SetHaveWheelEventHandlers(have_wheel_event_handlers_);
521 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_); 524 layer->SetNonFastScrollableRegion(non_fast_scrollable_region_);
522 layer->SetTouchEventHandlerRegion(touch_event_handler_region_); 525 layer->SetTouchEventHandlerRegion(touch_event_handler_region_);
523 layer->SetContentsOpaque(contents_opaque_); 526 layer->SetContentsOpaque(contents_opaque_);
524 layer->SetOpacity(opacity_); 527 layer->SetOpacity(opacity_);
528 layer->SetBlendMode(blend_mode_);
529 layer->SetIsRootForIsolatedGroup(is_root_for_isolated_group_);
525 layer->SetPosition(position_); 530 layer->SetPosition(position_);
526 layer->SetIsContainerForFixedPositionLayers( 531 layer->SetIsContainerForFixedPositionLayers(
527 is_container_for_fixed_position_layers_); 532 is_container_for_fixed_position_layers_);
528 layer->SetFixedContainerSizeDelta(fixed_container_size_delta_); 533 layer->SetFixedContainerSizeDelta(fixed_container_size_delta_);
529 layer->SetPositionConstraint(position_constraint_); 534 layer->SetPositionConstraint(position_constraint_);
530 layer->SetPreserves3d(preserves_3d()); 535 layer->SetPreserves3d(preserves_3d());
531 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 536 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
532 layer->SetSublayerTransform(sublayer_transform_); 537 layer->SetSublayerTransform(sublayer_transform_);
533 layer->SetTransform(transform_); 538 layer->SetTransform(transform_);
534 539
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 bool LayerImpl::OpacityIsAnimating() const { 867 bool LayerImpl::OpacityIsAnimating() const {
863 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity); 868 return layer_animation_controller_->IsAnimatingProperty(Animation::Opacity);
864 } 869 }
865 870
866 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { 871 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const {
867 Animation* opacity_animation = 872 Animation* opacity_animation =
868 layer_animation_controller_->GetAnimation(Animation::Opacity); 873 layer_animation_controller_->GetAnimation(Animation::Opacity);
869 return opacity_animation && opacity_animation->is_impl_only(); 874 return opacity_animation && opacity_animation->is_impl_only();
870 } 875 }
871 876
877 void LayerImpl::SetBlendMode(SkXfermode::Mode blend_mode) {
878 if (blend_mode_ == blend_mode)
879 return;
880
881 blend_mode_ = blend_mode;
882 NoteLayerPropertyChangedForSubtree();
883 }
884
885 void LayerImpl::SetIsRootForIsolatedGroup(bool root) {
886 if (is_root_for_isolated_group_ == root)
887 return;
888
889 is_root_for_isolated_group_ = root;
890 }
891
872 void LayerImpl::SetPosition(gfx::PointF position) { 892 void LayerImpl::SetPosition(gfx::PointF position) {
873 if (position_ == position) 893 if (position_ == position)
874 return; 894 return;
875 895
876 position_ = position; 896 position_ = position;
877 NoteLayerPropertyChangedForSubtree(); 897 NoteLayerPropertyChangedForSubtree();
878 } 898 }
879 899
880 void LayerImpl::SetPreserves3d(bool preserves3_d) { 900 void LayerImpl::SetPreserves3d(bool preserves3_d) {
881 if (preserves_3d_ == preserves3_d) 901 if (preserves_3d_ == preserves3_d)
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 1283
1264 if (reasons & kCompositingReasonLayerForMask) 1284 if (reasons & kCompositingReasonLayerForMask)
1265 reason_list->AppendString("Is a mask layer"); 1285 reason_list->AppendString("Is a mask layer");
1266 1286
1267 if (reasons & kCompositingReasonOverflowScrollingParent) 1287 if (reasons & kCompositingReasonOverflowScrollingParent)
1268 reason_list->AppendString("Scroll parent is not an ancestor"); 1288 reason_list->AppendString("Scroll parent is not an ancestor");
1269 1289
1270 if (reasons & kCompositingReasonOutOfFlowClipping) 1290 if (reasons & kCompositingReasonOutOfFlowClipping)
1271 reason_list->AppendString("Has clipping ancestor"); 1291 reason_list->AppendString("Has clipping ancestor");
1272 1292
1293 if (reasons & kCompositingReasonIsolateCompositedDescendants)
1294 reason_list->AppendString("Should isolate composited dscendants");
1295
1273 return reason_list.PassAs<base::Value>(); 1296 return reason_list.PassAs<base::Value>();
1274 } 1297 }
1275 1298
1276 void LayerImpl::AsValueInto(base::DictionaryValue* state) const { 1299 void LayerImpl::AsValueInto(base::DictionaryValue* state) const {
1277 TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this); 1300 TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this);
1278 state->SetInteger("layer_id", id()); 1301 state->SetInteger("layer_id", id());
1279 state->SetString("layer_name", debug_name()); 1302 state->SetString("layer_name", debug_name());
1280 state->Set("bounds", MathUtil::AsValue(bounds()).release()); 1303 state->Set("bounds", MathUtil::AsValue(bounds()).release());
1281 state->SetInteger("draws_content", DrawsContent()); 1304 state->SetInteger("draws_content", DrawsContent());
1282 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); 1305 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 1349
1327 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } 1350 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; }
1328 1351
1329 scoped_ptr<base::Value> LayerImpl::AsValue() const { 1352 scoped_ptr<base::Value> LayerImpl::AsValue() const {
1330 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 1353 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
1331 AsValueInto(state.get()); 1354 AsValueInto(state.get());
1332 return state.PassAs<base::Value>(); 1355 return state.PassAs<base::Value>();
1333 } 1356 }
1334 1357
1335 } // namespace cc 1358 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698