diff options
author | thildebr@chromium.org <thildebr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-19 06:49:28 +0000 |
---|---|---|
committer | thildebr@chromium.org <thildebr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-19 06:49:28 +0000 |
commit | a9d4d4f8ff5b837ff736c6019aae93386582e4d3 (patch) | |
tree | 3c2268be6b030bba8385dba19435ac002ed7ae92 /cc/trees | |
parent | 696bfd03c9ca0be794b3189cea1f6bd7ed16d5ba (diff) | |
download | chromium_src-a9d4d4f8ff5b837ff736c6019aae93386582e4d3.zip chromium_src-a9d4d4f8ff5b837ff736c6019aae93386582e4d3.tar.gz chromium_src-a9d4d4f8ff5b837ff736c6019aae93386582e4d3.tar.bz2 |
Rendering context information added to SharedQuadState
Context IDs given to DrawQuads to identify when a rendering context
changes, and whether or not a DrawQuad is in a 3D sorting context.
Review URL: https://codereview.chromium.org/332873005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278288 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/trees')
-rw-r--r-- | cc/trees/layer_tree_host_common.cc | 10 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_common_perftest.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_common_unittest.cc | 12 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 4 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_pixeltest_filters.cc | 8 | ||||
-rw-r--r-- | cc/trees/layer_tree_impl_unittest.cc | 6 | ||||
-rw-r--r-- | cc/trees/occlusion_tracker.cc | 2 | ||||
-rw-r--r-- | cc/trees/occlusion_tracker_unittest.cc | 22 |
8 files changed, 34 insertions, 32 deletions
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc index ebb51a8..3bbbf63 100644 --- a/cc/trees/layer_tree_host_common.cc +++ b/cc/trees/layer_tree_host_common.cc @@ -327,16 +327,16 @@ template <typename LayerType> static inline bool IsRootLayer(LayerType* layer) { template <typename LayerType> static inline bool LayerIsInExisting3DRenderingContext(LayerType* layer) { - return layer->is_3d_sorted() && layer->parent() && - layer->parent()->is_3d_sorted(); + return layer->Is3dSorted() && layer->parent() && + layer->parent()->Is3dSorted(); } template <typename LayerType> static bool IsRootLayerOfNewRenderingContext(LayerType* layer) { if (layer->parent()) - return !layer->parent()->is_3d_sorted() && layer->is_3d_sorted(); + return !layer->parent()->Is3dSorted() && layer->Is3dSorted(); - return layer->is_3d_sorted(); + return layer->Is3dSorted(); } template <typename LayerType> @@ -2365,7 +2365,7 @@ static void CalculateDrawPropertiesInternal( // drawn from back to front. If the preserves-3d property is also set on the // parent then skip the sorting as the parent will sort all the descendants // anyway. - if (globals.layer_sorter && descendants.size() && layer->is_3d_sorted() && + if (globals.layer_sorter && descendants.size() && layer->Is3dSorted() && !LayerIsInExisting3DRenderingContext(layer)) { SortLayers(descendants.begin() + sorting_start_index, descendants.end(), diff --git a/cc/trees/layer_tree_host_common_perftest.cc b/cc/trees/layer_tree_host_common_perftest.cc index eb80c63..02b0770 100644 --- a/cc/trees/layer_tree_host_common_perftest.cc +++ b/cc/trees/layer_tree_host_common_perftest.cc @@ -193,7 +193,7 @@ class LayerSorterMainTest : public CalcDrawPropsImplTest { } void BuildLayerImplList(LayerImpl* layer, LayerImplList* list) { - if (layer->is_3d_sorted()) { + if (layer->Is3dSorted()) { list->push_back(layer); } diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc index 2186c20..8dcb6d7 100644 --- a/cc/trees/layer_tree_host_common_unittest.cc +++ b/cc/trees/layer_tree_host_common_unittest.cc @@ -4000,8 +4000,8 @@ TEST_F(LayerTreeHostCommonTest, true, false); - front_facing_surface->SetIs3dSorted(true); - back_facing_surface->SetIs3dSorted(true); + front_facing_surface->Set3dSortingContextId(1); + back_facing_surface->Set3dSortingContextId(1); RenderSurfaceLayerList render_surface_layer_list; LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( @@ -6976,8 +6976,8 @@ TEST_F(LayerTreeHostCommonTest, CanRenderToSeparateSurface) { false); child3->SetDrawsContent(true); - child2->SetIs3dSorted(true); - child3->SetIs3dSorted(true); + child2->Set3dSortingContextId(1); + child3->Set3dSortingContextId(1); child2->AddChild(child3.Pass()); child1->AddChild(child2.Pass()); @@ -7037,7 +7037,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotIncludeBackfaceInvisibleSurfaces) { false); root->SetShouldFlattenTransform(false); - root->SetIs3dSorted(true); + root->Set3dSortingContextId(1); render_surface->SetDoubleSided(false); render_surface->SetForceRenderSurface(true); @@ -7665,7 +7665,7 @@ TEST_F(LayerTreeHostCommonTest, DoNotClobberSorting) { true); scroll_child->SetShouldFlattenTransform(false); - scroll_child->SetIs3dSorted(true); + scroll_child->Set3dSortingContextId(1); scroll_child->AddChild(top_content.Pass()); scroll_child->AddChild(bottom_content.Pass()); diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 53c2f0d..9b22e48 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -651,6 +651,7 @@ static void AppendQuadsToFillScreen( gfx::Rect root_target_rect = root_layer->render_surface()->content_rect(); float opacity = 1.f; + int sorting_context_id = 0; SharedQuadState* shared_quad_state = quad_culler.CreateSharedQuadState(); shared_quad_state->SetAll(gfx::Transform(), root_target_rect.size(), @@ -658,7 +659,8 @@ static void AppendQuadsToFillScreen( root_target_rect, false, opacity, - SkXfermode::kSrcOver_Mode); + SkXfermode::kSrcOver_Mode, + sorting_context_id); for (Region::Iterator fill_rects(screen_background_color_region); fill_rects.has_rect(); diff --git a/cc/trees/layer_tree_host_pixeltest_filters.cc b/cc/trees/layer_tree_host_pixeltest_filters.cc index 2337611..c8c8c7a 100644 --- a/cc/trees/layer_tree_host_pixeltest_filters.cc +++ b/cc/trees/layer_tree_host_pixeltest_filters.cc @@ -111,17 +111,17 @@ TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlurOffAxis) { background->AddChild(blur); background->SetShouldFlattenTransform(false); - background->SetIs3dSorted(true); + background->Set3dSortingContextId(1); green->SetShouldFlattenTransform(false); - green->SetIs3dSorted(true); + green->Set3dSortingContextId(1); gfx::Transform background_transform; background_transform.ApplyPerspectiveDepth(200.0); background->SetTransform(background_transform); blur->SetShouldFlattenTransform(false); - blur->SetIs3dSorted(true); + blur->Set3dSortingContextId(1); for (size_t i = 0; i < blur->children().size(); ++i) - blur->children()[i]->SetIs3dSorted(true); + blur->children()[i]->Set3dSortingContextId(1); gfx::Transform blur_transform; blur_transform.Translate(55.0, 65.0); diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc index 91bad3e..006fc35 100644 --- a/cc/trees/layer_tree_impl_unittest.cc +++ b/cc/trees/layer_tree_impl_unittest.cc @@ -983,7 +983,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) { false); root->SetDrawsContent(true); root->SetShouldFlattenTransform(false); - root->SetIs3dSorted(true); + root->Set3dSortingContextId(1); { // child 1 and child2 are initialized to overlap between x=50 and x=60. // grand_child is set to overlap both child1 and child2 between y=50 and @@ -1009,7 +1009,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) { false); child1->SetDrawsContent(true); child1->SetShouldFlattenTransform(false); - child1->SetIs3dSorted(true); + child1->Set3dSortingContextId(1); position = gfx::PointF(50.f, 10.f); bounds = gfx::Size(50, 50); @@ -1024,7 +1024,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) { false); child2->SetDrawsContent(true); child2->SetShouldFlattenTransform(false); - child2->SetIs3dSorted(true); + child2->Set3dSortingContextId(1); // Remember that grand_child is positioned with respect to its parent (i.e. // child1). In screen space, the intended position is (10, 50), with size diff --git a/cc/trees/occlusion_tracker.cc b/cc/trees/occlusion_tracker.cc index b549f89..f4a414f 100644 --- a/cc/trees/occlusion_tracker.cc +++ b/cc/trees/occlusion_tracker.cc @@ -131,7 +131,7 @@ static inline bool SurfaceTransformsToScreenKnown(const RenderSurfaceImpl* rs) { } static inline bool LayerIsInUnsorted3dRenderingContext(const Layer* layer) { - return layer->is_3d_sorted(); + return layer->Is3dSorted(); } static inline bool LayerIsInUnsorted3dRenderingContext(const LayerImpl* layer) { return false; diff --git a/cc/trees/occlusion_tracker_unittest.cc b/cc/trees/occlusion_tracker_unittest.cc index 89165b8..1a6529b 100644 --- a/cc/trees/occlusion_tracker_unittest.cc +++ b/cc/trees/occlusion_tracker_unittest.cc @@ -1903,9 +1903,9 @@ class OcclusionTrackerTestUnsorted3dLayers gfx::Size(100, 100), true); parent->SetShouldFlattenTransform(false); - parent->SetIs3dSorted(true); - child1->SetIs3dSorted(true); - child2->SetIs3dSorted(true); + parent->Set3dSortingContextId(1); + child1->Set3dSortingContextId(1); + child2->Set3dSortingContextId(1); this->CalcDrawEtc(parent); @@ -1949,8 +1949,8 @@ class OcclusionTrackerTestPerspectiveTransform gfx::Size(200, 200), true); container->SetShouldFlattenTransform(false); - container->SetIs3dSorted(true); - layer->SetIs3dSorted(true); + container->Set3dSortingContextId(1); + layer->Set3dSortingContextId(1); layer->SetShouldFlattenTransform(false); this->CalcDrawEtc(parent); @@ -1994,9 +1994,9 @@ class OcclusionTrackerTestPerspectiveTransformBehindCamera typename Types::ContentLayerType* layer = this->CreateDrawingLayer( container, transform, gfx::PointF(), gfx::Size(500, 500), true); container->SetShouldFlattenTransform(false); - container->SetIs3dSorted(true); + container->Set3dSortingContextId(1); layer->SetShouldFlattenTransform(false); - layer->SetIs3dSorted(true); + layer->Set3dSortingContextId(1); this->CalcDrawEtc(parent); TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( @@ -2037,9 +2037,9 @@ class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude typename Types::ContentLayerType* layer = this->CreateDrawingLayer( parent, transform, gfx::PointF(), gfx::Size(100, 100), true); parent->SetShouldFlattenTransform(false); - parent->SetIs3dSorted(true); + parent->Set3dSortingContextId(1); layer->SetShouldFlattenTransform(false); - layer->SetIs3dSorted(true); + layer->Set3dSortingContextId(1); this->CalcDrawEtc(parent); TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( @@ -2078,9 +2078,9 @@ class OcclusionTrackerTestLargePixelsOccludeInsideClipRect typename Types::ContentLayerType* layer = this->CreateDrawingLayer( parent, transform, gfx::PointF(), gfx::Size(100, 100), true); parent->SetShouldFlattenTransform(false); - parent->SetIs3dSorted(true); + parent->Set3dSortingContextId(1); layer->SetShouldFlattenTransform(false); - layer->SetIs3dSorted(true); + layer->Set3dSortingContextId(1); this->CalcDrawEtc(parent); TestOcclusionTrackerWithClip<typename Types::LayerType> occlusion( |