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

Side by Side Diff: cc/test/layer_test_common.cc

Issue 201153021: cc: Apply occlusion before creating quads in TextureLayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: append-texture: year Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/test/layer_test_common.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/layer_test_common.h" 5 #include "cc/test/layer_test_common.h"
6 6
7 #include "cc/base/math_util.h" 7 #include "cc/base/math_util.h"
8 #include "cc/base/region.h" 8 #include "cc/base/region.h"
9 #include "cc/layers/append_quads_data.h"
9 #include "cc/quads/draw_quad.h" 10 #include "cc/quads/draw_quad.h"
10 #include "cc/quads/render_pass.h" 11 #include "cc/quads/render_pass.h"
12 #include "cc/test/fake_output_surface.h"
13 #include "cc/trees/layer_tree_host_common.h"
11 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/gfx/point_conversions.h" 15 #include "ui/gfx/point_conversions.h"
13 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
14 #include "ui/gfx/rect_conversions.h" 17 #include "ui/gfx/rect_conversions.h"
15 #include "ui/gfx/size_conversions.h" 18 #include "ui/gfx/size_conversions.h"
16 19
17 namespace cc { 20 namespace cc {
18 21
19 // Align with expected and actual output. 22 // Align with expected and actual output.
20 const char* LayerTestCommon::quad_string = " Quad: "; 23 const char* LayerTestCommon::quad_string = " Quad: ";
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 EXPECT_NE(quad->rect.ToString(), quad->visible_rect.ToString()); 85 EXPECT_NE(quad->rect.ToString(), quad->visible_rect.ToString());
83 EXPECT_TRUE(quad->rect.Contains(quad->visible_rect)); 86 EXPECT_TRUE(quad->rect.Contains(quad->visible_rect));
84 ++(*partially_occluded_count); 87 ++(*partially_occluded_count);
85 } 88 }
86 } 89 }
87 } 90 }
88 91
89 LayerTestCommon::LayerImplTest::LayerImplTest() 92 LayerTestCommon::LayerImplTest::LayerImplTest()
90 : host_(FakeLayerTreeHost::Create()), 93 : host_(FakeLayerTreeHost::Create()),
91 root_layer_impl_( 94 root_layer_impl_(
92 LayerImpl::Create(host_->host_impl()->active_tree(), 1)) {} 95 LayerImpl::Create(host_->host_impl()->active_tree(), 1)) {
96 scoped_ptr<FakeOutputSurface> output_surface = FakeOutputSurface::Create3d();
97 host_->host_impl()->InitializeRenderer(
98 output_surface.PassAs<OutputSurface>());
99 }
93 100
94 LayerTestCommon::LayerImplTest::~LayerImplTest() {} 101 LayerTestCommon::LayerImplTest::~LayerImplTest() {}
95 102
103 void LayerTestCommon::LayerImplTest::CalcDrawProps(
104 const gfx::Size& viewport_size) {
105 LayerImplList layer_list;
106 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
107 root_layer_impl_.get(), viewport_size, &layer_list);
108 LayerTreeHostCommon::CalculateDrawProperties(&inputs);
109 }
110
111 void LayerTestCommon::LayerImplTest::AppendQuadsWithOcclusion(
112 LayerImpl* layer_impl,
113 const gfx::Rect& occluded) {
114 AppendQuadsData data;
115
116 quad_culler_.clear_lists();
117 quad_culler_.set_occluded_content_rect(occluded);
118 layer_impl->WillDraw(DRAW_MODE_HARDWARE, resource_provider());
119 layer_impl->AppendQuads(&quad_culler_, &data);
120 layer_impl->DidDraw(resource_provider());
121 }
122
96 } // namespace cc 123 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_test_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698