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 "base/containers/hash_tables.h" | 5 #include "base/containers/hash_tables.h" |
6 #include "cc/layers/append_quads_data.h" | 6 #include "cc/layers/append_quads_data.h" |
7 #include "cc/layers/nine_patch_layer_impl.h" | 7 #include "cc/layers/nine_patch_layer_impl.h" |
8 #include "cc/quads/texture_draw_quad.h" | 8 #include "cc/quads/texture_draw_quad.h" |
9 #include "cc/resources/ui_resource_bitmap.h" | 9 #include "cc/resources/ui_resource_bitmap.h" |
10 #include "cc/resources/ui_resource_client.h" | 10 #include "cc/resources/ui_resource_client.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 221 |
222 SkBitmap sk_bitmap; | 222 SkBitmap sk_bitmap; |
223 sk_bitmap.allocN32Pixels(10, 10); | 223 sk_bitmap.allocN32Pixels(10, 10); |
224 sk_bitmap.setImmutable(); | 224 sk_bitmap.setImmutable(); |
225 UIResourceId uid = 5; | 225 UIResourceId uid = 5; |
226 UIResourceBitmap bitmap(sk_bitmap); | 226 UIResourceBitmap bitmap(sk_bitmap); |
227 impl.host_impl()->CreateUIResource(uid, bitmap); | 227 impl.host_impl()->CreateUIResource(uid, bitmap); |
228 | 228 |
229 NinePatchLayerImpl* nine_patch_layer_impl = | 229 NinePatchLayerImpl* nine_patch_layer_impl = |
230 impl.AddChildToRoot<NinePatchLayerImpl>(); | 230 impl.AddChildToRoot<NinePatchLayerImpl>(); |
231 nine_patch_layer_impl->SetAnchorPoint(gfx::PointF()); | |
232 nine_patch_layer_impl->SetBounds(layer_size); | 231 nine_patch_layer_impl->SetBounds(layer_size); |
233 nine_patch_layer_impl->SetContentBounds(layer_size); | 232 nine_patch_layer_impl->SetContentBounds(layer_size); |
234 nine_patch_layer_impl->SetDrawsContent(true); | 233 nine_patch_layer_impl->SetDrawsContent(true); |
235 nine_patch_layer_impl->SetUIResourceId(uid); | 234 nine_patch_layer_impl->SetUIResourceId(uid); |
236 nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10)); | 235 nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10)); |
237 | 236 |
238 gfx::Rect aperture = gfx::Rect(3, 3, 4, 4); | 237 gfx::Rect aperture = gfx::Rect(3, 3, 4, 4); |
239 gfx::Rect border = gfx::Rect(300, 300, 400, 400); | 238 gfx::Rect border = gfx::Rect(300, 300, 400, 400); |
240 nine_patch_layer_impl->SetLayout(aperture, border, true); | 239 nine_patch_layer_impl->SetLayout(aperture, border, true); |
241 | 240 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 &partially_occluded_count); | 272 &partially_occluded_count); |
274 // The layer outputs nine quads, three of which are partially occluded, and | 273 // The layer outputs nine quads, three of which are partially occluded, and |
275 // three fully occluded. | 274 // three fully occluded. |
276 EXPECT_EQ(6u, impl.quad_list().size()); | 275 EXPECT_EQ(6u, impl.quad_list().size()); |
277 EXPECT_EQ(3u, partially_occluded_count); | 276 EXPECT_EQ(3u, partially_occluded_count); |
278 } | 277 } |
279 } | 278 } |
280 | 279 |
281 } // namespace | 280 } // namespace |
282 } // namespace cc | 281 } // namespace cc |
OLD | NEW |