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

Side by Side Diff: cc/quad_culler_unittest.cc

Issue 11418047: cc: Turn DrawQuad into a struct-like class with public data members. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no virtual for SetAll() Created 8 years, 1 month 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/quad_culler.cc ('k') | cc/render_pass_draw_quad.cc » ('j') | 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/quad_culler.h" 5 #include "cc/quad_culler.h"
6 6
7 #include "cc/append_quads_data.h" 7 #include "cc/append_quads_data.h"
8 #include "cc/layer_tiling_data.h" 8 #include "cc/layer_tiling_data.h"
9 #include "cc/math_util.h" 9 #include "cc/math_util.h"
10 #include "cc/occlusion_tracker.h" 10 #include "cc/occlusion_tracker.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix( ), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList); 172 scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix( ), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
173 scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTran sform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList); 173 scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTran sform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
174 TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000)) ; 174 TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000)) ;
175 LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); 175 LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
176 176
177 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke r); 177 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke r);
178 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker ); 178 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker );
179 ASSERT_EQ(quadList.size(), 12u); 179 ASSERT_EQ(quadList.size(), 12u);
180 180
181 gfx::Rect quadVisibleRect1 = quadList[5]->visible_rect(); 181 gfx::Rect quadVisibleRect1 = quadList[5]->visible_rect;
182 EXPECT_EQ(quadVisibleRect1.height(), 50); 182 EXPECT_EQ(quadVisibleRect1.height(), 50);
183 183
184 gfx::Rect quadVisibleRect3 = quadList[7]->visible_rect(); 184 gfx::Rect quadVisibleRect3 = quadList[7]->visible_rect;
185 EXPECT_EQ(quadVisibleRect3.width(), 50); 185 EXPECT_EQ(quadVisibleRect3.width(), 50);
186 186
187 // Next index is 8, not 9, since centre quad culled. 187 // Next index is 8, not 9, since centre quad culled.
188 gfx::Rect quadVisibleRect4 = quadList[8]->visible_rect(); 188 gfx::Rect quadVisibleRect4 = quadList[8]->visible_rect;
189 EXPECT_EQ(quadVisibleRect4.width(), 50); 189 EXPECT_EQ(quadVisibleRect4.width(), 50);
190 EXPECT_EQ(quadVisibleRect4.x(), 250); 190 EXPECT_EQ(quadVisibleRect4.x(), 250);
191 191
192 gfx::Rect quadVisibleRect6 = quadList[10]->visible_rect(); 192 gfx::Rect quadVisibleRect6 = quadList[10]->visible_rect;
193 EXPECT_EQ(quadVisibleRect6.height(), 50); 193 EXPECT_EQ(quadVisibleRect6.height(), 50);
194 EXPECT_EQ(quadVisibleRect6.y(), 250); 194 EXPECT_EQ(quadVisibleRect6.y(), 250);
195 195
196 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 100000, 1); 196 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 100000, 1);
197 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1); 197 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
198 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 300 00, 1); 198 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 300 00, 1);
199 } 199 }
200 200
201 TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize1) 201 TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize1)
202 { 202 {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke r); 459 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke r);
460 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker ); 460 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker );
461 EXPECT_EQ(quadList.size(), 9u); 461 EXPECT_EQ(quadList.size(), 9u);
462 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 0, 1); 462 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 0, 1);
463 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1); 463 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0, 1);
464 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1); 464 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0, 1);
465 } 465 }
466 466
467 } // namespace 467 } // namespace
468 } // namespace cc 468 } // namespace cc
OLDNEW
« no previous file with comments | « cc/quad_culler.cc ('k') | cc/render_pass_draw_quad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698