| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 99 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 100 if (cmd->HasSwitch(switches::kCCRebaselinePixeltests)) | 100 if (cmd->HasSwitch(switches::kCCRebaselinePixeltests)) |
| 101 EXPECT_TRUE(WritePNGFile(*result_bitmap_, ref_file_path, true)); | 101 EXPECT_TRUE(WritePNGFile(*result_bitmap_, ref_file_path, true)); |
| 102 EXPECT_TRUE(MatchesPNGFile(*result_bitmap_, | 102 EXPECT_TRUE(MatchesPNGFile(*result_bitmap_, |
| 103 ref_file_path, | 103 ref_file_path, |
| 104 *pixel_comparator_)); | 104 *pixel_comparator_)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer( | 107 scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer( |
| 108 const gfx::Rect& rect, SkColor color) { | 108 const gfx::Rect& rect, SkColor color) { |
| 109 scoped_refptr<SolidColorLayer> layer = | 109 scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create(); |
| 110 SolidColorLayer::Create(layer_settings()); | |
| 111 layer->SetIsDrawable(true); | 110 layer->SetIsDrawable(true); |
| 112 layer->SetBounds(rect.size()); | 111 layer->SetBounds(rect.size()); |
| 113 layer->SetPosition(gfx::PointF(rect.origin())); | 112 layer->SetPosition(gfx::PointF(rect.origin())); |
| 114 layer->SetBackgroundColor(color); | 113 layer->SetBackgroundColor(color); |
| 115 return layer; | 114 return layer; |
| 116 } | 115 } |
| 117 | 116 |
| 118 void LayerTreePixelTest::EndTest() { | 117 void LayerTreePixelTest::EndTest() { |
| 119 // Drop TextureMailboxes on the main thread so that they can be cleaned up and | 118 // Drop TextureMailboxes on the main thread so that they can be cleaned up and |
| 120 // the pending callbacks will fire. | 119 // the pending callbacks will fire. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 Layer* target, | 189 Layer* target, |
| 191 base::FilePath file_name) { | 190 base::FilePath file_name) { |
| 192 test_type_ = test_type; | 191 test_type_ = test_type; |
| 193 content_root_ = content_root; | 192 content_root_ = content_root; |
| 194 readback_target_ = target; | 193 readback_target_ = target; |
| 195 ref_file_ = file_name; | 194 ref_file_ = file_name; |
| 196 RunTest(CompositorMode::THREADED, false); | 195 RunTest(CompositorMode::THREADED, false); |
| 197 } | 196 } |
| 198 | 197 |
| 199 void LayerTreePixelTest::SetupTree() { | 198 void LayerTreePixelTest::SetupTree() { |
| 200 scoped_refptr<Layer> root = Layer::Create(layer_settings()); | 199 scoped_refptr<Layer> root = Layer::Create(); |
| 201 root->SetBounds(content_root_->bounds()); | 200 root->SetBounds(content_root_->bounds()); |
| 202 root->AddChild(content_root_); | 201 root->AddChild(content_root_); |
| 203 layer_tree_host()->SetRootLayer(root); | 202 layer_tree_host()->SetRootLayer(root); |
| 204 LayerTreeTest::SetupTree(); | 203 LayerTreeTest::SetupTree(); |
| 205 } | 204 } |
| 206 | 205 |
| 207 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( | 206 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( |
| 208 const gfx::Size& size, | 207 const gfx::Size& size, |
| 209 const TextureMailbox& texture_mailbox) { | 208 const TextureMailbox& texture_mailbox) { |
| 210 DCHECK(texture_mailbox.IsTexture()); | 209 DCHECK(texture_mailbox.IsTexture()); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 return bitmap; | 268 return bitmap; |
| 270 } | 269 } |
| 271 | 270 |
| 272 void LayerTreePixelTest::Finish() { | 271 void LayerTreePixelTest::Finish() { |
| 273 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); | 272 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); |
| 274 GLES2Interface* gl = context->GetImplementation(); | 273 GLES2Interface* gl = context->GetImplementation(); |
| 275 gl->Finish(); | 274 gl->Finish(); |
| 276 } | 275 } |
| 277 | 276 |
| 278 } // namespace cc | 277 } // namespace cc |
| OLD | NEW |