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

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

Issue 160023002: cc: Only make num_threads - 1 SkPicture clones. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sw renderer too Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.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/direct_renderer.h" 5 #include "cc/output/direct_renderer.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/containers/scoped_ptr_hash_map.h" 11 #include "base/containers/scoped_ptr_hash_map.h"
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
14 #include "cc/base/math_util.h" 14 #include "cc/base/math_util.h"
15 #include "cc/output/copy_output_request.h" 15 #include "cc/output/copy_output_request.h"
16 #include "cc/quads/draw_quad.h" 16 #include "cc/quads/draw_quad.h"
17 #include "cc/resources/raster_worker_pool.h"
17 #include "ui/gfx/rect_conversions.h" 18 #include "ui/gfx/rect_conversions.h"
18 #include "ui/gfx/transform.h" 19 #include "ui/gfx/transform.h"
19 20
20 static gfx::Transform OrthoProjectionMatrix(float left, 21 static gfx::Transform OrthoProjectionMatrix(float left,
21 float right, 22 float right,
22 float bottom, 23 float bottom,
23 float top) { 24 float top) {
24 // Use the standard formula to map the clipping frustum to the cube from 25 // Use the standard formula to map the clipping frustum to the cube from
25 // [-1, -1, -1] to [1, 1, 1]. 26 // [-1, -1, -1] to [1, 1, 1].
26 float delta_x = right - left; 27 float delta_x = right - left;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 size.Enlarge(enlarge_pass_texture_amount_.x(), 411 size.Enlarge(enlarge_pass_texture_amount_.x(),
411 enlarge_pass_texture_amount_.y()); 412 enlarge_pass_texture_amount_.y());
412 if (!texture->id()) 413 if (!texture->id())
413 texture->Allocate( 414 texture->Allocate(
414 size, ResourceProvider::TextureUsageFramebuffer, RGBA_8888); 415 size, ResourceProvider::TextureUsageFramebuffer, RGBA_8888);
415 DCHECK(texture->id()); 416 DCHECK(texture->id());
416 417
417 return BindFramebufferToTexture(frame, texture, render_pass->output_rect); 418 return BindFramebufferToTexture(frame, texture, render_pass->output_rect);
418 } 419 }
419 420
421 void DirectRenderer::RunOnDemandRasterTask(
422 internal::Task* on_demand_raster_task) {
423 internal::TaskGraphRunner* task_graph_runner =
424 RasterWorkerPool::GetTaskGraphRunner();
425 DCHECK(task_graph_runner);
426
427 // Make sure we have a unique task namespace token.
428 if (!on_demand_task_namespace_.IsValid())
429 on_demand_task_namespace_ = task_graph_runner->GetNamespaceToken();
430
431 // Construct a task graph that contains this single raster task.
432 internal::TaskGraph graph;
433 graph.nodes.push_back(
434 internal::TaskGraph::Node(on_demand_raster_task,
435 RasterWorkerPool::kOnDemandRasterTaskPriority,
436 0u));
437
438 // Schedule task and wait for task graph runner to finish running it.
439 task_graph_runner->SetTaskGraph(on_demand_task_namespace_, &graph);
440 task_graph_runner->WaitForTasksToFinishRunning(on_demand_task_namespace_);
441
442 // Collect task now that it has finished running.
443 internal::Task::Vector completed_tasks;
444 task_graph_runner->CollectCompletedTasks(on_demand_task_namespace_,
445 &completed_tasks);
446 DCHECK_EQ(1u, completed_tasks.size());
447 DCHECK_EQ(completed_tasks[0], on_demand_raster_task);
448 }
449
420 bool DirectRenderer::HasAllocatedResourcesForTesting(RenderPass::Id id) 450 bool DirectRenderer::HasAllocatedResourcesForTesting(RenderPass::Id id)
421 const { 451 const {
422 ScopedResource* texture = render_pass_textures_.get(id); 452 ScopedResource* texture = render_pass_textures_.get(id);
423 return texture && texture->id(); 453 return texture && texture->id();
424 } 454 }
425 455
426 // static 456 // static
427 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 457 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
428 return render_pass->output_rect.size(); 458 return render_pass->output_rect.size();
429 } 459 }
430 460
431 } // namespace cc 461 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698