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

Side by Side Diff: cc/output/software_renderer_unittest.cc

Issue 609663003: cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cc-passas: PassAs-presubmit-warning 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/output/software_renderer.cc ('k') | cc/quads/draw_polygon.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/output/software_renderer.h" 5 #include "cc/output/software_renderer.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "cc/output/compositor_frame_metadata.h" 8 #include "cc/output/compositor_frame_metadata.h"
9 #include "cc/output/copy_output_request.h" 9 #include "cc/output/copy_output_request.h"
10 #include "cc/output/copy_output_result.h" 10 #include "cc/output/copy_output_result.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 root_render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); 121 root_render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
122 inner_quad->SetNew( 122 inner_quad->SetNew(
123 shared_quad_state, inner_rect, inner_rect, SK_ColorCYAN, false); 123 shared_quad_state, inner_rect, inner_rect, SK_ColorCYAN, false);
124 inner_quad->visible_rect = visible_rect; 124 inner_quad->visible_rect = visible_rect;
125 SolidColorDrawQuad* outer_quad = 125 SolidColorDrawQuad* outer_quad =
126 root_render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); 126 root_render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
127 outer_quad->SetNew( 127 outer_quad->SetNew(
128 shared_quad_state, outer_rect, outer_rect, SK_ColorYELLOW, false); 128 shared_quad_state, outer_rect, outer_rect, SK_ColorYELLOW, false);
129 129
130 RenderPassList list; 130 RenderPassList list;
131 list.push_back(root_render_pass.PassAs<RenderPass>()); 131 list.push_back(root_render_pass.Pass());
132 132
133 float device_scale_factor = 1.f; 133 float device_scale_factor = 1.f;
134 gfx::Rect device_viewport_rect(outer_size); 134 gfx::Rect device_viewport_rect(outer_size);
135 scoped_ptr<SkBitmap> output = 135 scoped_ptr<SkBitmap> output =
136 DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect); 136 DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect);
137 EXPECT_EQ(outer_rect.width(), output->info().fWidth); 137 EXPECT_EQ(outer_rect.width(), output->info().fWidth);
138 EXPECT_EQ(outer_rect.width(), output->info().fHeight); 138 EXPECT_EQ(outer_rect.width(), output->info().fHeight);
139 139
140 EXPECT_EQ(SK_ColorYELLOW, output->getColor(0, 0)); 140 EXPECT_EQ(SK_ColorYELLOW, output->getColor(0, 0));
141 EXPECT_EQ(SK_ColorYELLOW, 141 EXPECT_EQ(SK_ColorYELLOW,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 outer_quad->SetNew(shared_quad_state, 217 outer_quad->SetNew(shared_quad_state,
218 outer_rect, 218 outer_rect,
219 outer_rect, 219 outer_rect,
220 outer_rect, 220 outer_rect,
221 resource_yellow, 221 resource_yellow,
222 gfx::RectF(outer_size), 222 gfx::RectF(outer_size),
223 outer_size, 223 outer_size,
224 false); 224 false);
225 225
226 RenderPassList list; 226 RenderPassList list;
227 list.push_back(root_render_pass.PassAs<RenderPass>()); 227 list.push_back(root_render_pass.Pass());
228 228
229 float device_scale_factor = 1.f; 229 float device_scale_factor = 1.f;
230 gfx::Rect device_viewport_rect(outer_size); 230 gfx::Rect device_viewport_rect(outer_size);
231 scoped_ptr<SkBitmap> output = 231 scoped_ptr<SkBitmap> output =
232 DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect); 232 DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect);
233 EXPECT_EQ(outer_rect.width(), output->info().fWidth); 233 EXPECT_EQ(outer_rect.width(), output->info().fWidth);
234 EXPECT_EQ(outer_rect.width(), output->info().fHeight); 234 EXPECT_EQ(outer_rect.width(), output->info().fHeight);
235 235
236 EXPECT_EQ(SK_ColorYELLOW, output->getColor(0, 0)); 236 EXPECT_EQ(SK_ColorYELLOW, output->getColor(0, 0));
237 EXPECT_EQ(SK_ColorYELLOW, 237 EXPECT_EQ(SK_ColorYELLOW,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 tile_rect, 291 tile_rect,
292 tile_rect, 292 tile_rect,
293 tile_rect, 293 tile_rect,
294 resource_cyan, 294 resource_cyan,
295 gfx::RectF(tile_size), 295 gfx::RectF(tile_size),
296 tile_size, 296 tile_size,
297 false); 297 false);
298 quad->visible_rect = visible_rect; 298 quad->visible_rect = visible_rect;
299 299
300 RenderPassList list; 300 RenderPassList list;
301 list.push_back(root_render_pass.PassAs<RenderPass>()); 301 list.push_back(root_render_pass.Pass());
302 302
303 float device_scale_factor = 1.f; 303 float device_scale_factor = 1.f;
304 gfx::Rect device_viewport_rect(tile_size); 304 gfx::Rect device_viewport_rect(tile_size);
305 scoped_ptr<SkBitmap> output = 305 scoped_ptr<SkBitmap> output =
306 DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect); 306 DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect);
307 EXPECT_EQ(tile_rect.width(), output->info().fWidth); 307 EXPECT_EQ(tile_rect.width(), output->info().fWidth);
308 EXPECT_EQ(tile_rect.width(), output->info().fHeight); 308 EXPECT_EQ(tile_rect.width(), output->info().fHeight);
309 309
310 // Check portion of tile not in visible rect isn't drawn. 310 // Check portion of tile not in visible rect isn't drawn.
311 const unsigned int kTransparent = SK_ColorTRANSPARENT; 311 const unsigned int kTransparent = SK_ColorTRANSPARENT;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 EXPECT_EQ( 431 EXPECT_EQ(
432 SK_ColorMAGENTA, 432 SK_ColorMAGENTA,
433 output->getColor(interior_visible_rect.x(), interior_visible_rect.y())); 433 output->getColor(interior_visible_rect.x(), interior_visible_rect.y()));
434 EXPECT_EQ(SK_ColorMAGENTA, 434 EXPECT_EQ(SK_ColorMAGENTA,
435 output->getColor(interior_visible_rect.right() - 1, 435 output->getColor(interior_visible_rect.right() - 1,
436 interior_visible_rect.bottom() - 1)); 436 interior_visible_rect.bottom() - 1));
437 } 437 }
438 438
439 } // namespace 439 } // namespace
440 } // namespace cc 440 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/software_renderer.cc ('k') | cc/quads/draw_polygon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698