#include "cc/base/math_util.h"
#include "cc/output/copy_output_request.h"
#include "cc/quads/draw_quad.h"
-#include "cc/resources/raster_worker_pool.h"
-#include "ui/gfx/rect_conversions.h"
+#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/transform.h"
static gfx::Transform OrthoProjectionMatrix(float left,
DirectRenderer::~DirectRenderer() {}
-bool DirectRenderer::CanReadPixels() const { return true; }
-
void DirectRenderer::SetEnlargePassTextureAmountForTesting(
const gfx::Vector2d& amount) {
enlarge_pass_texture_amount_ = amount;
if (!resource_provider_)
return;
- base::hash_map<RenderPass::Id, gfx::Size> render_passes_in_frame;
+ base::hash_map<RenderPassId, gfx::Size> render_passes_in_frame;
for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i)
- render_passes_in_frame.insert(std::pair<RenderPass::Id, gfx::Size>(
+ render_passes_in_frame.insert(std::pair<RenderPassId, gfx::Size>(
render_passes_in_draw_order[i]->id,
RenderPassTextureSize(render_passes_in_draw_order[i])));
- std::vector<RenderPass::Id> passes_to_delete;
- base::ScopedPtrHashMap<RenderPass::Id, ScopedResource>::const_iterator
+ std::vector<RenderPassId> passes_to_delete;
+ base::ScopedPtrHashMap<RenderPassId, ScopedResource>::const_iterator
pass_iter;
for (pass_iter = render_pass_textures_.begin();
pass_iter != render_pass_textures_.end();
++pass_iter) {
- base::hash_map<RenderPass::Id, gfx::Size>::const_iterator it =
+ base::hash_map<RenderPassId, gfx::Size>::const_iterator it =
render_passes_in_frame.find(pass_iter->first);
if (it == render_passes_in_frame.end()) {
passes_to_delete.push_back(pass_iter->first);
DCHECK(root_render_pass);
DrawingFrame frame;
+ frame.render_passes_in_draw_order = render_passes_in_draw_order;
frame.root_render_pass = root_render_pass;
frame.root_damage_rect = Capabilities().using_partial_swap
? root_render_pass->damage_rect
for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin();
it != quad_list.BackToFrontEnd();
++it) {
- const DrawQuad& quad = *(*it);
+ const DrawQuad& quad = *it;
bool should_skip_quad = false;
if (using_scissor_as_optimization) {
}
if (!should_skip_quad)
- DoDrawQuad(frame, *it);
+ DoDrawQuad(frame, &quad);
}
FinishDrawingQuadList();
}
enlarge_pass_texture_amount_.y());
if (!texture->id())
texture->Allocate(
- size, ResourceProvider::TextureUsageFramebuffer, RGBA_8888);
+ size, ResourceProvider::TextureHintImmutableFramebuffer, RGBA_8888);
DCHECK(texture->id());
return BindFramebufferToTexture(frame, texture, render_pass->output_rect);
}
-void DirectRenderer::RunOnDemandRasterTask(Task* on_demand_raster_task) {
- TaskGraphRunner* task_graph_runner = RasterWorkerPool::GetTaskGraphRunner();
- DCHECK(task_graph_runner);
-
- // Make sure we have a unique task namespace token.
- if (!on_demand_task_namespace_.IsValid())
- on_demand_task_namespace_ = task_graph_runner->GetNamespaceToken();
-
- // Construct a task graph that contains this single raster task.
- TaskGraph graph;
- graph.nodes.push_back(
- TaskGraph::Node(on_demand_raster_task,
- RasterWorkerPool::kOnDemandRasterTaskPriority,
- 0u));
-
- // Schedule task and wait for task graph runner to finish running it.
- task_graph_runner->ScheduleTasks(on_demand_task_namespace_, &graph);
- task_graph_runner->WaitForTasksToFinishRunning(on_demand_task_namespace_);
-
- // Collect task now that it has finished running.
- Task::Vector completed_tasks;
- task_graph_runner->CollectCompletedTasks(on_demand_task_namespace_,
- &completed_tasks);
- DCHECK_EQ(1u, completed_tasks.size());
- DCHECK_EQ(completed_tasks[0], on_demand_raster_task);
-}
-
-bool DirectRenderer::HasAllocatedResourcesForTesting(RenderPass::Id id)
- const {
+bool DirectRenderer::HasAllocatedResourcesForTesting(RenderPassId id) const {
ScopedResource* texture = render_pass_textures_.get(id);
return texture && texture->id();
}