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

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: Fixed. 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
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()); 117 layer->SetTransformOrigin(gfx::Point3F());
119 layer->SetBounds(rect.size()); 118 layer->SetBounds(rect.size());
120 layer->SetPosition(rect.origin()); 119 layer->SetPosition(rect.origin());
121 layer->SetBackgroundColor(color); 120 layer->SetBackgroundColor(color);
122 return layer; 121 return layer;
123 } 122 }
124 123
125 void LayerTreePixelTest::EndTest() { 124 void LayerTreePixelTest::EndTest() {
126 // Drop TextureMailboxes on the main thread so that they can be cleaned up and 125 // Drop TextureMailboxes on the main thread so that they can be cleaned up and
127 // the pending callbacks will fire. 126 // the pending callbacks will fire.
128 for (size_t i = 0; i < texture_layers_.size(); ++i) { 127 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); 166 layer->AddChild(border_left);
168 layer->AddChild(border_right); 167 layer->AddChild(border_right);
169 layer->AddChild(border_bottom); 168 layer->AddChild(border_bottom);
170 return layer; 169 return layer;
171 } 170 }
172 171
173 scoped_refptr<TextureLayer> LayerTreePixelTest::CreateTextureLayer( 172 scoped_refptr<TextureLayer> LayerTreePixelTest::CreateTextureLayer(
174 const gfx::Rect& rect, const SkBitmap& bitmap) { 173 const gfx::Rect& rect, const SkBitmap& bitmap) {
175 scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(NULL); 174 scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(NULL);
176 layer->SetIsDrawable(true); 175 layer->SetIsDrawable(true);
177 layer->SetAnchorPoint(gfx::PointF()); 176 layer->SetTransformOrigin(gfx::Point3F());
178 layer->SetBounds(rect.size()); 177 layer->SetBounds(rect.size());
179 layer->SetPosition(rect.origin()); 178 layer->SetPosition(rect.origin());
180 179
181 TextureMailbox texture_mailbox; 180 TextureMailbox texture_mailbox;
182 scoped_ptr<SingleReleaseCallback> release_callback; 181 scoped_ptr<SingleReleaseCallback> release_callback;
183 CopyBitmapToTextureMailboxAsTexture( 182 CopyBitmapToTextureMailboxAsTexture(
184 bitmap, &texture_mailbox, &release_callback); 183 bitmap, &texture_mailbox, &release_callback);
185 layer->SetTextureMailbox(texture_mailbox, release_callback.Pass()); 184 layer->SetTextureMailbox(texture_mailbox, release_callback.Pass());
186 185
187 texture_layers_.push_back(layer); 186 texture_layers_.push_back(layer);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 357
359 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); 358 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point);
360 *release_callback = SingleReleaseCallback::Create( 359 *release_callback = SingleReleaseCallback::Create(
361 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, 360 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox,
362 base::Unretained(this), 361 base::Unretained(this),
363 base::Passed(&context), 362 base::Passed(&context),
364 texture_id)); 363 texture_id));
365 } 364 }
366 365
367 } // namespace cc 366 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698