| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
| 8 #include "cc/layers/nine_patch_layer_impl.h" | 8 #include "cc/layers/nine_patch_layer_impl.h" |
| 9 #include "cc/quads/texture_draw_quad.h" | 9 #include "cc/quads/texture_draw_quad.h" |
| 10 #include "cc/resources/ui_resource_bitmap.h" | 10 #include "cc/resources/ui_resource_bitmap.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 return gfx::Rect(gfx::ToRoundedInt(rect_f.x()), | 28 return gfx::Rect(gfx::ToRoundedInt(rect_f.x()), |
| 29 gfx::ToRoundedInt(rect_f.y()), | 29 gfx::ToRoundedInt(rect_f.y()), |
| 30 gfx::ToRoundedInt(rect_f.width()), | 30 gfx::ToRoundedInt(rect_f.width()), |
| 31 gfx::ToRoundedInt(rect_f.height())); | 31 gfx::ToRoundedInt(rect_f.height())); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void NinePatchLayerLayoutTest(const gfx::Size& bitmap_size, | 34 void NinePatchLayerLayoutTest(const gfx::Size& bitmap_size, |
| 35 const gfx::Rect& aperture_rect, | 35 const gfx::Rect& aperture_rect, |
| 36 const gfx::Size& layer_size, | 36 const gfx::Size& layer_size, |
| 37 const gfx::Rect& border, | 37 const gfx::Rect& border, |
| 38 const gfx::Rect& occlusion, | |
| 39 bool fill_center, | 38 bool fill_center, |
| 40 size_t expected_quad_size) { | 39 size_t expected_quad_size) { |
| 41 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); | 40 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 42 gfx::Rect visible_layer_rect(layer_size); | 41 gfx::Rect visible_layer_rect(layer_size); |
| 43 gfx::Rect expected_layer_remaining; | 42 gfx::Rect expected_remaining(border.x(), |
| 44 gfx::Rect expected_tex_remaining; | 43 border.y(), |
| 45 | 44 layer_size.width() - border.width(), |
| 46 if (!occlusion.IsEmpty()) { | 45 layer_size.height() - border.height()); |
| 47 expected_layer_remaining = occlusion; | |
| 48 expected_tex_remaining.SetRect( | |
| 49 occlusion.x(), occlusion.y(), | |
| 50 (bitmap_size.width() - occlusion.x()) - | |
| 51 (layer_size.width() - occlusion.right()), | |
| 52 (bitmap_size.height() - occlusion.y()) - | |
| 53 (layer_size.height() - occlusion.bottom())); | |
| 54 } else { | |
| 55 expected_layer_remaining.SetRect(border.x(), border.y(), | |
| 56 layer_size.width() - border.width(), | |
| 57 layer_size.height() - border.height()); | |
| 58 expected_tex_remaining = aperture_rect; | |
| 59 } | |
| 60 | 46 |
| 61 FakeImplTaskRunnerProvider task_runner_provider; | 47 FakeImplTaskRunnerProvider task_runner_provider; |
| 62 TestSharedBitmapManager shared_bitmap_manager; | 48 TestSharedBitmapManager shared_bitmap_manager; |
| 63 TestTaskGraphRunner task_graph_runner; | 49 TestTaskGraphRunner task_graph_runner; |
| 64 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); | 50 std::unique_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); |
| 65 FakeUIResourceLayerTreeHostImpl host_impl( | 51 FakeUIResourceLayerTreeHostImpl host_impl( |
| 66 &task_runner_provider, &shared_bitmap_manager, &task_graph_runner); | 52 &task_runner_provider, &shared_bitmap_manager, &task_graph_runner); |
| 67 host_impl.SetVisible(true); | 53 host_impl.SetVisible(true); |
| 68 host_impl.InitializeRenderer(output_surface.get()); | 54 host_impl.InitializeRenderer(output_surface.get()); |
| 69 | 55 |
| 70 std::unique_ptr<NinePatchLayerImpl> layer = | 56 std::unique_ptr<NinePatchLayerImpl> layer = |
| 71 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); | 57 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); |
| 72 layer->draw_properties().visible_layer_rect = visible_layer_rect; | 58 layer->draw_properties().visible_layer_rect = visible_layer_rect; |
| 73 layer->SetBounds(layer_size); | 59 layer->SetBounds(layer_size); |
| 74 layer->SetForceRenderSurface(true); | 60 layer->SetForceRenderSurface(true); |
| 75 | 61 |
| 76 UIResourceId uid = 1; | 62 UIResourceId uid = 1; |
| 77 bool is_opaque = false; | 63 bool is_opaque = false; |
| 78 UIResourceBitmap bitmap(bitmap_size, is_opaque); | 64 UIResourceBitmap bitmap(bitmap_size, is_opaque); |
| 79 | 65 |
| 80 host_impl.CreateUIResource(uid, bitmap); | 66 host_impl.CreateUIResource(uid, bitmap); |
| 81 layer->SetUIResourceId(uid); | 67 layer->SetUIResourceId(uid); |
| 82 layer->SetImageBounds(bitmap_size); | 68 layer->SetImageBounds(bitmap_size); |
| 83 layer->SetLayout(aperture_rect, border, occlusion, fill_center, false); | 69 layer->SetLayout(aperture_rect, border, fill_center, false); |
| 84 AppendQuadsData data; | 70 AppendQuadsData data; |
| 85 layer->AppendQuads(render_pass.get(), &data); | 71 layer->AppendQuads(render_pass.get(), &data); |
| 86 | 72 |
| 87 // Verify quad rects | 73 // Verify quad rects |
| 88 const QuadList& quads = render_pass->quad_list; | 74 const QuadList& quads = render_pass->quad_list; |
| 89 EXPECT_EQ(expected_quad_size, quads.size()); | 75 EXPECT_EQ(expected_quad_size, quads.size()); |
| 90 | 76 |
| 91 Region layer_remaining(visible_layer_rect); | 77 Region remaining(visible_layer_rect); |
| 92 for (auto iter = quads.cbegin(); iter != quads.cend(); ++iter) { | 78 for (auto iter = quads.cbegin(); iter != quads.cend(); ++iter) { |
| 93 gfx::Rect quad_rect = iter->rect; | 79 gfx::Rect quad_rect = iter->rect; |
| 94 | 80 |
| 95 EXPECT_TRUE(visible_layer_rect.Contains(quad_rect)) << iter.index(); | 81 EXPECT_TRUE(visible_layer_rect.Contains(quad_rect)) << iter.index(); |
| 96 EXPECT_TRUE(layer_remaining.Contains(quad_rect)) << iter.index(); | 82 EXPECT_TRUE(remaining.Contains(quad_rect)) << iter.index(); |
| 97 layer_remaining.Subtract(Region(quad_rect)); | 83 remaining.Subtract(Region(quad_rect)); |
| 98 } | 84 } |
| 99 | 85 |
| 100 // Check if the left-over quad is the same size as the mapped aperture quad in | 86 // Check if the left-over quad is the same size as the mapped aperture quad in |
| 101 // layer space. | 87 // layer space. |
| 102 if (!fill_center) { | 88 if (!fill_center) { |
| 103 EXPECT_EQ(expected_layer_remaining, layer_remaining.bounds()); | 89 EXPECT_EQ(expected_remaining, remaining.bounds()); |
| 104 } else { | 90 } else { |
| 105 EXPECT_TRUE(layer_remaining.bounds().IsEmpty()); | 91 EXPECT_TRUE(remaining.bounds().IsEmpty()); |
| 106 } | 92 } |
| 107 | 93 |
| 108 // Verify UV rects | 94 // Verify UV rects |
| 109 gfx::Rect bitmap_rect(bitmap_size); | 95 gfx::Rect bitmap_rect(bitmap_size); |
| 110 Region tex_remaining(bitmap_rect); | 96 Region tex_remaining(bitmap_rect); |
| 111 for (const auto& quad : quads) { | 97 for (const auto& quad : quads) { |
| 112 const TextureDrawQuad* tex_quad = TextureDrawQuad::MaterialCast(quad); | 98 const TextureDrawQuad* tex_quad = TextureDrawQuad::MaterialCast(quad); |
| 113 gfx::RectF tex_rect = | 99 gfx::RectF tex_rect = |
| 114 gfx::BoundingRect(tex_quad->uv_top_left, tex_quad->uv_bottom_right); | 100 gfx::BoundingRect(tex_quad->uv_top_left, tex_quad->uv_bottom_right); |
| 115 tex_rect.Scale(bitmap_size.width(), bitmap_size.height()); | 101 tex_rect.Scale(bitmap_size.width(), bitmap_size.height()); |
| 116 tex_remaining.Subtract(Region(ToRoundedIntRect(tex_rect))); | 102 tex_remaining.Subtract(Region(ToRoundedIntRect(tex_rect))); |
| 117 } | 103 } |
| 118 | 104 |
| 119 if (!fill_center) { | 105 if (!fill_center) { |
| 120 EXPECT_EQ(expected_tex_remaining, tex_remaining.bounds()); | 106 EXPECT_EQ(aperture_rect, tex_remaining.bounds()); |
| 121 Region aperture_region(expected_tex_remaining); | 107 Region aperture_region(aperture_rect); |
| 122 EXPECT_EQ(aperture_region, tex_remaining); | 108 EXPECT_EQ(aperture_region, tex_remaining); |
| 123 } else { | 109 } else { |
| 124 EXPECT_TRUE(layer_remaining.bounds().IsEmpty()); | 110 EXPECT_TRUE(remaining.bounds().IsEmpty()); |
| 125 } | 111 } |
| 126 } | 112 } |
| 127 | 113 |
| 128 TEST(NinePatchLayerImplTest, VerifyDrawQuads) { | 114 TEST(NinePatchLayerImplTest, VerifyDrawQuads) { |
| 129 // Input is a 100x100 bitmap with a 40x50 aperture at x=20, y=30. | 115 // Input is a 100x100 bitmap with a 40x50 aperture at x=20, y=30. |
| 130 // The bounds of the layer are set to 400x400. | 116 // The bounds of the layer are set to 400x400. |
| 131 gfx::Size bitmap_size(100, 100); | 117 gfx::Size bitmap_size(100, 100); |
| 132 gfx::Size layer_size(400, 500); | 118 gfx::Size layer_size(400, 500); |
| 133 gfx::Rect aperture_rect(20, 30, 40, 50); | 119 gfx::Rect aperture_rect(20, 30, 40, 50); |
| 134 gfx::Rect border(40, 40, 80, 80); | 120 gfx::Rect border(40, 40, 80, 80); |
| 135 bool fill_center = false; | 121 bool fill_center = false; |
| 136 size_t expected_quad_size = 8; | 122 size_t expected_quad_size = 8; |
| 137 NinePatchLayerLayoutTest(bitmap_size, aperture_rect, layer_size, border, | 123 NinePatchLayerLayoutTest(bitmap_size, |
| 138 gfx::Rect(), fill_center, expected_quad_size); | 124 aperture_rect, |
| 125 layer_size, |
| 126 border, |
| 127 fill_center, |
| 128 expected_quad_size); |
| 139 | 129 |
| 140 // The bounds of the layer are set to less than the bitmap size. | 130 // The bounds of the layer are set to less than the bitmap size. |
| 141 bitmap_size = gfx::Size(100, 100); | 131 bitmap_size = gfx::Size(100, 100); |
| 142 layer_size = gfx::Size(40, 50); | 132 layer_size = gfx::Size(40, 50); |
| 143 aperture_rect = gfx::Rect(20, 30, 40, 50); | 133 aperture_rect = gfx::Rect(20, 30, 40, 50); |
| 144 border = gfx::Rect(10, 10, 25, 15); | 134 border = gfx::Rect(10, 10, 25, 15); |
| 145 fill_center = true; | 135 fill_center = true; |
| 146 expected_quad_size = 9; | 136 expected_quad_size = 9; |
| 147 NinePatchLayerLayoutTest(bitmap_size, aperture_rect, layer_size, border, | 137 NinePatchLayerLayoutTest(bitmap_size, |
| 148 gfx::Rect(), fill_center, expected_quad_size); | 138 aperture_rect, |
| 139 layer_size, |
| 140 border, |
| 141 fill_center, |
| 142 expected_quad_size); |
| 149 | 143 |
| 150 // Layer and image sizes are equal. | 144 // Layer and image sizes are equal. |
| 151 bitmap_size = gfx::Size(100, 100); | 145 bitmap_size = gfx::Size(100, 100); |
| 152 layer_size = gfx::Size(100, 100); | 146 layer_size = gfx::Size(100, 100); |
| 153 aperture_rect = gfx::Rect(20, 30, 40, 50); | 147 aperture_rect = gfx::Rect(20, 30, 40, 50); |
| 154 border = gfx::Rect(20, 30, 40, 50); | 148 border = gfx::Rect(20, 30, 40, 50); |
| 155 fill_center = true; | 149 fill_center = true; |
| 156 expected_quad_size = 9; | 150 expected_quad_size = 9; |
| 157 NinePatchLayerLayoutTest(bitmap_size, aperture_rect, layer_size, border, | 151 NinePatchLayerLayoutTest(bitmap_size, |
| 158 gfx::Rect(), fill_center, expected_quad_size); | 152 aperture_rect, |
| 159 } | 153 layer_size, |
| 160 | 154 border, |
| 161 TEST(NinePatchLayerImplTest, VerifyDrawQuadsWithOcclusion) { | 155 fill_center, |
| 162 // Input is a 100x100 bitmap with a 40x50 aperture at x=20, y=30. | 156 expected_quad_size); |
| 163 // The bounds of the layer are set to 400x400. | |
| 164 gfx::Size bitmap_size(100, 100); | |
| 165 gfx::Rect aperture_rect(30, 30, 40, 40); | |
| 166 gfx::Size layer_size(400, 400); | |
| 167 gfx::Rect occlusion(20, 20, 360, 360); | |
| 168 bool fill_center = false; | |
| 169 size_t expected_quad_size = 12; | |
| 170 NinePatchLayerLayoutTest(bitmap_size, aperture_rect, layer_size, gfx::Rect(), | |
| 171 occlusion, fill_center, expected_quad_size); | |
| 172 } | 157 } |
| 173 | 158 |
| 174 TEST(NinePatchLayerImplTest, VerifyDrawQuadsWithEmptyPatches) { | 159 TEST(NinePatchLayerImplTest, VerifyDrawQuadsWithEmptyPatches) { |
| 175 // The top component of the 9-patch is empty, so there should be no quads for | 160 // The top component of the 9-patch is empty, so there should be no quads for |
| 176 // the top three components. | 161 // the top three components. |
| 177 gfx::Size bitmap_size(100, 100); | 162 gfx::Size bitmap_size(100, 100); |
| 178 gfx::Size layer_size(100, 100); | 163 gfx::Size layer_size(100, 100); |
| 179 gfx::Rect aperture_rect(10, 0, 80, 90); | 164 gfx::Rect aperture_rect(10, 0, 80, 90); |
| 180 gfx::Rect border(10, 0, 20, 10); | 165 gfx::Rect border(10, 0, 20, 10); |
| 181 bool fill_center = false; | 166 bool fill_center = false; |
| 182 size_t expected_quad_size = 5; | 167 size_t expected_quad_size = 5; |
| 183 NinePatchLayerLayoutTest(bitmap_size, aperture_rect, layer_size, border, | 168 NinePatchLayerLayoutTest(bitmap_size, |
| 184 gfx::Rect(), fill_center, expected_quad_size); | 169 aperture_rect, |
| 170 layer_size, |
| 171 border, |
| 172 fill_center, |
| 173 expected_quad_size); |
| 185 | 174 |
| 186 // The top and left components of the 9-patch are empty, so there should be no | 175 // The top and left components of the 9-patch are empty, so there should be no |
| 187 // quads for the left and top components. | 176 // quads for the left and top components. |
| 188 bitmap_size = gfx::Size(100, 100); | 177 bitmap_size = gfx::Size(100, 100); |
| 189 layer_size = gfx::Size(100, 100); | 178 layer_size = gfx::Size(100, 100); |
| 190 aperture_rect = gfx::Rect(0, 0, 90, 90); | 179 aperture_rect = gfx::Rect(0, 0, 90, 90); |
| 191 border = gfx::Rect(0, 0, 10, 10); | 180 border = gfx::Rect(0, 0, 10, 10); |
| 192 fill_center = false; | 181 fill_center = false; |
| 193 expected_quad_size = 3; | 182 expected_quad_size = 3; |
| 194 NinePatchLayerLayoutTest(bitmap_size, aperture_rect, layer_size, border, | 183 NinePatchLayerLayoutTest(bitmap_size, |
| 195 gfx::Rect(), fill_center, expected_quad_size); | 184 aperture_rect, |
| 185 layer_size, |
| 186 border, |
| 187 fill_center, |
| 188 expected_quad_size); |
| 196 | 189 |
| 197 // The aperture is the size of the bitmap and the center doesn't draw. | 190 // The aperture is the size of the bitmap and the center doesn't draw. |
| 198 bitmap_size = gfx::Size(100, 100); | 191 bitmap_size = gfx::Size(100, 100); |
| 199 layer_size = gfx::Size(100, 100); | 192 layer_size = gfx::Size(100, 100); |
| 200 aperture_rect = gfx::Rect(0, 0, 100, 100); | 193 aperture_rect = gfx::Rect(0, 0, 100, 100); |
| 201 border = gfx::Rect(0, 0, 0, 0); | 194 border = gfx::Rect(0, 0, 0, 0); |
| 202 fill_center = false; | 195 fill_center = false; |
| 203 expected_quad_size = 0; | 196 expected_quad_size = 0; |
| 204 NinePatchLayerLayoutTest(bitmap_size, aperture_rect, layer_size, border, | 197 NinePatchLayerLayoutTest(bitmap_size, |
| 205 gfx::Rect(), fill_center, expected_quad_size); | 198 aperture_rect, |
| 199 layer_size, |
| 200 border, |
| 201 fill_center, |
| 202 expected_quad_size); |
| 206 | 203 |
| 207 // The aperture is the size of the bitmap and the center does draw. | 204 // The aperture is the size of the bitmap and the center does draw. |
| 208 bitmap_size = gfx::Size(100, 100); | 205 bitmap_size = gfx::Size(100, 100); |
| 209 layer_size = gfx::Size(100, 100); | 206 layer_size = gfx::Size(100, 100); |
| 210 aperture_rect = gfx::Rect(0, 0, 100, 100); | 207 aperture_rect = gfx::Rect(0, 0, 100, 100); |
| 211 border = gfx::Rect(0, 0, 0, 0); | 208 border = gfx::Rect(0, 0, 0, 0); |
| 212 fill_center = true; | 209 fill_center = true; |
| 213 expected_quad_size = 1; | 210 expected_quad_size = 1; |
| 214 NinePatchLayerLayoutTest(bitmap_size, aperture_rect, layer_size, border, | 211 NinePatchLayerLayoutTest(bitmap_size, |
| 215 gfx::Rect(), fill_center, expected_quad_size); | 212 aperture_rect, |
| 213 layer_size, |
| 214 border, |
| 215 fill_center, |
| 216 expected_quad_size); |
| 216 } | 217 } |
| 217 | 218 |
| 218 TEST(NinePatchLayerImplTest, Occlusion) { | 219 TEST(NinePatchLayerImplTest, Occlusion) { |
| 219 gfx::Size layer_size(1000, 1000); | 220 gfx::Size layer_size(1000, 1000); |
| 220 gfx::Size viewport_size(1000, 1000); | 221 gfx::Size viewport_size(1000, 1000); |
| 221 | 222 |
| 222 LayerTestCommon::LayerImplTest impl; | 223 LayerTestCommon::LayerImplTest impl; |
| 223 | 224 |
| 224 SkBitmap sk_bitmap; | 225 SkBitmap sk_bitmap; |
| 225 sk_bitmap.allocN32Pixels(10, 10); | 226 sk_bitmap.allocN32Pixels(10, 10); |
| 226 sk_bitmap.setImmutable(); | 227 sk_bitmap.setImmutable(); |
| 227 UIResourceId uid = 5; | 228 UIResourceId uid = 5; |
| 228 UIResourceBitmap bitmap(sk_bitmap); | 229 UIResourceBitmap bitmap(sk_bitmap); |
| 229 impl.host_impl()->CreateUIResource(uid, bitmap); | 230 impl.host_impl()->CreateUIResource(uid, bitmap); |
| 230 | 231 |
| 231 NinePatchLayerImpl* nine_patch_layer_impl = | 232 NinePatchLayerImpl* nine_patch_layer_impl = |
| 232 impl.AddChildToRoot<NinePatchLayerImpl>(); | 233 impl.AddChildToRoot<NinePatchLayerImpl>(); |
| 233 nine_patch_layer_impl->SetBounds(layer_size); | 234 nine_patch_layer_impl->SetBounds(layer_size); |
| 234 nine_patch_layer_impl->SetDrawsContent(true); | 235 nine_patch_layer_impl->SetDrawsContent(true); |
| 235 nine_patch_layer_impl->SetUIResourceId(uid); | 236 nine_patch_layer_impl->SetUIResourceId(uid); |
| 236 nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10)); | 237 nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10)); |
| 237 | 238 |
| 238 gfx::Rect aperture = gfx::Rect(3, 3, 4, 4); | 239 gfx::Rect aperture = gfx::Rect(3, 3, 4, 4); |
| 239 gfx::Rect border = gfx::Rect(300, 300, 400, 400); | 240 gfx::Rect border = gfx::Rect(300, 300, 400, 400); |
| 240 nine_patch_layer_impl->SetLayout(aperture, border, gfx::Rect(), true, false); | 241 nine_patch_layer_impl->SetLayout(aperture, border, true, false); |
| 241 | 242 |
| 242 impl.CalcDrawProps(viewport_size); | 243 impl.CalcDrawProps(viewport_size); |
| 243 | 244 |
| 244 { | 245 { |
| 245 SCOPED_TRACE("No occlusion"); | 246 SCOPED_TRACE("No occlusion"); |
| 246 gfx::Rect occluded; | 247 gfx::Rect occluded; |
| 247 impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, occluded); | 248 impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, occluded); |
| 248 | 249 |
| 249 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), | 250 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), |
| 250 gfx::Rect(layer_size)); | 251 gfx::Rect(layer_size)); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 impl.CalcDrawProps(viewport_size); | 309 impl.CalcDrawProps(viewport_size); |
| 309 | 310 |
| 310 { | 311 { |
| 311 SCOPED_TRACE("Use opaque image"); | 312 SCOPED_TRACE("Use opaque image"); |
| 312 | 313 |
| 313 nine_patch_layer_impl->SetUIResourceId(uid_opaque); | 314 nine_patch_layer_impl->SetUIResourceId(uid_opaque); |
| 314 nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10)); | 315 nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10)); |
| 315 | 316 |
| 316 gfx::Rect aperture = gfx::Rect(3, 3, 4, 4); | 317 gfx::Rect aperture = gfx::Rect(3, 3, 4, 4); |
| 317 gfx::Rect border = gfx::Rect(300, 300, 400, 400); | 318 gfx::Rect border = gfx::Rect(300, 300, 400, 400); |
| 318 nine_patch_layer_impl->SetLayout(aperture, border, gfx::Rect(), true, | 319 nine_patch_layer_impl->SetLayout(aperture, border, true, false); |
| 319 false); | |
| 320 | 320 |
| 321 impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, gfx::Rect()); | 321 impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, gfx::Rect()); |
| 322 | 322 |
| 323 const QuadList &quad_list = impl.quad_list(); | 323 const QuadList &quad_list = impl.quad_list(); |
| 324 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); | 324 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); |
| 325 it != quad_list.BackToFrontEnd(); ++it) | 325 it != quad_list.BackToFrontEnd(); ++it) |
| 326 EXPECT_FALSE(it->ShouldDrawWithBlending()); | 326 EXPECT_FALSE(it->ShouldDrawWithBlending()); |
| 327 } | 327 } |
| 328 | 328 |
| 329 { | 329 { |
| 330 SCOPED_TRACE("Use tranparent image"); | 330 SCOPED_TRACE("Use tranparent image"); |
| 331 | 331 |
| 332 nine_patch_layer_impl->SetUIResourceId(uid_alpha); | 332 nine_patch_layer_impl->SetUIResourceId(uid_alpha); |
| 333 | 333 |
| 334 impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, gfx::Rect()); | 334 impl.AppendQuadsWithOcclusion(nine_patch_layer_impl, gfx::Rect()); |
| 335 | 335 |
| 336 const QuadList &quad_list = impl.quad_list(); | 336 const QuadList &quad_list = impl.quad_list(); |
| 337 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); | 337 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); |
| 338 it != quad_list.BackToFrontEnd(); ++it) | 338 it != quad_list.BackToFrontEnd(); ++it) |
| 339 EXPECT_TRUE(it->ShouldDrawWithBlending()); | 339 EXPECT_TRUE(it->ShouldDrawWithBlending()); |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 | 342 |
| 343 } // namespace | 343 } // namespace |
| 344 } // namespace cc | 344 } // namespace cc |
| OLD | NEW |