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

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

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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/direct_renderer.h ('k') | cc/output/filter_operation.h » ('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/direct_renderer.h" 5 #include "cc/output/direct_renderer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <utility> 10 #include <utility>
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 texture->Free(); 174 texture->Free();
175 } 175 }
176 176
177 // Delete RenderPass textures from the previous frame that will not be used 177 // Delete RenderPass textures from the previous frame that will not be used
178 // again. 178 // again.
179 for (size_t i = 0; i < passes_to_delete.size(); ++i) 179 for (size_t i = 0; i < passes_to_delete.size(); ++i)
180 render_pass_textures_.erase(passes_to_delete[i]); 180 render_pass_textures_.erase(passes_to_delete[i]);
181 181
182 for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) { 182 for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) {
183 if (render_pass_textures_.count(render_passes_in_draw_order[i]->id) == 0) { 183 if (render_pass_textures_.count(render_passes_in_draw_order[i]->id) == 0) {
184 scoped_ptr<ScopedResource> texture = 184 std::unique_ptr<ScopedResource> texture =
185 ScopedResource::Create(resource_provider_); 185 ScopedResource::Create(resource_provider_);
186 render_pass_textures_[render_passes_in_draw_order[i]->id] = 186 render_pass_textures_[render_passes_in_draw_order[i]->id] =
187 std::move(texture); 187 std::move(texture);
188 } 188 }
189 } 189 }
190 } 190 }
191 191
192 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, 192 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order,
193 float device_scale_factor, 193 float device_scale_factor,
194 const gfx::Rect& device_viewport_rect, 194 const gfx::Rect& device_viewport_rect,
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 390 }
391 391
392 std::vector<gfx::QuadF> quads; 392 std::vector<gfx::QuadF> quads;
393 poly.ToQuads2D(&quads); 393 poly.ToQuads2D(&quads);
394 for (size_t i = 0; i < quads.size(); ++i) { 394 for (size_t i = 0; i < quads.size(); ++i) {
395 DoDrawQuad(frame, poly.original_ref(), &quads[i]); 395 DoDrawQuad(frame, poly.original_ref(), &quads[i]);
396 } 396 }
397 } 397 }
398 398
399 void DirectRenderer::FlushPolygons( 399 void DirectRenderer::FlushPolygons(
400 std::deque<scoped_ptr<DrawPolygon>>* poly_list, 400 std::deque<std::unique_ptr<DrawPolygon>>* poly_list,
401 DrawingFrame* frame, 401 DrawingFrame* frame,
402 const gfx::Rect& render_pass_scissor, 402 const gfx::Rect& render_pass_scissor,
403 bool use_render_pass_scissor) { 403 bool use_render_pass_scissor) {
404 if (poly_list->empty()) { 404 if (poly_list->empty()) {
405 return; 405 return;
406 } 406 }
407 407
408 BspTree bsp_tree(poly_list); 408 BspTree bsp_tree(poly_list);
409 BspWalkActionDrawPolygon action_handler(this, frame, render_pass_scissor, 409 BspWalkActionDrawPolygon action_handler(this, frame, render_pass_scissor,
410 use_render_pass_scissor); 410 use_render_pass_scissor);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 mode = SURFACE_INITIALIZATION_MODE_FULL_SURFACE_CLEAR; 475 mode = SURFACE_INITIALIZATION_MODE_FULL_SURFACE_CLEAR;
476 } else { 476 } else {
477 mode = SURFACE_INITIALIZATION_MODE_PRESERVE; 477 mode = SURFACE_INITIALIZATION_MODE_PRESERVE;
478 } 478 }
479 479
480 PrepareSurfaceForPass( 480 PrepareSurfaceForPass(
481 frame, mode, 481 frame, mode,
482 MoveFromDrawToWindowSpace(frame, render_pass_scissor_in_draw_space)); 482 MoveFromDrawToWindowSpace(frame, render_pass_scissor_in_draw_space));
483 483
484 const QuadList& quad_list = render_pass->quad_list; 484 const QuadList& quad_list = render_pass->quad_list;
485 std::deque<scoped_ptr<DrawPolygon>> poly_list; 485 std::deque<std::unique_ptr<DrawPolygon>> poly_list;
486 486
487 int next_polygon_id = 0; 487 int next_polygon_id = 0;
488 int last_sorting_context_id = 0; 488 int last_sorting_context_id = 0;
489 for (auto it = quad_list.BackToFrontBegin(); it != quad_list.BackToFrontEnd(); 489 for (auto it = quad_list.BackToFrontBegin(); it != quad_list.BackToFrontEnd();
490 ++it) { 490 ++it) {
491 const DrawQuad& quad = **it; 491 const DrawQuad& quad = **it;
492 492
493 if (render_pass_is_clipped && 493 if (render_pass_is_clipped &&
494 ShouldSkipQuad(quad, render_pass_scissor_in_draw_space)) { 494 ShouldSkipQuad(quad, render_pass_scissor_in_draw_space)) {
495 continue; 495 continue;
496 } 496 }
497 497
498 if (last_sorting_context_id != quad.shared_quad_state->sorting_context_id) { 498 if (last_sorting_context_id != quad.shared_quad_state->sorting_context_id) {
499 last_sorting_context_id = quad.shared_quad_state->sorting_context_id; 499 last_sorting_context_id = quad.shared_quad_state->sorting_context_id;
500 FlushPolygons(&poly_list, frame, render_pass_scissor_in_draw_space, 500 FlushPolygons(&poly_list, frame, render_pass_scissor_in_draw_space,
501 render_pass_is_clipped); 501 render_pass_is_clipped);
502 } 502 }
503 503
504 // This layer is in a 3D sorting context so we add it to the list of 504 // This layer is in a 3D sorting context so we add it to the list of
505 // polygons to go into the BSP tree. 505 // polygons to go into the BSP tree.
506 if (quad.shared_quad_state->sorting_context_id != 0) { 506 if (quad.shared_quad_state->sorting_context_id != 0) {
507 scoped_ptr<DrawPolygon> new_polygon(new DrawPolygon( 507 std::unique_ptr<DrawPolygon> new_polygon(new DrawPolygon(
508 *it, gfx::RectF(quad.visible_rect), 508 *it, gfx::RectF(quad.visible_rect),
509 quad.shared_quad_state->quad_to_target_transform, next_polygon_id++)); 509 quad.shared_quad_state->quad_to_target_transform, next_polygon_id++));
510 if (new_polygon->points().size() > 2u) { 510 if (new_polygon->points().size() > 2u) {
511 poly_list.push_back(std::move(new_polygon)); 511 poly_list.push_back(std::move(new_polygon));
512 } 512 }
513 continue; 513 continue;
514 } 514 }
515 515
516 // We are not in a 3d sorting context, so we should draw the quad normally. 516 // We are not in a 3d sorting context, so we should draw the quad normally.
517 SetScissorStateForQuad(frame, quad, render_pass_scissor_in_draw_space, 517 SetScissorStateForQuad(frame, quad, render_pass_scissor_in_draw_space,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 auto iter = render_pass_textures_.find(id); 564 auto iter = render_pass_textures_.find(id);
565 return iter != render_pass_textures_.end() && iter->second->id(); 565 return iter != render_pass_textures_.end() && iter->second->id();
566 } 566 }
567 567
568 // static 568 // static
569 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 569 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
570 return render_pass->output_rect.size(); 570 return render_pass->output_rect.size();
571 } 571 }
572 572
573 } // namespace cc 573 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/filter_operation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698