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

Side by Side Diff: cc/layers/nine_patch_layer_impl_unittest.cc

Issue 1180073015: cc: Remove LayerImpl::SetContentBounds() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rm-setcontentbounds: . Created 5 years, 6 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
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/painted_scrollbar_layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 TestSharedBitmapManager shared_bitmap_manager; 47 TestSharedBitmapManager shared_bitmap_manager;
48 TestTaskGraphRunner task_graph_runner; 48 TestTaskGraphRunner task_graph_runner;
49 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, 49 FakeUIResourceLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
50 &task_graph_runner); 50 &task_graph_runner);
51 host_impl.InitializeRenderer(FakeOutputSurface::Create3d()); 51 host_impl.InitializeRenderer(FakeOutputSurface::Create3d());
52 52
53 scoped_ptr<NinePatchLayerImpl> layer = 53 scoped_ptr<NinePatchLayerImpl> layer =
54 NinePatchLayerImpl::Create(host_impl.active_tree(), 1); 54 NinePatchLayerImpl::Create(host_impl.active_tree(), 1);
55 layer->draw_properties().visible_content_rect = visible_content_rect; 55 layer->draw_properties().visible_content_rect = visible_content_rect;
56 layer->SetBounds(layer_size); 56 layer->SetBounds(layer_size);
57 layer->SetContentBounds(layer_size);
58 layer->SetHasRenderSurface(true); 57 layer->SetHasRenderSurface(true);
59 layer->draw_properties().render_target = layer.get(); 58 layer->draw_properties().render_target = layer.get();
60 59
61 UIResourceId uid = 1; 60 UIResourceId uid = 1;
62 bool is_opaque = false; 61 bool is_opaque = false;
63 UIResourceBitmap bitmap(bitmap_size, is_opaque); 62 UIResourceBitmap bitmap(bitmap_size, is_opaque);
64 63
65 host_impl.CreateUIResource(uid, bitmap); 64 host_impl.CreateUIResource(uid, bitmap);
66 layer->SetUIResourceId(uid); 65 layer->SetUIResourceId(uid);
67 layer->SetImageBounds(bitmap_size); 66 layer->SetImageBounds(bitmap_size);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 SkBitmap sk_bitmap; 223 SkBitmap sk_bitmap;
225 sk_bitmap.allocN32Pixels(10, 10); 224 sk_bitmap.allocN32Pixels(10, 10);
226 sk_bitmap.setImmutable(); 225 sk_bitmap.setImmutable();
227 UIResourceId uid = 5; 226 UIResourceId uid = 5;
228 UIResourceBitmap bitmap(sk_bitmap); 227 UIResourceBitmap bitmap(sk_bitmap);
229 impl.host_impl()->CreateUIResource(uid, bitmap); 228 impl.host_impl()->CreateUIResource(uid, bitmap);
230 229
231 NinePatchLayerImpl* nine_patch_layer_impl = 230 NinePatchLayerImpl* nine_patch_layer_impl =
232 impl.AddChildToRoot<NinePatchLayerImpl>(); 231 impl.AddChildToRoot<NinePatchLayerImpl>();
233 nine_patch_layer_impl->SetBounds(layer_size); 232 nine_patch_layer_impl->SetBounds(layer_size);
234 nine_patch_layer_impl->SetContentBounds(layer_size);
235 nine_patch_layer_impl->SetDrawsContent(true); 233 nine_patch_layer_impl->SetDrawsContent(true);
236 nine_patch_layer_impl->SetUIResourceId(uid); 234 nine_patch_layer_impl->SetUIResourceId(uid);
237 nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10)); 235 nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10));
238 236
239 gfx::Rect aperture = gfx::Rect(3, 3, 4, 4); 237 gfx::Rect aperture = gfx::Rect(3, 3, 4, 4);
240 gfx::Rect border = gfx::Rect(300, 300, 400, 400); 238 gfx::Rect border = gfx::Rect(300, 300, 400, 400);
241 nine_patch_layer_impl->SetLayout(aperture, border, true); 239 nine_patch_layer_impl->SetLayout(aperture, border, true);
242 240
243 impl.CalcDrawProps(viewport_size); 241 impl.CalcDrawProps(viewport_size);
244 242
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 sk_bitmap_alpha.setAlphaType(kUnpremul_SkAlphaType); 295 sk_bitmap_alpha.setAlphaType(kUnpremul_SkAlphaType);
298 296
299 UIResourceId uid_alpha = 7; 297 UIResourceId uid_alpha = 7;
300 UIResourceBitmap bitmap_alpha(sk_bitmap_alpha); 298 UIResourceBitmap bitmap_alpha(sk_bitmap_alpha);
301 299
302 impl.host_impl()->CreateUIResource(uid_alpha, bitmap_alpha); 300 impl.host_impl()->CreateUIResource(uid_alpha, bitmap_alpha);
303 301
304 NinePatchLayerImpl *nine_patch_layer_impl = 302 NinePatchLayerImpl *nine_patch_layer_impl =
305 impl.AddChildToRoot<NinePatchLayerImpl>(); 303 impl.AddChildToRoot<NinePatchLayerImpl>();
306 nine_patch_layer_impl->SetBounds(layer_size); 304 nine_patch_layer_impl->SetBounds(layer_size);
307 nine_patch_layer_impl->SetContentBounds(layer_size);
308 nine_patch_layer_impl->SetDrawsContent(true); 305 nine_patch_layer_impl->SetDrawsContent(true);
309 306
310 impl.CalcDrawProps(viewport_size); 307 impl.CalcDrawProps(viewport_size);
311 308
312 { 309 {
313 SCOPED_TRACE("Use opaque image"); 310 SCOPED_TRACE("Use opaque image");
314 311
315 nine_patch_layer_impl->SetUIResourceId(uid_opaque); 312 nine_patch_layer_impl->SetUIResourceId(uid_opaque);
316 nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10)); 313 nine_patch_layer_impl->SetImageBounds(gfx::Size(10, 10));
317 314
(...skipping 18 matching lines...) Expand all
336 333
337 const QuadList &quad_list = impl.quad_list(); 334 const QuadList &quad_list = impl.quad_list();
338 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); 335 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin();
339 it != quad_list.BackToFrontEnd(); ++it) 336 it != quad_list.BackToFrontEnd(); ++it)
340 EXPECT_TRUE(it->ShouldDrawWithBlending()); 337 EXPECT_TRUE(it->ShouldDrawWithBlending());
341 } 338 }
342 } 339 }
343 340
344 } // namespace 341 } // namespace
345 } // namespace cc 342 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/painted_scrollbar_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698