diff options
author | weiliangc <weiliangc@chromium.org> | 2015-12-08 19:39:26 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-09 03:40:25 +0000 |
commit | c154ce2efa59dbaecb3cb038adb247426f7c6988 (patch) | |
tree | adc06272fccf970cb021180efa52e6f67c236236 /cc/test | |
parent | d2dc9a29ec062b23a18bca4f69d56901634b5545 (diff) | |
download | chromium_src-c154ce2efa59dbaecb3cb038adb247426f7c6988.zip chromium_src-c154ce2efa59dbaecb3cb038adb247426f7c6988.tar.gz chromium_src-c154ce2efa59dbaecb3cb038adb247426f7c6988.tar.bz2 |
Create RenderSurface on Effect Tree
Move RenderSurface creation reason to effect tree. Update LayerImpl's
API to include SetForceRenderSurface. Update unittests.
R=enne
BUG=557160
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
Committed: https://crrev.com/4374c2cc231a7e5b6ae65d0e0814b5dccf445200
Cr-Commit-Position: refs/heads/master@{#363544}
Review URL: https://codereview.chromium.org/1491033002
Cr-Commit-Position: refs/heads/master@{#363967}
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/layer_test_common.h | 9 | ||||
-rw-r--r-- | cc/test/layer_tree_host_common_test.cc | 28 | ||||
-rw-r--r-- | cc/test/layer_tree_host_common_test.h | 19 |
3 files changed, 48 insertions, 8 deletions
diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h index 85f2f8a..4301a30 100644 --- a/cc/test/layer_test_common.h +++ b/cc/test/layer_test_common.h @@ -70,6 +70,15 @@ class LayerTestCommon { return ptr; } + template <typename T> + T* AddReplicaLayer(LayerImpl* origin) { + scoped_ptr<T> layer = + T::Create(host_->host_impl()->active_tree(), layer_impl_id_++); + T* ptr = layer.get(); + origin->SetReplicaLayer(layer.Pass()); + return ptr; + } + template <typename T, typename A> T* AddChildToRoot(const A& a) { scoped_ptr<T> layer = diff --git a/cc/test/layer_tree_host_common_test.cc b/cc/test/layer_tree_host_common_test.cc index c05716d..02b66ac 100644 --- a/cc/test/layer_tree_host_common_test.cc +++ b/cc/test/layer_tree_host_common_test.cc @@ -11,7 +11,6 @@ #include "cc/trees/layer_tree_host_common.h" namespace cc { - LayerTreeHostCommonTestBase::LayerTreeHostCommonTestBase( const LayerTreeSettings& settings) : LayerTestCommon::LayerImplTest(settings), @@ -41,13 +40,26 @@ void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( const gfx::PointF& position, const gfx::Size& bounds, bool flatten_transform, + bool is_3d_sorted) { + SetLayerPropertiesForTestingInternal(layer, transform, transform_origin, + position, bounds, flatten_transform, + is_3d_sorted); +} + +void LayerTreeHostCommonTestBase::SetLayerPropertiesForTesting( + LayerImpl* layer, + const gfx::Transform& transform, + const gfx::Point3F& transform_origin, + const gfx::PointF& position, + const gfx::Size& bounds, + bool flatten_transform, bool is_3d_sorted, bool create_render_surface) { SetLayerPropertiesForTestingInternal(layer, transform, transform_origin, position, bounds, flatten_transform, is_3d_sorted); if (create_render_surface) { - layer->SetHasRenderSurface(true); + layer->SetForceRenderSurface(true); } } @@ -83,11 +95,8 @@ void LayerTreeHostCommonTestBase:: LayerTreeHostCommon::PreCalculateMetaInformation(root_layer); gfx::Transform identity_transform; - bool preserves_2d_axis_alignment = false; + bool can_render_to_separate_surface = true; - LayerTreeHostCommon::UpdateRenderSurfaces( - root_layer, can_render_to_separate_surface, identity_transform, - preserves_2d_axis_alignment); Layer* page_scale_layer = nullptr; Layer* inner_viewport_scroll_layer = @@ -118,7 +127,9 @@ void LayerTreeHostCommonTestBase:: LayerTreeHostCommon::PreCalculateMetaInformationForTesting(root_layer); gfx::Transform identity_transform; + bool can_render_to_separate_surface = true; + LayerImpl* page_scale_layer = nullptr; LayerImpl* inner_viewport_scroll_layer = root_layer->layer_tree_impl()->InnerViewportScrollLayer(); @@ -134,14 +145,15 @@ void LayerTreeHostCommonTestBase:: gfx::Size device_viewport_size = gfx::Size(root_layer->bounds().width() * device_scale_factor, root_layer->bounds().height() * device_scale_factor); - std::vector<LayerImpl*> update_layer_list; + update_layer_list_impl_.reset(new LayerImplList); BuildPropertyTreesAndComputeVisibleRects( root_layer, page_scale_layer, inner_viewport_scroll_layer, outer_viewport_scroll_layer, overscroll_elasticity_layer, elastic_overscroll, page_scale_factor, device_scale_factor, gfx::Rect(device_viewport_size), identity_transform, can_render_to_separate_surface, - root_layer->layer_tree_impl()->property_trees(), &update_layer_list); + root_layer->layer_tree_impl()->property_trees(), + update_layer_list_impl_.get()); } void LayerTreeHostCommonTestBase::ExecuteCalculateDrawProperties( diff --git a/cc/test/layer_tree_host_common_test.h b/cc/test/layer_tree_host_common_test.h index f8f1a02..2a66715 100644 --- a/cc/test/layer_tree_host_common_test.h +++ b/cc/test/layer_tree_host_common_test.h @@ -5,6 +5,7 @@ #ifndef CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ #define CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ +#include <algorithm> #include <vector> #include "base/memory/scoped_ptr.h" @@ -66,6 +67,14 @@ class LayerTreeHostCommonTestBase : public LayerTestCommon::LayerImplTest { const gfx::PointF& position, const gfx::Size& bounds, bool flatten_transform, + bool is_3d_sorted); + + void SetLayerPropertiesForTesting(LayerImpl* layer, + const gfx::Transform& transform, + const gfx::Point3F& transform_origin, + const gfx::PointF& position, + const gfx::Size& bounds, + bool flatten_transform, bool is_3d_sorted, bool create_render_surface); @@ -118,6 +127,15 @@ class LayerTreeHostCommonTestBase : public LayerTestCommon::LayerImplTest { return render_surface_layer_list_impl_.get(); } + LayerImplList* update_layer_list_impl() const { + return update_layer_list_impl_.get(); + } + bool UpdateLayerListImplContains(int id) const { + return std::count_if( + update_layer_list_impl_->begin(), update_layer_list_impl_->end(), + [id](LayerImpl* layer) { return layer->id() == id; }) != 0; + } + const LayerList& update_layer_list() const { return update_layer_list_; } bool UpdateLayerListContains(int id) const; @@ -130,6 +148,7 @@ class LayerTreeHostCommonTestBase : public LayerTestCommon::LayerImplTest { private: scoped_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_; LayerList update_layer_list_; + scoped_ptr<LayerImplList> update_layer_list_impl_; LayerSettings layer_settings_; int render_surface_layer_list_count_; |