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

Side by Side Diff: cc/test/layer_tree_pixel_test.cc

Issue 1122393003: CC: Plumb LayerSettings parameter for cc::Layer construction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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/test/layer_tree_json_parser.cc ('k') | cc/test/layer_tree_test.h » ('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 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/test/layer_tree_pixel_test.h" 5 #include "cc/test/layer_tree_pixel_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "cc/base/switches.h" 9 #include "cc/base/switches.h"
10 #include "cc/layers/solid_color_layer.h" 10 #include "cc/layers/solid_color_layer.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 112 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
113 if (cmd->HasSwitch(switches::kCCRebaselinePixeltests)) 113 if (cmd->HasSwitch(switches::kCCRebaselinePixeltests))
114 EXPECT_TRUE(WritePNGFile(*result_bitmap_, ref_file_path, true)); 114 EXPECT_TRUE(WritePNGFile(*result_bitmap_, ref_file_path, true));
115 EXPECT_TRUE(MatchesPNGFile(*result_bitmap_, 115 EXPECT_TRUE(MatchesPNGFile(*result_bitmap_,
116 ref_file_path, 116 ref_file_path,
117 *pixel_comparator_)); 117 *pixel_comparator_));
118 } 118 }
119 119
120 scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer( 120 scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer(
121 const gfx::Rect& rect, SkColor color) { 121 const gfx::Rect& rect, SkColor color) {
122 scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create(); 122 scoped_refptr<SolidColorLayer> layer =
123 SolidColorLayer::Create(layer_settings());
123 layer->SetIsDrawable(true); 124 layer->SetIsDrawable(true);
124 layer->SetBounds(rect.size()); 125 layer->SetBounds(rect.size());
125 layer->SetPosition(rect.origin()); 126 layer->SetPosition(rect.origin());
126 layer->SetBackgroundColor(color); 127 layer->SetBackgroundColor(color);
127 return layer; 128 return layer;
128 } 129 }
129 130
130 void LayerTreePixelTest::EndTest() { 131 void LayerTreePixelTest::EndTest() {
131 // Drop TextureMailboxes on the main thread so that they can be cleaned up and 132 // Drop TextureMailboxes on the main thread so that they can be cleaned up and
132 // the pending callbacks will fire. 133 // the pending callbacks will fire.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 border_color); 170 border_color);
170 layer->AddChild(border_top); 171 layer->AddChild(border_top);
171 layer->AddChild(border_left); 172 layer->AddChild(border_left);
172 layer->AddChild(border_right); 173 layer->AddChild(border_right);
173 layer->AddChild(border_bottom); 174 layer->AddChild(border_bottom);
174 return layer; 175 return layer;
175 } 176 }
176 177
177 scoped_refptr<TextureLayer> LayerTreePixelTest::CreateTextureLayer( 178 scoped_refptr<TextureLayer> LayerTreePixelTest::CreateTextureLayer(
178 const gfx::Rect& rect, const SkBitmap& bitmap) { 179 const gfx::Rect& rect, const SkBitmap& bitmap) {
179 scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(NULL); 180 scoped_refptr<TextureLayer> layer =
181 TextureLayer::CreateForMailbox(layer_settings(), NULL);
180 layer->SetIsDrawable(true); 182 layer->SetIsDrawable(true);
181 layer->SetBounds(rect.size()); 183 layer->SetBounds(rect.size());
182 layer->SetPosition(rect.origin()); 184 layer->SetPosition(rect.origin());
183 185
184 TextureMailbox texture_mailbox; 186 TextureMailbox texture_mailbox;
185 scoped_ptr<SingleReleaseCallback> release_callback; 187 scoped_ptr<SingleReleaseCallback> release_callback;
186 CopyBitmapToTextureMailboxAsTexture( 188 CopyBitmapToTextureMailboxAsTexture(
187 bitmap, &texture_mailbox, &release_callback); 189 bitmap, &texture_mailbox, &release_callback);
188 layer->SetTextureMailbox(texture_mailbox, release_callback.Pass()); 190 layer->SetTextureMailbox(texture_mailbox, release_callback.Pass());
189 191
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 Layer* target, 224 Layer* target,
223 base::FilePath file_name) { 225 base::FilePath file_name) {
224 test_type_ = test_type; 226 test_type_ = test_type;
225 content_root_ = content_root; 227 content_root_ = content_root;
226 readback_target_ = target; 228 readback_target_ = target;
227 ref_file_ = file_name; 229 ref_file_ = file_name;
228 RunTest(true, false, impl_side_painting_); 230 RunTest(true, false, impl_side_painting_);
229 } 231 }
230 232
231 void LayerTreePixelTest::SetupTree() { 233 void LayerTreePixelTest::SetupTree() {
232 scoped_refptr<Layer> root = Layer::Create(); 234 scoped_refptr<Layer> root = Layer::Create(layer_settings());
233 root->SetBounds(content_root_->bounds()); 235 root->SetBounds(content_root_->bounds());
234 root->AddChild(content_root_); 236 root->AddChild(content_root_);
235 layer_tree_host()->SetRootLayer(root); 237 layer_tree_host()->SetRootLayer(root);
236 LayerTreeTest::SetupTree(); 238 LayerTreeTest::SetupTree();
237 } 239 }
238 240
239 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( 241 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap(
240 const gfx::Size& size, 242 const gfx::Size& size,
241 const TextureMailbox& texture_mailbox) { 243 const TextureMailbox& texture_mailbox) {
242 DCHECK(texture_mailbox.IsTexture()); 244 DCHECK(texture_mailbox.IsTexture());
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 376
375 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); 377 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point);
376 *release_callback = SingleReleaseCallback::Create( 378 *release_callback = SingleReleaseCallback::Create(
377 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, 379 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox,
378 base::Unretained(this), 380 base::Unretained(this),
379 base::Passed(&context), 381 base::Passed(&context),
380 texture_id)); 382 texture_id));
381 } 383 }
382 384
383 } // namespace cc 385 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_json_parser.cc ('k') | cc/test/layer_tree_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698