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

Side by Side Diff: cc/layers/ui_resource_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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/append_quads_data.h" 5 #include "cc/layers/append_quads_data.h"
6 #include "cc/layers/ui_resource_layer_impl.h" 6 #include "cc/layers/ui_resource_layer_impl.h"
7 #include "cc/quads/draw_quad.h" 7 #include "cc/quads/draw_quad.h"
8 #include "cc/resources/ui_resource_bitmap.h" 8 #include "cc/resources/ui_resource_bitmap.h"
9 #include "cc/resources/ui_resource_client.h" 9 #include "cc/resources/ui_resource_client.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
(...skipping 15 matching lines...) Expand all
26 FakeUIResourceLayerTreeHostImpl* host_impl, 26 FakeUIResourceLayerTreeHostImpl* host_impl,
27 const gfx::Size& bitmap_size, 27 const gfx::Size& bitmap_size,
28 const gfx::Size& layer_size, 28 const gfx::Size& layer_size,
29 bool opaque, 29 bool opaque,
30 UIResourceId uid) { 30 UIResourceId uid) {
31 gfx::Rect visible_content_rect(layer_size); 31 gfx::Rect visible_content_rect(layer_size);
32 scoped_ptr<UIResourceLayerImpl> layer = 32 scoped_ptr<UIResourceLayerImpl> layer =
33 UIResourceLayerImpl::Create(host_impl->active_tree(), 1); 33 UIResourceLayerImpl::Create(host_impl->active_tree(), 1);
34 layer->draw_properties().visible_content_rect = visible_content_rect; 34 layer->draw_properties().visible_content_rect = visible_content_rect;
35 layer->SetBounds(layer_size); 35 layer->SetBounds(layer_size);
36 layer->SetContentBounds(layer_size);
37 layer->SetHasRenderSurface(true); 36 layer->SetHasRenderSurface(true);
38 layer->draw_properties().render_target = layer.get(); 37 layer->draw_properties().render_target = layer.get();
39 38
40 UIResourceBitmap bitmap(bitmap_size, opaque); 39 UIResourceBitmap bitmap(bitmap_size, opaque);
41 40
42 host_impl->CreateUIResource(uid, bitmap); 41 host_impl->CreateUIResource(uid, bitmap);
43 layer->SetUIResourceId(uid); 42 layer->SetUIResourceId(uid);
44 43
45 return layer.Pass(); 44 return layer.Pass();
46 } 45 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 SkBitmap sk_bitmap; 166 SkBitmap sk_bitmap;
168 sk_bitmap.allocN32Pixels(10, 10); 167 sk_bitmap.allocN32Pixels(10, 10);
169 sk_bitmap.setImmutable(); 168 sk_bitmap.setImmutable();
170 UIResourceId uid = 5; 169 UIResourceId uid = 5;
171 UIResourceBitmap bitmap(sk_bitmap); 170 UIResourceBitmap bitmap(sk_bitmap);
172 impl.host_impl()->CreateUIResource(uid, bitmap); 171 impl.host_impl()->CreateUIResource(uid, bitmap);
173 172
174 UIResourceLayerImpl* ui_resource_layer_impl = 173 UIResourceLayerImpl* ui_resource_layer_impl =
175 impl.AddChildToRoot<UIResourceLayerImpl>(); 174 impl.AddChildToRoot<UIResourceLayerImpl>();
176 ui_resource_layer_impl->SetBounds(layer_size); 175 ui_resource_layer_impl->SetBounds(layer_size);
177 ui_resource_layer_impl->SetContentBounds(layer_size);
178 ui_resource_layer_impl->SetDrawsContent(true); 176 ui_resource_layer_impl->SetDrawsContent(true);
179 ui_resource_layer_impl->SetUIResourceId(uid); 177 ui_resource_layer_impl->SetUIResourceId(uid);
180 178
181 impl.CalcDrawProps(viewport_size); 179 impl.CalcDrawProps(viewport_size);
182 180
183 { 181 {
184 SCOPED_TRACE("No occlusion"); 182 SCOPED_TRACE("No occlusion");
185 gfx::Rect occluded; 183 gfx::Rect occluded;
186 impl.AppendQuadsWithOcclusion(ui_resource_layer_impl, occluded); 184 impl.AppendQuadsWithOcclusion(ui_resource_layer_impl, occluded);
187 185
(...skipping 20 matching lines...) Expand all
208 LayerTestCommon::VerifyQuadsAreOccluded( 206 LayerTestCommon::VerifyQuadsAreOccluded(
209 impl.quad_list(), occluded, &partially_occluded_count); 207 impl.quad_list(), occluded, &partially_occluded_count);
210 // The layer outputs one quad, which is partially occluded. 208 // The layer outputs one quad, which is partially occluded.
211 EXPECT_EQ(1u, impl.quad_list().size()); 209 EXPECT_EQ(1u, impl.quad_list().size());
212 EXPECT_EQ(1u, partially_occluded_count); 210 EXPECT_EQ(1u, partially_occluded_count);
213 } 211 }
214 } 212 }
215 213
216 } // namespace 214 } // namespace
217 } // namespace cc 215 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer_impl_unittest.cc ('k') | cc/layers/video_frame_provider_client_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698