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

Side by Side Diff: cc/test/layer_tree_pixel_test.cc

Issue 608503005: Revert of cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « cc/test/layer_test_common.cc ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 29 matching lines...) Expand all
40 scoped_ptr<PixelTestOutputSurface> output_surface; 40 scoped_ptr<PixelTestOutputSurface> output_surface;
41 41
42 switch (test_type_) { 42 switch (test_type_) {
43 case SOFTWARE_WITH_DEFAULT: 43 case SOFTWARE_WITH_DEFAULT:
44 case SOFTWARE_WITH_BITMAP: { 44 case SOFTWARE_WITH_BITMAP: {
45 scoped_ptr<PixelTestSoftwareOutputDevice> software_output_device( 45 scoped_ptr<PixelTestSoftwareOutputDevice> software_output_device(
46 new PixelTestSoftwareOutputDevice); 46 new PixelTestSoftwareOutputDevice);
47 software_output_device->set_surface_expansion_size( 47 software_output_device->set_surface_expansion_size(
48 surface_expansion_size); 48 surface_expansion_size);
49 output_surface = make_scoped_ptr( 49 output_surface = make_scoped_ptr(
50 new PixelTestOutputSurface(software_output_device.Pass())); 50 new PixelTestOutputSurface(
51 software_output_device.PassAs<SoftwareOutputDevice>()));
51 break; 52 break;
52 } 53 }
53 54
54 case GL_WITH_DEFAULT: 55 case GL_WITH_DEFAULT:
55 case GL_WITH_BITMAP: { 56 case GL_WITH_BITMAP: {
56 output_surface = make_scoped_ptr( 57 output_surface = make_scoped_ptr(
57 new PixelTestOutputSurface(new TestInProcessContextProvider)); 58 new PixelTestOutputSurface(new TestInProcessContextProvider));
58 break; 59 break;
59 } 60 }
60 } 61 }
61 62
62 output_surface->set_surface_expansion_size(surface_expansion_size); 63 output_surface->set_surface_expansion_size(surface_expansion_size);
63 return output_surface.Pass(); 64 return output_surface.PassAs<OutputSurface>();
64 } 65 }
65 66
66 void LayerTreePixelTest::CommitCompleteOnThread(LayerTreeHostImpl* impl) { 67 void LayerTreePixelTest::CommitCompleteOnThread(LayerTreeHostImpl* impl) {
67 LayerTreeImpl* commit_tree = 68 LayerTreeImpl* commit_tree =
68 impl->pending_tree() ? impl->pending_tree() : impl->active_tree(); 69 impl->pending_tree() ? impl->pending_tree() : impl->active_tree();
69 if (commit_tree->source_frame_number() != 0) 70 if (commit_tree->source_frame_number() != 0)
70 return; 71 return;
71 72
72 gfx::Rect viewport = impl->DeviceViewport(); 73 gfx::Rect viewport = impl->DeviceViewport();
73 // The viewport has a 0,0 origin without external influence. 74 // The viewport has a 0,0 origin without external influence.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 root->AddChild(content_root_); 222 root->AddChild(content_root_);
222 layer_tree_host()->SetRootLayer(root); 223 layer_tree_host()->SetRootLayer(root);
223 LayerTreeTest::SetupTree(); 224 LayerTreeTest::SetupTree();
224 } 225 }
225 226
226 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( 227 scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap(
227 const gfx::Size& size, 228 const gfx::Size& size,
228 const TextureMailbox& texture_mailbox) { 229 const TextureMailbox& texture_mailbox) {
229 DCHECK(texture_mailbox.IsTexture()); 230 DCHECK(texture_mailbox.IsTexture());
230 if (!texture_mailbox.IsTexture()) 231 if (!texture_mailbox.IsTexture())
231 return nullptr; 232 return scoped_ptr<SkBitmap>();
232 233
233 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext(); 234 scoped_ptr<gpu::GLInProcessContext> context = CreateTestInProcessContext();
234 GLES2Interface* gl = context->GetImplementation(); 235 GLES2Interface* gl = context->GetImplementation();
235 236
236 if (texture_mailbox.sync_point()) 237 if (texture_mailbox.sync_point())
237 gl->WaitSyncPointCHROMIUM(texture_mailbox.sync_point()); 238 gl->WaitSyncPointCHROMIUM(texture_mailbox.sync_point());
238 239
239 GLuint texture_id = 0; 240 GLuint texture_id = 0;
240 gl->GenTextures(1, &texture_id); 241 gl->GenTextures(1, &texture_id);
241 gl->BindTexture(GL_TEXTURE_2D, texture_id); 242 gl->BindTexture(GL_TEXTURE_2D, texture_id);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 362
362 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); 363 *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point);
363 *release_callback = SingleReleaseCallback::Create( 364 *release_callback = SingleReleaseCallback::Create(
364 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, 365 base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox,
365 base::Unretained(this), 366 base::Unretained(this),
366 base::Passed(&context), 367 base::Passed(&context),
367 texture_id)); 368 texture_id));
368 } 369 }
369 370
370 } // namespace cc 371 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_test_common.cc ('k') | cc/test/layer_tree_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698