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

Side by Side Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 1314943008: cc: Remove implicit conversions from Rect to RectF in src/cc/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rectfconvert-cc: rebase-and-sandwich-strategy Created 5 years, 3 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_synchronous.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 6105 matching lines...) Expand 10 before | Expand all | Expand 10 after
6116 Mock::VerifyAndClearExpectations(&mock_context); 6116 Mock::VerifyAndClearExpectations(&mock_context);
6117 } 6117 }
6118 6118
6119 class LayerTreeHostImplTestWithDelegatingRenderer 6119 class LayerTreeHostImplTestWithDelegatingRenderer
6120 : public LayerTreeHostImplTest { 6120 : public LayerTreeHostImplTest {
6121 protected: 6121 protected:
6122 scoped_ptr<OutputSurface> CreateOutputSurface() override { 6122 scoped_ptr<OutputSurface> CreateOutputSurface() override {
6123 return FakeOutputSurface::CreateDelegating3d(); 6123 return FakeOutputSurface::CreateDelegating3d();
6124 } 6124 }
6125 6125
6126 void DrawFrameAndTestDamage(const gfx::RectF& expected_damage) { 6126 void DrawFrameAndTestDamage(const gfx::Rect& expected_damage) {
6127 bool expect_to_draw = !expected_damage.IsEmpty(); 6127 bool expect_to_draw = !expected_damage.IsEmpty();
6128 6128
6129 LayerTreeHostImpl::FrameData frame; 6129 LayerTreeHostImpl::FrameData frame;
6130 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 6130 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
6131 6131
6132 if (!expect_to_draw) { 6132 if (!expect_to_draw) {
6133 // With no damage, we don't draw, and no quads are created. 6133 // With no damage, we don't draw, and no quads are created.
6134 ASSERT_EQ(0u, frame.render_passes.size()); 6134 ASSERT_EQ(0u, frame.render_passes.size());
6135 } else { 6135 } else {
6136 ASSERT_EQ(1u, frame.render_passes.size()); 6136 ASSERT_EQ(1u, frame.render_passes.size());
6137 6137
6138 // Verify the damage rect for the root render pass. 6138 // Verify the damage rect for the root render pass.
6139 const RenderPass* root_render_pass = frame.render_passes.back(); 6139 const RenderPass* root_render_pass = frame.render_passes.back();
6140 EXPECT_EQ(expected_damage, root_render_pass->damage_rect); 6140 EXPECT_EQ(expected_damage, root_render_pass->damage_rect);
6141 6141
6142 // Verify the root and child layers' quads are generated and not being 6142 // Verify the root and child layers' quads are generated and not being
6143 // culled. 6143 // culled.
6144 ASSERT_EQ(2u, root_render_pass->quad_list.size()); 6144 ASSERT_EQ(2u, root_render_pass->quad_list.size());
6145 6145
6146 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; 6146 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0];
6147 gfx::RectF expected_child_visible_rect(child->bounds()); 6147 gfx::Rect expected_child_visible_rect(child->bounds());
6148 EXPECT_EQ(expected_child_visible_rect, 6148 EXPECT_EQ(expected_child_visible_rect,
6149 root_render_pass->quad_list.front()->visible_rect); 6149 root_render_pass->quad_list.front()->visible_rect);
6150 6150
6151 LayerImpl* root = host_impl_->active_tree()->root_layer(); 6151 LayerImpl* root = host_impl_->active_tree()->root_layer();
6152 gfx::RectF expected_root_visible_rect(root->bounds()); 6152 gfx::Rect expected_root_visible_rect(root->bounds());
6153 EXPECT_EQ(expected_root_visible_rect, 6153 EXPECT_EQ(expected_root_visible_rect,
6154 root_render_pass->quad_list.ElementAt(1)->visible_rect); 6154 root_render_pass->quad_list.ElementAt(1)->visible_rect);
6155 } 6155 }
6156 6156
6157 host_impl_->DrawLayers(&frame); 6157 host_impl_->DrawLayers(&frame);
6158 host_impl_->DidDrawAllLayers(frame); 6158 host_impl_->DidDrawAllLayers(frame);
6159 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame)); 6159 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame));
6160 } 6160 }
6161 }; 6161 };
6162 6162
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
6277 LayerTreeHostImpl::FrameData frame; 6277 LayerTreeHostImpl::FrameData frame;
6278 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 6278 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
6279 6279
6280 ASSERT_EQ(1u, frame.render_passes.size()); 6280 ASSERT_EQ(1u, frame.render_passes.size());
6281 ASSERT_LE(1u, frame.render_passes[0]->quad_list.size()); 6281 ASSERT_LE(1u, frame.render_passes[0]->quad_list.size());
6282 const DrawQuad* quad = frame.render_passes[0]->quad_list.front(); 6282 const DrawQuad* quad = frame.render_passes[0]->quad_list.front();
6283 6283
6284 bool clipped = false, force_aa = false; 6284 bool clipped = false, force_aa = false;
6285 gfx::QuadF device_layer_quad = MathUtil::MapQuad( 6285 gfx::QuadF device_layer_quad = MathUtil::MapQuad(
6286 quad->shared_quad_state->quad_to_target_transform, 6286 quad->shared_quad_state->quad_to_target_transform,
6287 gfx::QuadF(quad->shared_quad_state->visible_quad_layer_rect), &clipped); 6287 gfx::QuadF(gfx::RectF(quad->shared_quad_state->visible_quad_layer_rect)),
6288 &clipped);
6288 EXPECT_FALSE(clipped); 6289 EXPECT_FALSE(clipped);
6289 bool antialiased = 6290 bool antialiased =
6290 GLRendererWithSetupQuadForAntialiasing::ShouldAntialiasQuad( 6291 GLRendererWithSetupQuadForAntialiasing::ShouldAntialiasQuad(
6291 device_layer_quad, clipped, force_aa); 6292 device_layer_quad, clipped, force_aa);
6292 EXPECT_FALSE(antialiased); 6293 EXPECT_FALSE(antialiased);
6293 6294
6294 host_impl_->DrawLayers(&frame); 6295 host_impl_->DrawLayers(&frame);
6295 host_impl_->DidDrawAllLayers(frame); 6296 host_impl_->DidDrawAllLayers(frame);
6296 } 6297 }
6297 6298
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after
8504 // Hold an unowned pointer to the output surface to use for mock expectations. 8505 // Hold an unowned pointer to the output surface to use for mock expectations.
8505 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); 8506 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get();
8506 8507
8507 CreateHostImpl(DefaultSettings(), output_surface.Pass()); 8508 CreateHostImpl(DefaultSettings(), output_surface.Pass());
8508 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); 8509 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1);
8509 host_impl_->BeginCommit(); 8510 host_impl_->BeginCommit();
8510 } 8511 }
8511 8512
8512 } // namespace 8513 } // namespace
8513 } // namespace cc 8514 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_synchronous.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698