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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 998023002: Revert of Splitting of layers for correct intersections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_sorter_unittest.cc ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common.cc
diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc
index 5721eba514b055f2255452e58873d0fc801a19eb..e80e3a096e8287f69f43188172c38529f107e376 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -15,6 +15,7 @@
#include "cc/layers/render_surface.h"
#include "cc/layers/render_surface_impl.h"
#include "cc/trees/draw_property_utils.h"
+#include "cc/trees/layer_sorter.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_impl.h"
#include "ui/gfx/geometry/rect_conversions.h"
@@ -29,6 +30,20 @@
}
ScrollAndScaleSet::~ScrollAndScaleSet() {}
+
+static void SortLayers(LayerList::iterator first,
+ LayerList::iterator end,
+ void* layer_sorter) {
+ NOTREACHED();
+}
+
+static void SortLayers(LayerImplList::iterator first,
+ LayerImplList::iterator end,
+ LayerSorter* layer_sorter) {
+ DCHECK(layer_sorter);
+ TRACE_EVENT0("cc", "LayerTreeHostCommon::SortLayers");
+ layer_sorter->Sort(first, end);
+}
template <typename LayerType>
static gfx::Vector2dF GetEffectiveScrollDelta(LayerType* layer) {
@@ -1264,6 +1279,7 @@
template <typename LayerType>
struct SubtreeGlobals {
+ LayerSorter* layer_sorter;
int max_texture_size;
float device_scale_factor;
float page_scale_factor;
@@ -2349,6 +2365,17 @@
return;
}
+ // If preserves-3d then sort all the descendants in 3D so that they can be
+ // 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->Is3dSorted() &&
+ !LayerIsInExisting3DRenderingContext(layer)) {
+ SortLayers(descendants.begin() + sorting_start_index,
+ descendants.end(),
+ globals.layer_sorter);
+ }
+
UpdateAccumulatedSurfaceState<LayerType>(
layer, local_drawable_content_rect_of_subtree, accumulated_surface_state);
@@ -2386,6 +2413,7 @@
scaled_device_transform.Scale(inputs.device_scale_factor,
inputs.device_scale_factor);
+ globals->layer_sorter = NULL;
globals->max_texture_size = inputs.max_texture_size;
globals->device_scale_factor =
inputs.device_scale_factor * device_transform_scale;
@@ -2560,6 +2588,9 @@
DataForRecursion<LayerImpl> data_for_recursion;
ProcessCalcDrawPropsInputs(*inputs, &globals, &data_for_recursion);
+ LayerSorter layer_sorter;
+ globals.layer_sorter = &layer_sorter;
+
PreCalculateMetaInformationRecursiveData recursive_data;
PreCalculateMetaInformation(inputs->root_layer, &recursive_data);
std::vector<AccumulatedSurfaceState<LayerImpl>> accumulated_surface_state;
« no previous file with comments | « cc/trees/layer_sorter_unittest.cc ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698