summaryrefslogtreecommitdiffstats
path: root/cc/test/layer_test_common.cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-19 23:27:57 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-19 23:27:57 +0000
commit654d97a3c4446bb28f4befdcd128ee22fe03d7f4 (patch)
tree8b9699156648b1dbd67e7bf8d8afac12adbd6ebc /cc/test/layer_test_common.cc
parent2e29807f5e8e640ce9ce09ba983be7b1c7056bb4 (diff)
downloadchromium_src-654d97a3c4446bb28f4befdcd128ee22fe03d7f4.zip
chromium_src-654d97a3c4446bb28f4befdcd128ee22fe03d7f4.tar.gz
chromium_src-654d97a3c4446bb28f4befdcd128ee22fe03d7f4.tar.bz2
cc: Apply occlusion before creating quads in TextureLayerImpl.
This makes the AppendQuads method query occlusion directly and subtract it from the quads it would create before they are created, skipping quads that are completely occluded and avoiding a malloc/free for them. R=enne@chromium.org, enne BUG=344962 Review URL: https://codereview.chromium.org/201153021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@258146 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/layer_test_common.cc')
-rw-r--r--cc/test/layer_test_common.cc29
1 files changed, 28 insertions, 1 deletions
diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc
index 85fbf6b..31a16e1 100644
--- a/cc/test/layer_test_common.cc
+++ b/cc/test/layer_test_common.cc
@@ -6,8 +6,11 @@
#include "cc/base/math_util.h"
#include "cc/base/region.h"
+#include "cc/layers/append_quads_data.h"
#include "cc/quads/draw_quad.h"
#include "cc/quads/render_pass.h"
+#include "cc/test/fake_output_surface.h"
+#include "cc/trees/layer_tree_host_common.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/rect.h"
@@ -89,8 +92,32 @@ void LayerTestCommon::VerifyQuadsCoverRectWithOcclusion(
LayerTestCommon::LayerImplTest::LayerImplTest()
: host_(FakeLayerTreeHost::Create()),
root_layer_impl_(
- LayerImpl::Create(host_->host_impl()->active_tree(), 1)) {}
+ LayerImpl::Create(host_->host_impl()->active_tree(), 1)) {
+ scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d();
+ host_->host_impl()->InitializeRenderer(
+ output_surface.PassAs<OutputSurface>());
+}
LayerTestCommon::LayerImplTest::~LayerImplTest() {}
+void LayerTestCommon::LayerImplTest::CalcDrawProps(
+ const gfx::Size& viewport_size) {
+ LayerImplList layer_list;
+ LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
+ root_layer_impl_.get(), viewport_size, &layer_list);
+ LayerTreeHostCommon::CalculateDrawProperties(&inputs);
+}
+
+void LayerTestCommon::LayerImplTest::AppendQuadsWithOcclusion(
+ LayerImpl* layer_impl,
+ const gfx::Rect& occluded) {
+ AppendQuadsData data;
+
+ quad_culler_.clear_lists();
+ quad_culler_.set_occluded_content_rect(occluded);
+ layer_impl->WillDraw(DRAW_MODE_HARDWARE, resource_provider());
+ layer_impl->AppendQuads(&quad_culler_, &data);
+ layer_impl->DidDraw(resource_provider());
+}
+
} // namespace cc