| OLD | NEW |
| 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/layers/tiled_layer_impl.h" | 5 #include "cc/layers/tiled_layer_impl.h" |
| 6 | 6 |
| 7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
| 8 #include "cc/quads/tile_draw_quad.h" | 8 #include "cc/quads/tile_draw_quad.h" |
| 9 #include "cc/resources/layer_tiling_data.h" | 9 #include "cc/resources/layer_tiling_data.h" |
| 10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // No checkerboarding | 156 // No checkerboarding |
| 157 { | 157 { |
| 158 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 158 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 159 | 159 |
| 160 AppendQuadsData data; | 160 AppendQuadsData data; |
| 161 layer->AppendQuads(render_pass.get(), Occlusion(), &data); | 161 layer->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 162 EXPECT_EQ(render_pass->quad_list.size(), 4u); | 162 EXPECT_EQ(render_pass->quad_list.size(), 4u); |
| 163 EXPECT_EQ(0u, data.num_missing_tiles); | 163 EXPECT_EQ(0u, data.num_missing_tiles); |
| 164 | 164 |
| 165 for (const auto& quad : render_pass->quad_list) | 165 for (const auto& quad : render_pass->quad_list) |
| 166 EXPECT_EQ(quad.material, DrawQuad::TILED_CONTENT); | 166 EXPECT_EQ(quad->material, DrawQuad::TILED_CONTENT); |
| 167 } | 167 } |
| 168 | 168 |
| 169 for (int i = 0; i < num_tiles_x; ++i) | 169 for (int i = 0; i < num_tiles_x; ++i) |
| 170 for (int j = 0; j < num_tiles_y; ++j) | 170 for (int j = 0; j < num_tiles_y; ++j) |
| 171 layer->PushTileProperties(i, j, 0, false); | 171 layer->PushTileProperties(i, j, 0, false); |
| 172 | 172 |
| 173 // All checkerboarding | 173 // All checkerboarding |
| 174 { | 174 { |
| 175 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 175 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 176 | 176 |
| 177 AppendQuadsData data; | 177 AppendQuadsData data; |
| 178 layer->AppendQuads(render_pass.get(), Occlusion(), &data); | 178 layer->AppendQuads(render_pass.get(), Occlusion(), &data); |
| 179 EXPECT_LT(0u, data.num_missing_tiles); | 179 EXPECT_LT(0u, data.num_missing_tiles); |
| 180 EXPECT_EQ(render_pass->quad_list.size(), 4u); | 180 EXPECT_EQ(render_pass->quad_list.size(), 4u); |
| 181 for (const auto& quad : render_pass->quad_list) | 181 for (const auto& quad : render_pass->quad_list) |
| 182 EXPECT_NE(quad.material, DrawQuad::TILED_CONTENT); | 182 EXPECT_NE(quad->material, DrawQuad::TILED_CONTENT); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 // Test with both border texels and without. | 186 // Test with both border texels and without. |
| 187 #define WITH_AND_WITHOUT_BORDER_TEST(text_fixture_name) \ | 187 #define WITH_AND_WITHOUT_BORDER_TEST(text_fixture_name) \ |
| 188 TEST_F(TiledLayerImplBorderTest, text_fixture_name##NoBorders) { \ | 188 TEST_F(TiledLayerImplBorderTest, text_fixture_name##NoBorders) { \ |
| 189 text_fixture_name(LayerTilingData::NO_BORDER_TEXELS); \ | 189 text_fixture_name(LayerTilingData::NO_BORDER_TEXELS); \ |
| 190 } \ | 190 } \ |
| 191 TEST_F(TiledLayerImplBorderTest, text_fixture_name##HasBorders) { \ | 191 TEST_F(TiledLayerImplBorderTest, text_fixture_name##HasBorders) { \ |
| 192 text_fixture_name(LayerTilingData::HAS_BORDER_TEXELS); \ | 192 text_fixture_name(LayerTilingData::HAS_BORDER_TEXELS); \ |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 251 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 252 GetQuads(render_pass.get(), | 252 GetQuads(render_pass.get(), |
| 253 tile_size, | 253 tile_size, |
| 254 layer_size, | 254 layer_size, |
| 255 LayerTilingData::NO_BORDER_TEXELS, | 255 LayerTilingData::NO_BORDER_TEXELS, |
| 256 gfx::Rect(layer_size)); | 256 gfx::Rect(layer_size)); |
| 257 | 257 |
| 258 for (auto iter = render_pass->quad_list.cbegin(); | 258 for (auto iter = render_pass->quad_list.cbegin(); |
| 259 iter != render_pass->quad_list.cend(); | 259 iter != render_pass->quad_list.cend(); |
| 260 ++iter) { | 260 ++iter) { |
| 261 const TileDrawQuad* quad = TileDrawQuad::MaterialCast(&*iter); | 261 const TileDrawQuad* quad = TileDrawQuad::MaterialCast(*iter); |
| 262 | 262 |
| 263 EXPECT_NE(0u, quad->resource_id) << LayerTestCommon::quad_string | 263 EXPECT_NE(0u, quad->resource_id) << LayerTestCommon::quad_string |
| 264 << iter.index(); | 264 << iter.index(); |
| 265 EXPECT_EQ(gfx::RectF(gfx::PointF(), tile_size), quad->tex_coord_rect) | 265 EXPECT_EQ(gfx::RectF(gfx::PointF(), tile_size), quad->tex_coord_rect) |
| 266 << LayerTestCommon::quad_string << iter.index(); | 266 << LayerTestCommon::quad_string << iter.index(); |
| 267 EXPECT_EQ(tile_size, quad->texture_size) << LayerTestCommon::quad_string | 267 EXPECT_EQ(tile_size, quad->texture_size) << LayerTestCommon::quad_string |
| 268 << iter.index(); | 268 << iter.index(); |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 LayerTestCommon::VerifyQuadsAreOccluded( | 366 LayerTestCommon::VerifyQuadsAreOccluded( |
| 367 impl.quad_list(), occluded, &partially_occluded_count); | 367 impl.quad_list(), occluded, &partially_occluded_count); |
| 368 // The layer outputs one quad, which is partially occluded. | 368 // The layer outputs one quad, which is partially occluded. |
| 369 EXPECT_EQ(100u - 10u, impl.quad_list().size()); | 369 EXPECT_EQ(100u - 10u, impl.quad_list().size()); |
| 370 EXPECT_EQ(10u + 10u, partially_occluded_count); | 370 EXPECT_EQ(10u + 10u, partially_occluded_count); |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 | 373 |
| 374 } // namespace | 374 } // namespace |
| 375 } // namespace cc | 375 } // namespace cc |
| OLD | NEW |