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

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

Issue 338453003: cc: Avoid needless Rect->RectF->Rect conversion in CalcDrawProps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 bool adjust_text_aa = 1763 bool adjust_text_aa =
1764 !animating_opacity_to_screen && !animating_transform_to_screen; 1764 !animating_opacity_to_screen && !animating_transform_to_screen;
1765 // To avoid color fringing, LCD text should only be used on opaque layers with 1765 // To avoid color fringing, LCD text should only be used on opaque layers with
1766 // just integral translation. 1766 // just integral translation.
1767 bool layer_can_use_lcd_text = 1767 bool layer_can_use_lcd_text =
1768 data_from_ancestor.subtree_can_use_lcd_text && 1768 data_from_ancestor.subtree_can_use_lcd_text &&
1769 accumulated_draw_opacity == 1.f && 1769 accumulated_draw_opacity == 1.f &&
1770 layer_draw_properties.target_space_transform. 1770 layer_draw_properties.target_space_transform.
1771 IsIdentityOrIntegerTranslation(); 1771 IsIdentityOrIntegerTranslation();
1772 1772
1773 gfx::RectF content_rect(layer->content_bounds()); 1773 gfx::Rect content_rect(layer->content_bounds());
1774 1774
1775 // full_hierarchy_matrix is the matrix that transforms objects between screen 1775 // full_hierarchy_matrix is the matrix that transforms objects between screen
1776 // space (except projection matrix) and the most recent RenderSurfaceImpl's 1776 // space (except projection matrix) and the most recent RenderSurfaceImpl's
1777 // space. next_hierarchy_matrix will only change if this layer uses a new 1777 // space. next_hierarchy_matrix will only change if this layer uses a new
1778 // RenderSurfaceImpl, otherwise remains the same. 1778 // RenderSurfaceImpl, otherwise remains the same.
1779 data_for_children.full_hierarchy_matrix = 1779 data_for_children.full_hierarchy_matrix =
1780 data_from_ancestor.full_hierarchy_matrix; 1780 data_from_ancestor.full_hierarchy_matrix;
1781 1781
1782 // If the subtree will scale layer contents by the transform hierarchy, then 1782 // If the subtree will scale layer contents by the transform hierarchy, then
1783 // we should scale things into the render surface by the transform hierarchy 1783 // we should scale things into the render surface by the transform hierarchy
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1996 data_from_ancestor.clip_rect_of_target_surface_in_target_space; 1996 data_from_ancestor.clip_rect_of_target_surface_in_target_space;
1997 1997
1998 // Layers that are not their own render_target will render into the target 1998 // Layers that are not their own render_target will render into the target
1999 // of their nearest ancestor. 1999 // of their nearest ancestor.
2000 layer_draw_properties.render_target = layer->parent()->render_target(); 2000 layer_draw_properties.render_target = layer->parent()->render_target();
2001 } 2001 }
2002 2002
2003 if (adjust_text_aa) 2003 if (adjust_text_aa)
2004 layer_draw_properties.can_use_lcd_text = layer_can_use_lcd_text; 2004 layer_draw_properties.can_use_lcd_text = layer_can_use_lcd_text;
2005 2005
2006 gfx::Rect rect_in_target_space = ToEnclosingRect( 2006 gfx::Rect rect_in_target_space =
2007 MathUtil::MapClippedRect(layer->draw_transform(), content_rect)); 2007 MathUtil::MapEnclosingClippedRect(layer->draw_transform(), content_rect);
2008 2008
2009 if (LayerClipsSubtree(layer)) { 2009 if (LayerClipsSubtree(layer)) {
2010 layer_or_ancestor_clips_descendants = true; 2010 layer_or_ancestor_clips_descendants = true;
2011 if (ancestor_clips_subtree && !layer->render_surface()) { 2011 if (ancestor_clips_subtree && !layer->render_surface()) {
2012 // A layer without render surface shares the same target as its ancestor. 2012 // A layer without render surface shares the same target as its ancestor.
2013 clip_rect_in_target_space = 2013 clip_rect_in_target_space =
2014 ancestor_clip_rect_in_target_space; 2014 ancestor_clip_rect_in_target_space;
2015 clip_rect_in_target_space.Intersect(rect_in_target_space); 2015 clip_rect_in_target_space.Intersect(rect_in_target_space);
2016 } else { 2016 } else {
2017 clip_rect_in_target_space = rect_in_target_space; 2017 clip_rect_in_target_space = rect_in_target_space;
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
2407 inputs->current_render_surface_layer_list_id); 2407 inputs->current_render_surface_layer_list_id);
2408 2408
2409 // The dummy layer list should not have been used. 2409 // The dummy layer list should not have been used.
2410 DCHECK_EQ(0u, dummy_layer_list.size()); 2410 DCHECK_EQ(0u, dummy_layer_list.size());
2411 // A root layer render_surface should always exist after 2411 // A root layer render_surface should always exist after
2412 // CalculateDrawProperties. 2412 // CalculateDrawProperties.
2413 DCHECK(inputs->root_layer->render_surface()); 2413 DCHECK(inputs->root_layer->render_surface());
2414 } 2414 }
2415 2415
2416 } // namespace cc 2416 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698