diff options
author | enne <enne@chromium.org> | 2015-08-29 02:17:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-29 09:18:11 +0000 |
commit | fffb119cea3dcf169e98715bfefb86caec5e37ef (patch) | |
tree | 0dd23389be20fcb35a3c1816e86c497af9bf4f16 /cc | |
parent | e559927e848f47932e86a09b669629284e4b04b5 (diff) | |
download | chromium_src-fffb119cea3dcf169e98715bfefb86caec5e37ef.zip chromium_src-fffb119cea3dcf169e98715bfefb86caec5e37ef.tar.gz chromium_src-fffb119cea3dcf169e98715bfefb86caec5e37ef.tar.bz2 |
cc: Detemplatize DrawProperties
R=weiliangc@chromium.org,ajuma@chromium.org
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Review URL: https://codereview.chromium.org/1319973004
Cr-Commit-Position: refs/heads/master@{#346316}
Diffstat (limited to 'cc')
-rw-r--r-- | cc/BUILD.gn | 1 | ||||
-rw-r--r-- | cc/cc.gyp | 1 | ||||
-rw-r--r-- | cc/layers/draw_properties.cc | 24 | ||||
-rw-r--r-- | cc/layers/draw_properties.h | 20 | ||||
-rw-r--r-- | cc/layers/layer_impl.h | 10 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_common.cc | 6 |
6 files changed, 37 insertions, 25 deletions
diff --git a/cc/BUILD.gn b/cc/BUILD.gn index c136a6d..ec382c9 100644 --- a/cc/BUILD.gn +++ b/cc/BUILD.gn @@ -125,6 +125,7 @@ component("cc") { "layers/delegated_renderer_layer.h", "layers/delegated_renderer_layer_impl.cc", "layers/delegated_renderer_layer_impl.h", + "layers/draw_properties.cc", "layers/draw_properties.h", "layers/heads_up_display_layer.cc", "layers/heads_up_display_layer.h", @@ -182,6 +182,7 @@ 'layers/delegated_renderer_layer.h', 'layers/delegated_renderer_layer_impl.cc', 'layers/delegated_renderer_layer_impl.h', + 'layers/draw_properties.cc', 'layers/draw_properties.h', 'layers/heads_up_display_layer.cc', 'layers/heads_up_display_layer.h', diff --git a/cc/layers/draw_properties.cc b/cc/layers/draw_properties.cc new file mode 100644 index 0000000..da0d41e --- /dev/null +++ b/cc/layers/draw_properties.cc @@ -0,0 +1,24 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cc/layers/draw_properties.h" + +namespace cc { + +DrawProperties::DrawProperties() + : opacity(0.f), + screen_space_transform_is_animating(false), + can_use_lcd_text(false), + render_target(nullptr), + num_unclipped_descendants(0), + layer_or_descendant_has_copy_request(false), + layer_or_descendant_has_input_handler(false), + has_child_with_a_scroll_parent(false), + last_drawn_render_surface_layer_list_id(0), + maximum_animation_contents_scale(0.f), + starting_animation_contents_scale(0.f) {} + +DrawProperties::~DrawProperties() {} + +} // namespace cc diff --git a/cc/layers/draw_properties.h b/cc/layers/draw_properties.h index 4e105d9..a84876f 100644 --- a/cc/layers/draw_properties.h +++ b/cc/layers/draw_properties.h @@ -12,23 +12,13 @@ #include "ui/gfx/transform.h" namespace cc { +class LayerImpl; // Container for properties that layers need to compute before they can be // drawn. -template <typename LayerType> struct CC_EXPORT DrawProperties { - DrawProperties() - : opacity(0.f), - screen_space_transform_is_animating(false), - can_use_lcd_text(false), - render_target(nullptr), - num_unclipped_descendants(0), - layer_or_descendant_has_copy_request(false), - layer_or_descendant_has_input_handler(false), - has_child_with_a_scroll_parent(false), - last_drawn_render_surface_layer_list_id(0), - maximum_animation_contents_scale(0.f), - starting_animation_contents_scale(0.f) {} + DrawProperties(); + ~DrawProperties(); // Transforms objects from content space to target surface space, where // this layer would be drawn. @@ -40,7 +30,7 @@ struct CC_EXPORT DrawProperties { // Known occlusion above the layer mapped to the content space of the layer. Occlusion occlusion_in_content_space; - // DrawProperties::opacity may be different than LayerType::opacity, + // DrawProperties::opacity may be different than LayerImpl::opacity, // particularly in the case when a RenderSurface re-parents the layer's // opacity, or when opacity is compounded by the hierarchy. float opacity; @@ -57,7 +47,7 @@ struct CC_EXPORT DrawProperties { // The layer whose coordinate space this layer draws into. This can be // either the same layer (draw_properties_.render_target == this) or an // ancestor of this layer. - LayerType* render_target; + LayerImpl* render_target; // This rect is a bounding box around what part of the layer is visible, in // the layer's coordinate space. diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index c4d025e..8e9accb 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h @@ -389,12 +389,8 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, RenderSurfaceImpl* render_surface() const { return render_surface_.get(); } - DrawProperties<LayerImpl>& draw_properties() { - return draw_properties_; - } - const DrawProperties<LayerImpl>& draw_properties() const { - return draw_properties_; - } + DrawProperties& draw_properties() { return draw_properties_; } + const DrawProperties& draw_properties() const { return draw_properties_; } // The following are shortcut accessors to get various information from // draw_properties_ @@ -870,7 +866,7 @@ class CC_EXPORT LayerImpl : public LayerAnimationValueObserver, // Group of properties that need to be computed based on the layer tree // hierarchy before layers can be drawn. - DrawProperties<LayerImpl> draw_properties_; + DrawProperties draw_properties_; scoped_refptr<base::trace_event::ConvertableToTraceFormat> debug_info_; scoped_ptr<RenderSurfaceImpl> render_surface_; diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc index db7efeb..8b55bbc 100644 --- a/cc/trees/layer_tree_host_common.cc +++ b/cc/trees/layer_tree_host_common.cc @@ -1594,7 +1594,7 @@ static void CalculateDrawPropertiesInternal( // layer that actually get computed. To avoid unnecessary copies // (particularly for matrices), we do computations directly on these values // when possible. - DrawProperties<LayerImpl>& layer_draw_properties = layer->draw_properties(); + DrawProperties& layer_draw_properties = layer->draw_properties(); gfx::Rect clip_rect_in_target_space; bool layer_or_ancestor_clips_descendants = false; @@ -1819,7 +1819,7 @@ static void CalculateDrawPropertiesInternal( data_for_children.full_hierarchy_matrix.FlattenTo2d(); if (layer->mask_layer()) { - DrawProperties<LayerImpl>& mask_layer_draw_properties = + DrawProperties& mask_layer_draw_properties = layer->mask_layer()->draw_properties(); mask_layer_draw_properties.visible_layer_rect = gfx::Rect(layer->bounds()); @@ -1833,7 +1833,7 @@ static void CalculateDrawPropertiesInternal( } if (layer->replica_layer() && layer->replica_layer()->mask_layer()) { - DrawProperties<LayerImpl>& replica_mask_draw_properties = + DrawProperties& replica_mask_draw_properties = layer->replica_layer()->mask_layer()->draw_properties(); replica_mask_draw_properties.visible_layer_rect = gfx::Rect(layer->bounds()); |