| 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/tiled_layer_impl.h" | 5 #include "cc/tiled_layer_impl.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/single_thread_proxy.h" | 9 #include "cc/single_thread_proxy.h" |
| 10 #include "cc/test/layer_test_common.h" | 10 #include "cc/test/layer_test_common.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const gfx::Size layerSize(tileSize.width() * numTilesX, tileSize.height() *
numTilesY); | 103 const gfx::Size layerSize(tileSize.width() * numTilesX, tileSize.height() *
numTilesY); |
| 104 | 104 |
| 105 scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTil
ingData::NoBorderTexels); | 105 scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTil
ingData::NoBorderTexels); |
| 106 | 106 |
| 107 // No checkerboarding | 107 // No checkerboarding |
| 108 { | 108 { |
| 109 MockQuadCuller quadCuller; | 109 MockQuadCuller quadCuller; |
| 110 AppendQuadsData data; | 110 AppendQuadsData data; |
| 111 layer->appendQuads(quadCuller, data); | 111 layer->appendQuads(quadCuller, data); |
| 112 EXPECT_EQ(quadCuller.quadList().size(), 4u); | 112 EXPECT_EQ(quadCuller.quadList().size(), 4u); |
| 113 EXPECT_FALSE(data.hadMissingTiles); | 113 EXPECT_EQ(0u, data.numMissingTiles); |
| 114 | 114 |
| 115 for (size_t i = 0; i < quadCuller.quadList().size(); ++i) | 115 for (size_t i = 0; i < quadCuller.quadList().size(); ++i) |
| 116 EXPECT_EQ(quadCuller.quadList()[i]->material, DrawQuad::TILED_CONTEN
T); | 116 EXPECT_EQ(quadCuller.quadList()[i]->material, DrawQuad::TILED_CONTEN
T); |
| 117 } | 117 } |
| 118 | 118 |
| 119 for (int i = 0; i < numTilesX; ++i) | 119 for (int i = 0; i < numTilesX; ++i) |
| 120 for (int j = 0; j < numTilesY; ++j) | 120 for (int j = 0; j < numTilesY; ++j) |
| 121 layer->pushTileProperties(i, j, 0, gfx::Rect(), false); | 121 layer->pushTileProperties(i, j, 0, gfx::Rect(), false); |
| 122 | 122 |
| 123 // All checkerboarding | 123 // All checkerboarding |
| 124 { | 124 { |
| 125 MockQuadCuller quadCuller; | 125 MockQuadCuller quadCuller; |
| 126 AppendQuadsData data; | 126 AppendQuadsData data; |
| 127 layer->appendQuads(quadCuller, data); | 127 layer->appendQuads(quadCuller, data); |
| 128 EXPECT_TRUE(data.hadMissingTiles); | 128 EXPECT_LT(0u, data.numMissingTiles); |
| 129 EXPECT_EQ(quadCuller.quadList().size(), 4u); | 129 EXPECT_EQ(quadCuller.quadList().size(), 4u); |
| 130 for (size_t i = 0; i < quadCuller.quadList().size(); ++i) | 130 for (size_t i = 0; i < quadCuller.quadList().size(); ++i) |
| 131 EXPECT_NE(quadCuller.quadList()[i]->material, DrawQuad::TILED_CONTEN
T); | 131 EXPECT_NE(quadCuller.quadList()[i]->material, DrawQuad::TILED_CONTEN
T); |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 static void getQuads(QuadList& quads, SharedQuadStateList& sharedStates, gfx::Si
ze tileSize, const gfx::Size& layerSize, LayerTilingData::BorderTexelOption bord
erTexelOption, const gfx::Rect& visibleContentRect) | 135 static void getQuads(QuadList& quads, SharedQuadStateList& sharedStates, gfx::Si
ze tileSize, const gfx::Size& layerSize, LayerTilingData::BorderTexelOption bord
erTexelOption, const gfx::Rect& visibleContentRect) |
| 136 { | 136 { |
| 137 scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTe
xelOption); | 137 scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTe
xelOption); |
| 138 layer->drawProperties().visible_content_rect = visibleContentRect; | 138 layer->drawProperties().visible_content_rect = visibleContentRect; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 EXPECT_NE(0u, quad->resource_id) << quadString << i; | 204 EXPECT_NE(0u, quad->resource_id) << quadString << i; |
| 205 EXPECT_EQ(gfx::RectF(gfx::PointF(), tileSize), quad->tex_coord_rect) <<
quadString << i; | 205 EXPECT_EQ(gfx::RectF(gfx::PointF(), tileSize), quad->tex_coord_rect) <<
quadString << i; |
| 206 EXPECT_EQ(tileSize, quad->texture_size) << quadString << i; | 206 EXPECT_EQ(tileSize, quad->texture_size) << quadString << i; |
| 207 EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaque_rect) << quadString << i; | 207 EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaque_rect) << quadString << i; |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace | 211 } // namespace |
| 212 } // namespace cc | 212 } // namespace cc |
| OLD | NEW |