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

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

Issue 295193002: Get rid of graphics layer anchor points, and replace with transform origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/test/layer_tree_json_parser.cc ('k') | cc/test/layer_tree_test.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 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 void LayerTreePixelTest::AfterTest() { 100 void LayerTreePixelTest::AfterTest() {
101 base::FilePath test_data_dir; 101 base::FilePath test_data_dir;
102 EXPECT_TRUE(PathService::Get(CCPaths::DIR_TEST_DATA, &test_data_dir)); 102 EXPECT_TRUE(PathService::Get(CCPaths::DIR_TEST_DATA, &test_data_dir));
103 base::FilePath ref_file_path = test_data_dir.Append(ref_file_); 103 base::FilePath ref_file_path = test_data_dir.Append(ref_file_);
104 104
105 CommandLine* cmd = CommandLine::ForCurrentProcess(); 105 CommandLine* cmd = CommandLine::ForCurrentProcess();
106 if (cmd->HasSwitch(switches::kCCRebaselinePixeltests)) 106 if (cmd->HasSwitch(switches::kCCRebaselinePixeltests))
107 EXPECT_TRUE(WritePNGFile(*result_bitmap_, ref_file_path, true)); 107 EXPECT_TRUE(WritePNGFile(*result_bitmap_, ref_file_path, true));
108
109 EXPECT_TRUE(MatchesPNGFile(*result_bitmap_, 108 EXPECT_TRUE(MatchesPNGFile(*result_bitmap_,
110 ref_file_path, 109 ref_file_path,
111 *pixel_comparator_)); 110 *pixel_comparator_));
112 } 111 }
113 112
114 scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer( 113 scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer(
115 const gfx::Rect& rect, SkColor color) { 114 const gfx::Rect& rect, SkColor color) {
116 scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create(); 115 scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create();
117 layer->SetIsDrawable(true); 116 layer->SetIsDrawable(true);
118 layer->SetAnchorPoint(gfx::PointF());
119 layer->SetBounds(rect.size()); 117 layer->SetBounds(rect.size());
120 layer->SetPosition(rect.origin()); 118 layer->SetPosition(rect.origin());
121 layer->SetBackgroundColor(color); 119 layer->SetBackgroundColor(color);
122 return layer; 120 return layer;
123 } 121 }
124 122
125 void LayerTreePixelTest::EndTest() { 123 void LayerTreePixelTest::EndTest() {
126 // Drop TextureMailboxes on the main thread so that they can be cleaned up and 124 // Drop TextureMailboxes on the main thread so that they can be cleaned up and
127 // the pending callbacks will fire. 125 // the pending callbacks will fire.
128 for (size_t i = 0; i < texture_layers_.size(); ++i) { 126 for (size_t i = 0; i < texture_layers_.size(); ++i) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 layer->AddChild(border_left); 165 layer->AddChild(border_left);
168 layer->AddChild(border_right); 166 layer->AddChild(border_right);
169 layer->AddChild(border_bottom); 167 layer->AddChild(border_bottom);
170 return layer; 168 return layer;
171 } 169 }
172 170
173 scoped_refptr<TextureLayer> LayerTreePixelTest::CreateTextureLayer( 171 scoped_refptr<TextureLayer> LayerTreePixelTest::CreateTextureLayer(
174 const gfx::Rect& rect, const SkBitmap& bitmap) { 172 const gfx::Rect& rect, const SkBitmap& bitmap) {
175 scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(NULL); 173 scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(NULL);
176 layer->SetIsDrawable(true); 174 layer->SetIsDrawable(true);
177 layer->SetAnchorPoint(gfx::PointF());
178 layer->SetBounds(rect.size()); 175 layer->SetBounds(rect.size());
179 layer->SetPosition(rect.origin()); 176 layer->SetPosition(rect.origin());
180 177
181 TextureMailbox texture_mailbox; 178 TextureMailbox texture_mailbox;
182 scoped_ptr<SingleReleaseCallback> release_callback; 179 scoped_ptr<SingleReleaseCallback> release_callback;
183 CopyBitmapToTextureMailboxAsTexture( 180 CopyBitmapToTextureMailboxAsTexture(
184 bitmap, &texture_mailbox, &release_callback); 181 bitmap, &texture_mailbox, &release_callback);
185 layer->SetTextureMailbox(texture_mailbox, release_callback.Pass()); 182 layer->SetTextureMailbox(texture_mailbox, release_callback.Pass());
186 183
187 texture_layers_.push_back(layer); 184 texture_layers_.push_back(layer);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 355
359 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); 356 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point);
360 *release_callback = SingleReleaseCallback::Create( 357 *release_callback = SingleReleaseCallback::Create(
361 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, 358 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox,
362 base::Unretained(this), 359 base::Unretained(this),
363 base::Passed(&context), 360 base::Passed(&context),
364 texture_id)); 361 texture_id));
365 } 362 }
366 363
367 } // namespace cc 364 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_json_parser.cc ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698