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

Side by Side Diff: cc/trees/layer_tree_host_common.cc

Issue 23455060: mix-blend-mode implementation for accelerated layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 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/trees/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.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 "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 if (LayerIsInExisting3DRenderingContext(layer) && !layer->preserves_3d() && 569 if (LayerIsInExisting3DRenderingContext(layer) && !layer->preserves_3d() &&
570 num_descendants_that_draw_content > 0) { 570 num_descendants_that_draw_content > 0) {
571 TRACE_EVENT_INSTANT0( 571 TRACE_EVENT_INSTANT0(
572 "cc", 572 "cc",
573 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface flattening", 573 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface flattening",
574 TRACE_EVENT_SCOPE_THREAD); 574 TRACE_EVENT_SCOPE_THREAD);
575 DCHECK(!is_root); 575 DCHECK(!is_root);
576 return true; 576 return true;
577 } 577 }
578 578
579 // If the layer has blending.
580 if (layer->has_blend_mode()) {
shawnsingh 2013/09/25 05:33:53 Can we support blend modes for layers when possibl
rosca 2013/09/25 18:00:00 This is one of the optimizations I was thinking of
581 TRACE_EVENT_INSTANT0(
582 "cc",
583 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface blending",
584 TRACE_EVENT_SCOPE_THREAD);
585 return true;
586 }
587
588 // If the layer has isolation.
589 if (layer->is_root_for_isolated_group()) {
enne (OOO) 2013/09/24 18:05:48 Whoa there. According to http://dev.w3.org/fxtf/c
rosca 2013/09/24 21:22:47 We create separate rendering surfaces only for sta
shawnsingh 2013/09/25 05:33:53 Enne@ - I disagree about using setForceRenderSurfa
enne (OOO) 2013/09/26 16:25:13 I think there's sort of two approaches you can tak
rosca 2013/09/27 10:39:06 I added a TODO comment with this improvement in th
enne (OOO) 2013/09/27 17:42:33 Can you file a bug, assign it to yourself, and ref
rosca 2013/09/30 17:28:36 Here is the bug: http://crbug.com/301738. Unfortun
590 TRACE_EVENT_INSTANT0(
591 "cc",
592 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface isolation",
593 TRACE_EVENT_SCOPE_THREAD);
594 return true;
595 }
596
579 // If the layer clips its descendants but it is not axis-aligned with respect 597 // If the layer clips its descendants but it is not axis-aligned with respect
580 // to its parent. 598 // to its parent.
581 bool layer_clips_external_content = 599 bool layer_clips_external_content =
582 LayerClipsSubtree(layer) || layer->HasDelegatedContent(); 600 LayerClipsSubtree(layer) || layer->HasDelegatedContent();
583 if (layer_clips_external_content && !axis_aligned_with_respect_to_parent && 601 if (layer_clips_external_content && !axis_aligned_with_respect_to_parent &&
584 !layer->draw_properties().descendants_can_clip_selves) { 602 !layer->draw_properties().descendants_can_clip_selves) {
585 TRACE_EVENT_INSTANT0( 603 TRACE_EVENT_INSTANT0(
586 "cc", 604 "cc",
587 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface clipping", 605 "LayerTreeHostCommon::SubtreeShouldRenderToSeparateSurface clipping",
588 TRACE_EVENT_SCOPE_THREAD); 606 TRACE_EVENT_SCOPE_THREAD);
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 // The opacity value is moved from the layer to its surface, so that the 1525 // The opacity value is moved from the layer to its surface, so that the
1508 // entire subtree properly inherits opacity. 1526 // entire subtree properly inherits opacity.
1509 render_surface->SetDrawOpacity(accumulated_draw_opacity); 1527 render_surface->SetDrawOpacity(accumulated_draw_opacity);
1510 render_surface->SetDrawOpacityIsAnimating(animating_opacity_to_target); 1528 render_surface->SetDrawOpacityIsAnimating(animating_opacity_to_target);
1511 animating_opacity_to_target = false; 1529 animating_opacity_to_target = false;
1512 layer_draw_properties.opacity = 1.f; 1530 layer_draw_properties.opacity = 1.f;
1513 layer_draw_properties.opacity_is_animating = animating_opacity_to_target; 1531 layer_draw_properties.opacity_is_animating = animating_opacity_to_target;
1514 layer_draw_properties.screen_space_opacity_is_animating = 1532 layer_draw_properties.screen_space_opacity_is_animating =
1515 animating_opacity_to_screen; 1533 animating_opacity_to_screen;
1516 1534
1535 render_surface->SetHasBlendMode(layer->has_blend_mode());
shawnsingh 2013/09/25 05:33:53 FYI, if we do add support for blend modes on layer
rosca 2013/09/25 18:00:00 I removed the has_blend_mode property from RenderS
1536
1517 render_surface->SetTargetSurfaceTransformsAreAnimating( 1537 render_surface->SetTargetSurfaceTransformsAreAnimating(
1518 animating_transform_to_target); 1538 animating_transform_to_target);
1519 render_surface->SetScreenSpaceTransformsAreAnimating( 1539 render_surface->SetScreenSpaceTransformsAreAnimating(
1520 animating_transform_to_screen); 1540 animating_transform_to_screen);
1521 animating_transform_to_target = false; 1541 animating_transform_to_target = false;
1522 layer_draw_properties.target_space_transform_is_animating = 1542 layer_draw_properties.target_space_transform_is_animating =
1523 animating_transform_to_target; 1543 animating_transform_to_target;
1524 layer_draw_properties.screen_space_transform_is_animating = 1544 layer_draw_properties.screen_space_transform_is_animating =
1525 animating_transform_to_screen; 1545 animating_transform_to_screen;
1526 1546
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 // At this point, we think the point does hit the touch event handler region 2238 // At this point, we think the point does hit the touch event handler region
2219 // on the layer, but we need to walk up the parents to ensure that the layer 2239 // on the layer, but we need to walk up the parents to ensure that the layer
2220 // was not clipped in such a way that the hit point actually should not hit 2240 // was not clipped in such a way that the hit point actually should not hit
2221 // the layer. 2241 // the layer.
2222 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl)) 2242 if (PointIsClippedBySurfaceOrClipRect(screen_space_point, layer_impl))
2223 return false; 2243 return false;
2224 2244
2225 return true; 2245 return true;
2226 } 2246 }
2227 } // namespace cc 2247 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698