| 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 "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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 border_color); | 169 border_color); |
| 170 layer->AddChild(border_top); | 170 layer->AddChild(border_top); |
| 171 layer->AddChild(border_left); | 171 layer->AddChild(border_left); |
| 172 layer->AddChild(border_right); | 172 layer->AddChild(border_right); |
| 173 layer->AddChild(border_bottom); | 173 layer->AddChild(border_bottom); |
| 174 return layer; | 174 return layer; |
| 175 } | 175 } |
| 176 | 176 |
| 177 scoped_refptr<TextureLayer> LayerTreePixelTest::CreateTextureLayer( | 177 scoped_refptr<TextureLayer> LayerTreePixelTest::CreateTextureLayer( |
| 178 const gfx::Rect& rect, const SkBitmap& bitmap) { | 178 const gfx::Rect& rect, const SkBitmap& bitmap) { |
| 179 scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(NULL); | 179 scoped_refptr<TextureLayer> layer = TextureLayer::CreateForMailbox(nullptr); |
| 180 layer->SetIsDrawable(true); | 180 layer->SetIsDrawable(true); |
| 181 layer->SetBounds(rect.size()); | 181 layer->SetBounds(rect.size()); |
| 182 layer->SetPosition(rect.origin()); | 182 layer->SetPosition(rect.origin()); |
| 183 | 183 |
| 184 TextureMailbox texture_mailbox; | 184 TextureMailbox texture_mailbox; |
| 185 scoped_ptr<SingleReleaseCallback> release_callback; | 185 scoped_ptr<SingleReleaseCallback> release_callback; |
| 186 CopyBitmapToTextureMailboxAsTexture( | 186 CopyBitmapToTextureMailboxAsTexture( |
| 187 bitmap, &texture_mailbox, &release_callback); | 187 bitmap, &texture_mailbox, &release_callback); |
| 188 layer->SetTextureMailbox(texture_mailbox, release_callback.Pass()); | 188 layer->SetTextureMailbox(texture_mailbox, release_callback.Pass()); |
| 189 | 189 |
| 190 texture_layers_.push_back(layer); | 190 texture_layers_.push_back(layer); |
| 191 pending_texture_mailbox_callbacks_++; | 191 pending_texture_mailbox_callbacks_++; |
| 192 return layer; | 192 return layer; |
| 193 } | 193 } |
| 194 | 194 |
| 195 void LayerTreePixelTest::RunPixelTest( | 195 void LayerTreePixelTest::RunPixelTest( |
| 196 PixelTestType test_type, | 196 PixelTestType test_type, |
| 197 scoped_refptr<Layer> content_root, | 197 scoped_refptr<Layer> content_root, |
| 198 base::FilePath file_name) { | 198 base::FilePath file_name) { |
| 199 test_type_ = test_type; | 199 test_type_ = test_type; |
| 200 content_root_ = content_root; | 200 content_root_ = content_root; |
| 201 readback_target_ = NULL; | 201 readback_target_ = nullptr; |
| 202 ref_file_ = file_name; | 202 ref_file_ = file_name; |
| 203 RunTest(true, false, impl_side_painting_); | 203 RunTest(true, false, impl_side_painting_); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void LayerTreePixelTest::RunPixelTestWithReadbackTarget( | 206 void LayerTreePixelTest::RunPixelTestWithReadbackTarget( |
| 207 PixelTestType test_type, | 207 PixelTestType test_type, |
| 208 scoped_refptr<Layer> content_root, | 208 scoped_refptr<Layer> content_root, |
| 209 Layer* target, | 209 Layer* target, |
| 210 base::FilePath file_name) { | 210 base::FilePath file_name) { |
| 211 test_type_ = test_type; | 211 test_type_ = test_type; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 361 |
| 362 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); | 362 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); |
| 363 *release_callback = SingleReleaseCallback::Create( | 363 *release_callback = SingleReleaseCallback::Create( |
| 364 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, | 364 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, |
| 365 base::Unretained(this), | 365 base::Unretained(this), |
| 366 base::Passed(&context), | 366 base::Passed(&context), |
| 367 texture_id)); | 367 texture_id)); |
| 368 } | 368 } |
| 369 | 369 |
| 370 } // namespace cc | 370 } // namespace cc |
| OLD | NEW |