| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 output_surface->set_surface_expansion_size(surface_expansion_size); | 61 output_surface->set_surface_expansion_size(surface_expansion_size); |
| 62 return std::move(output_surface); | 62 return std::move(output_surface); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void LayerTreePixelTest::WillCommitCompleteOnThread(LayerTreeHostImpl* impl) { | 65 void LayerTreePixelTest::WillCommitCompleteOnThread(LayerTreeHostImpl* impl) { |
| 66 if (impl->sync_tree()->source_frame_number() != 0) | 66 if (impl->sync_tree()->source_frame_number() != 0) |
| 67 return; | 67 return; |
| 68 | 68 |
| 69 DirectRenderer* renderer = static_cast<DirectRenderer*>(impl->renderer()); | 69 DirectRenderer* renderer = static_cast<DirectRenderer*>(impl->renderer()); |
| 70 renderer->SetEnlargePassTextureAmountForTesting(enlarge_texture_amount_); | 70 renderer->SetEnlargePassTextureAmountForTesting(enlarge_texture_amount_); |
| 71 | |
| 72 gfx::Rect viewport = impl->DeviceViewport(); | |
| 73 // The viewport has a 0,0 origin without external influence. | |
| 74 EXPECT_EQ(gfx::Point().ToString(), viewport.origin().ToString()); | |
| 75 // Be that influence! | |
| 76 viewport += gfx::Vector2d(20, 10); | |
| 77 bool resourceless_software_draw = false; | |
| 78 gfx::Transform identity = gfx::Transform(); | |
| 79 impl->SetExternalDrawConstraints(identity, | |
| 80 viewport, | |
| 81 viewport, | |
| 82 viewport, | |
| 83 identity, | |
| 84 resourceless_software_draw); | |
| 85 EXPECT_EQ(viewport.ToString(), impl->DeviceViewport().ToString()); | |
| 86 } | 71 } |
| 87 | 72 |
| 88 scoped_ptr<CopyOutputRequest> LayerTreePixelTest::CreateCopyOutputRequest() { | 73 scoped_ptr<CopyOutputRequest> LayerTreePixelTest::CreateCopyOutputRequest() { |
| 89 return CopyOutputRequest::CreateBitmapRequest( | 74 return CopyOutputRequest::CreateBitmapRequest( |
| 90 base::Bind(&LayerTreePixelTest::ReadbackResult, base::Unretained(this))); | 75 base::Bind(&LayerTreePixelTest::ReadbackResult, base::Unretained(this))); |
| 91 } | 76 } |
| 92 | 77 |
| 93 void LayerTreePixelTest::ReadbackResult(scoped_ptr<CopyOutputResult> result) { | 78 void LayerTreePixelTest::ReadbackResult(scoped_ptr<CopyOutputResult> result) { |
| 94 ASSERT_TRUE(result->HasBitmap()); | 79 ASSERT_TRUE(result->HasBitmap()); |
| 95 result_bitmap_ = result->TakeBitmap(); | 80 result_bitmap_ = result->TakeBitmap(); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return bitmap; | 266 return bitmap; |
| 282 } | 267 } |
| 283 | 268 |
| 284 void LayerTreePixelTest::Finish() { | 269 void LayerTreePixelTest::Finish() { |
| 285 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); | 270 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); |
| 286 GLES2Interface* gl = context->GetImplementation(); | 271 GLES2Interface* gl = context->GetImplementation(); |
| 287 gl->Finish(); | 272 gl->Finish(); |
| 288 } | 273 } |
| 289 | 274 |
| 290 } // namespace cc | 275 } // namespace cc |
| OLD | NEW |