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

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: 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
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 6010 matching lines...) Expand 10 before | Expand all | Expand 10 after
6021 Mock::VerifyAndClearExpectations(&mock_context); 6021 Mock::VerifyAndClearExpectations(&mock_context);
6022 } 6022 }
6023 6023
6024 class LayerTreeHostImplTestWithDelegatingRenderer 6024 class LayerTreeHostImplTestWithDelegatingRenderer
6025 : public LayerTreeHostImplTest { 6025 : public LayerTreeHostImplTest {
6026 protected: 6026 protected:
6027 scoped_ptr<OutputSurface> CreateOutputSurface() override { 6027 scoped_ptr<OutputSurface> CreateOutputSurface() override {
6028 return FakeOutputSurface::CreateDelegating3d(); 6028 return FakeOutputSurface::CreateDelegating3d();
6029 } 6029 }
6030 6030
6031 void DrawFrameAndTestDamage(const gfx::RectF& expected_damage) { 6031 void DrawFrameAndTestDamage(const gfx::Rect& expected_damage) {
6032 bool expect_to_draw = !expected_damage.IsEmpty(); 6032 bool expect_to_draw = !expected_damage.IsEmpty();
6033 6033
6034 LayerTreeHostImpl::FrameData frame; 6034 LayerTreeHostImpl::FrameData frame;
6035 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 6035 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
6036 6036
6037 if (!expect_to_draw) { 6037 if (!expect_to_draw) {
6038 // With no damage, we don't draw, and no quads are created. 6038 // With no damage, we don't draw, and no quads are created.
6039 ASSERT_EQ(0u, frame.render_passes.size()); 6039 ASSERT_EQ(0u, frame.render_passes.size());
6040 } else { 6040 } else {
6041 ASSERT_EQ(1u, frame.render_passes.size()); 6041 ASSERT_EQ(1u, frame.render_passes.size());
6042 6042
6043 // Verify the damage rect for the root render pass. 6043 // Verify the damage rect for the root render pass.
6044 const RenderPass* root_render_pass = frame.render_passes.back(); 6044 const RenderPass* root_render_pass = frame.render_passes.back();
6045 EXPECT_EQ(expected_damage, root_render_pass->damage_rect); 6045 EXPECT_EQ(expected_damage, root_render_pass->damage_rect);
6046 6046
6047 // Verify the root and child layers' quads are generated and not being 6047 // Verify the root and child layers' quads are generated and not being
6048 // culled. 6048 // culled.
6049 ASSERT_EQ(2u, root_render_pass->quad_list.size()); 6049 ASSERT_EQ(2u, root_render_pass->quad_list.size());
6050 6050
6051 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0]; 6051 LayerImpl* child = host_impl_->active_tree()->root_layer()->children()[0];
6052 gfx::RectF expected_child_visible_rect(child->bounds()); 6052 gfx::Rect expected_child_visible_rect(child->bounds());
6053 EXPECT_EQ(expected_child_visible_rect, 6053 EXPECT_EQ(expected_child_visible_rect,
6054 root_render_pass->quad_list.front()->visible_rect); 6054 root_render_pass->quad_list.front()->visible_rect);
6055 6055
6056 LayerImpl* root = host_impl_->active_tree()->root_layer(); 6056 LayerImpl* root = host_impl_->active_tree()->root_layer();
6057 gfx::RectF expected_root_visible_rect(root->bounds()); 6057 gfx::Rect expected_root_visible_rect(root->bounds());
6058 EXPECT_EQ(expected_root_visible_rect, 6058 EXPECT_EQ(expected_root_visible_rect,
6059 root_render_pass->quad_list.ElementAt(1)->visible_rect); 6059 root_render_pass->quad_list.ElementAt(1)->visible_rect);
6060 } 6060 }
6061 6061
6062 host_impl_->DrawLayers(&frame); 6062 host_impl_->DrawLayers(&frame);
6063 host_impl_->DidDrawAllLayers(frame); 6063 host_impl_->DidDrawAllLayers(frame);
6064 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame)); 6064 EXPECT_EQ(expect_to_draw, host_impl_->SwapBuffers(frame));
6065 } 6065 }
6066 }; 6066 };
6067 6067
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
6182 LayerTreeHostImpl::FrameData frame; 6182 LayerTreeHostImpl::FrameData frame;
6183 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); 6183 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame));
6184 6184
6185 ASSERT_EQ(1u, frame.render_passes.size()); 6185 ASSERT_EQ(1u, frame.render_passes.size());
6186 ASSERT_LE(1u, frame.render_passes[0]->quad_list.size()); 6186 ASSERT_LE(1u, frame.render_passes[0]->quad_list.size());
6187 const DrawQuad* quad = frame.render_passes[0]->quad_list.front(); 6187 const DrawQuad* quad = frame.render_passes[0]->quad_list.front();
6188 6188
6189 bool clipped = false, force_aa = false; 6189 bool clipped = false, force_aa = false;
6190 gfx::QuadF device_layer_quad = MathUtil::MapQuad( 6190 gfx::QuadF device_layer_quad = MathUtil::MapQuad(
6191 quad->shared_quad_state->quad_to_target_transform, 6191 quad->shared_quad_state->quad_to_target_transform,
6192 gfx::QuadF(quad->shared_quad_state->visible_quad_layer_rect), &clipped); 6192 gfx::QuadF(gfx::RectF(quad->shared_quad_state->visible_quad_layer_rect)),
6193 &clipped);
6193 EXPECT_FALSE(clipped); 6194 EXPECT_FALSE(clipped);
6194 bool antialiased = 6195 bool antialiased =
6195 GLRendererWithSetupQuadForAntialiasing::ShouldAntialiasQuad( 6196 GLRendererWithSetupQuadForAntialiasing::ShouldAntialiasQuad(
6196 device_layer_quad, clipped, force_aa); 6197 device_layer_quad, clipped, force_aa);
6197 EXPECT_FALSE(antialiased); 6198 EXPECT_FALSE(antialiased);
6198 6199
6199 host_impl_->DrawLayers(&frame); 6200 host_impl_->DrawLayers(&frame);
6200 host_impl_->DidDrawAllLayers(frame); 6201 host_impl_->DidDrawAllLayers(frame);
6201 } 6202 }
6202 6203
(...skipping 2206 matching lines...) Expand 10 before | Expand all | Expand 10 after
8409 // Hold an unowned pointer to the output surface to use for mock expectations. 8410 // Hold an unowned pointer to the output surface to use for mock expectations.
8410 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get(); 8411 MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get();
8411 8412
8412 CreateHostImpl(DefaultSettings(), output_surface.Pass()); 8413 CreateHostImpl(DefaultSettings(), output_surface.Pass());
8413 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1); 8414 EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1);
8414 host_impl_->BeginCommit(); 8415 host_impl_->BeginCommit();
8415 } 8416 }
8416 8417
8417 } // namespace 8418 } // namespace
8418 } // namespace cc 8419 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698