| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 ref_file_path, | 115 ref_file_path, |
| 116 *pixel_comparator_)); | 116 *pixel_comparator_)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer( | 119 scoped_refptr<SolidColorLayer> LayerTreePixelTest::CreateSolidColorLayer( |
| 120 const gfx::Rect& rect, SkColor color) { | 120 const gfx::Rect& rect, SkColor color) { |
| 121 scoped_refptr<SolidColorLayer> layer = | 121 scoped_refptr<SolidColorLayer> layer = |
| 122 SolidColorLayer::Create(layer_settings()); | 122 SolidColorLayer::Create(layer_settings()); |
| 123 layer->SetIsDrawable(true); | 123 layer->SetIsDrawable(true); |
| 124 layer->SetBounds(rect.size()); | 124 layer->SetBounds(rect.size()); |
| 125 layer->SetPosition(rect.origin()); | 125 layer->SetPosition(gfx::PointF(rect.origin())); |
| 126 layer->SetBackgroundColor(color); | 126 layer->SetBackgroundColor(color); |
| 127 return layer; | 127 return layer; |
| 128 } | 128 } |
| 129 | 129 |
| 130 void LayerTreePixelTest::EndTest() { | 130 void LayerTreePixelTest::EndTest() { |
| 131 // Drop TextureMailboxes on the main thread so that they can be cleaned up and | 131 // Drop TextureMailboxes on the main thread so that they can be cleaned up and |
| 132 // the pending callbacks will fire. | 132 // the pending callbacks will fire. |
| 133 for (size_t i = 0; i < texture_layers_.size(); ++i) { | 133 for (size_t i = 0; i < texture_layers_.size(); ++i) { |
| 134 texture_layers_[i]->SetTextureMailbox(TextureMailbox(), nullptr); | 134 texture_layers_[i]->SetTextureMailbox(TextureMailbox(), nullptr); |
| 135 } | 135 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = | 179 scoped_refptr<TextureLayer> layer = |
| 180 TextureLayer::CreateForMailbox(layer_settings(), NULL); | 180 TextureLayer::CreateForMailbox(layer_settings(), NULL); |
| 181 layer->SetIsDrawable(true); | 181 layer->SetIsDrawable(true); |
| 182 layer->SetBounds(rect.size()); | 182 layer->SetBounds(rect.size()); |
| 183 layer->SetPosition(rect.origin()); | 183 layer->SetPosition(gfx::PointF(rect.origin())); |
| 184 | 184 |
| 185 TextureMailbox texture_mailbox; | 185 TextureMailbox texture_mailbox; |
| 186 scoped_ptr<SingleReleaseCallback> release_callback; | 186 scoped_ptr<SingleReleaseCallback> release_callback; |
| 187 CopyBitmapToTextureMailboxAsTexture( | 187 CopyBitmapToTextureMailboxAsTexture( |
| 188 bitmap, &texture_mailbox, &release_callback); | 188 bitmap, &texture_mailbox, &release_callback); |
| 189 layer->SetTextureMailbox(texture_mailbox, release_callback.Pass()); | 189 layer->SetTextureMailbox(texture_mailbox, release_callback.Pass()); |
| 190 | 190 |
| 191 texture_layers_.push_back(layer); | 191 texture_layers_.push_back(layer); |
| 192 pending_texture_mailbox_callbacks_++; | 192 pending_texture_mailbox_callbacks_++; |
| 193 return layer; | 193 return layer; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 texture_id)); | 381 texture_id)); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void LayerTreePixelTest::Finish() { | 384 void LayerTreePixelTest::Finish() { |
| 385 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); | 385 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); |
| 386 GLES2Interface* gl = context->GetImplementation(); | 386 GLES2Interface* gl = context->GetImplementation(); |
| 387 gl->Finish(); | 387 gl->Finish(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace cc | 390 } // namespace cc |
| OLD | NEW |