cc: Replace Region with SimpleEnclosedRegion for occlusion tracking
Instead of using an arbitrary Region, which is costly (slow), use
a new SimpleEnclosedRegion. This class tracks only a single Rect
at a given time so it is very fast and small. It tries to get
something like the largest rect enclosed in the actual Region
(were we to track such a Region) in an online fashion, ie it
doesn't remember anything except its current largest possible
rect.
BUG=405663
Review URL: https://codereview.chromium.org/202523002
Cr-Commit-Position: refs/heads/master@{#291292}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291292 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index 87cb2f8a..affdad9d 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -11,6 +11,7 @@
#include "cc/animation/animation_registrar.h"
#include "cc/animation/scrollbar_animation_controller.h"
#include "cc/base/math_util.h"
+#include "cc/base/simple_enclosed_region.h"
#include "cc/debug/debug_colors.h"
#include "cc/debug/layer_tree_debug_state.h"
#include "cc/debug/micro_benchmark_impl.h"
@@ -1147,10 +1148,10 @@
NoteLayerPropertyChangedForSubtree();
}
-Region LayerImpl::VisibleContentOpaqueRegion() const {
+SimpleEnclosedRegion LayerImpl::VisibleContentOpaqueRegion() const {
if (contents_opaque())
- return visible_content_rect();
- return Region();
+ return SimpleEnclosedRegion(visible_content_rect());
+ return SimpleEnclosedRegion();
}
void LayerImpl::DidBeginTracing() {}