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

Unified Diff: cc/trees/layer_tree_host_common.cc

Issue 816543004: Update from https://crrev.com/308996 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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_tree_host_common.h ('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 9a9650f520c0471828168bd4ef90810c180a66e1..2022f46f847d9b7fca37c3f29308865beccce93d 100644
--- a/cc/trees/layer_tree_host_common.cc
+++ b/cc/trees/layer_tree_host_common.cc
@@ -14,7 +14,9 @@
#include "cc/layers/layer_iterator.h"
#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"
#include "ui/gfx/geometry/vector2d_conversions.h"
@@ -1839,6 +1841,9 @@ static void CalculateDrawPropertiesInternal(
} else {
render_to_separate_surface = IsRootLayer(layer);
}
+
+ layer->SetHasRenderSurface(render_to_separate_surface);
+
if (render_to_separate_surface) {
// Check back-face visibility before continuing with this surface and its
// subtree
@@ -2430,6 +2435,14 @@ static void ProcessCalcDrawPropsInputs(
data_for_recursion->subtree_is_visible_from_ancestor = true;
}
+static bool ApproximatelyEqual(const gfx::Rect& r1, const gfx::Rect& r2) {
+ static const int tolerance = 1;
+ return std::abs(r1.x() - r2.x()) <= tolerance &&
+ std::abs(r1.y() - r2.y()) <= tolerance &&
+ std::abs(r1.width() - r2.width()) <= tolerance &&
+ std::abs(r1.height() - r2.height()) <= tolerance;
+}
+
void LayerTreeHostCommon::CalculateDrawProperties(
CalcDrawPropsMainInputs* inputs) {
LayerList dummy_layer_list;
@@ -2454,6 +2467,36 @@ void LayerTreeHostCommon::CalculateDrawProperties(
// A root layer render_surface should always exist after
// CalculateDrawProperties.
DCHECK(inputs->root_layer->render_surface());
+
+ if (inputs->verify_property_trees) {
+ // TODO(ajuma): Can we efficiently cache some of this rather than
+ // starting from scratch every frame?
+ TransformTree transform_tree;
+ ClipTree clip_tree;
+ ComputeVisibleRectsUsingPropertyTrees(
+ inputs->root_layer, inputs->page_scale_application_layer,
+ inputs->page_scale_factor, inputs->device_scale_factor,
+ gfx::Rect(inputs->device_viewport_size), inputs->device_transform,
+ &transform_tree, &clip_tree);
+
+ bool failed = false;
+ LayerIterator<Layer> it, end;
+ for (it = LayerIterator<Layer>::Begin(inputs->render_surface_layer_list),
+ end = LayerIterator<Layer>::End(inputs->render_surface_layer_list);
+ it != end; ++it) {
+ Layer* current_layer = *it;
+ if (it.represents_itself()) {
+ if (!failed && current_layer->DrawsContent() &&
+ !ApproximatelyEqual(
+ current_layer->visible_content_rect(),
+ current_layer->visible_rect_from_property_trees())) {
+ failed = true;
+ }
+ }
+ }
+
+ CHECK(!failed);
+ }
}
void LayerTreeHostCommon::CalculateDrawProperties(
« no previous file with comments | « cc/trees/layer_tree_host_common.h ('k') | cc/trees/layer_tree_host_common_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698