| OLD | NEW |
| 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" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Delete RenderPass textures from the previous frame that will not be used | 176 // Delete RenderPass textures from the previous frame that will not be used |
| 177 // again. | 177 // again. |
| 178 for (size_t i = 0; i < passes_to_delete.size(); ++i) | 178 for (size_t i = 0; i < passes_to_delete.size(); ++i) |
| 179 render_pass_textures_.erase(passes_to_delete[i]); | 179 render_pass_textures_.erase(passes_to_delete[i]); |
| 180 | 180 |
| 181 for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) { | 181 for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) { |
| 182 if (!render_pass_textures_.contains(render_passes_in_draw_order[i]->id)) { | 182 if (!render_pass_textures_.contains(render_passes_in_draw_order[i]->id)) { |
| 183 scoped_ptr<ScopedResource> texture = | 183 scoped_ptr<ScopedResource> texture = |
| 184 ScopedResource::Create(resource_provider_); | 184 ScopedResource::Create(resource_provider_); |
| 185 render_pass_textures_.set(render_passes_in_draw_order[i]->id, | 185 render_pass_textures_.set(render_passes_in_draw_order[i]->id, |
| 186 texture.Pass()); | 186 std::move(texture)); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, | 191 void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, |
| 192 float device_scale_factor, | 192 float device_scale_factor, |
| 193 const gfx::Rect& device_viewport_rect, | 193 const gfx::Rect& device_viewport_rect, |
| 194 const gfx::Rect& device_clip_rect, | 194 const gfx::Rect& device_clip_rect, |
| 195 bool disable_picture_quad_image_filtering) { | 195 bool disable_picture_quad_image_filtering) { |
| 196 TRACE_EVENT0("cc", "DirectRenderer::DrawFrame"); | 196 TRACE_EVENT0("cc", "DirectRenderer::DrawFrame"); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 render_pass_is_clipped); | 505 render_pass_is_clipped); |
| 506 } | 506 } |
| 507 | 507 |
| 508 // This layer is in a 3D sorting context so we add it to the list of | 508 // This layer is in a 3D sorting context so we add it to the list of |
| 509 // polygons to go into the BSP tree. | 509 // polygons to go into the BSP tree. |
| 510 if (quad.shared_quad_state->sorting_context_id != 0) { | 510 if (quad.shared_quad_state->sorting_context_id != 0) { |
| 511 scoped_ptr<DrawPolygon> new_polygon(new DrawPolygon( | 511 scoped_ptr<DrawPolygon> new_polygon(new DrawPolygon( |
| 512 *it, gfx::RectF(quad.visible_rect), | 512 *it, gfx::RectF(quad.visible_rect), |
| 513 quad.shared_quad_state->quad_to_target_transform, next_polygon_id++)); | 513 quad.shared_quad_state->quad_to_target_transform, next_polygon_id++)); |
| 514 if (new_polygon->points().size() > 2u) { | 514 if (new_polygon->points().size() > 2u) { |
| 515 poly_list.push_back(new_polygon.Pass()); | 515 poly_list.push_back(std::move(new_polygon)); |
| 516 } | 516 } |
| 517 continue; | 517 continue; |
| 518 } | 518 } |
| 519 | 519 |
| 520 // We are not in a 3d sorting context, so we should draw the quad normally. | 520 // We are not in a 3d sorting context, so we should draw the quad normally. |
| 521 SetScissorStateForQuad(frame, quad, render_pass_scissor_in_draw_space, | 521 SetScissorStateForQuad(frame, quad, render_pass_scissor_in_draw_space, |
| 522 render_pass_is_clipped); | 522 render_pass_is_clipped); |
| 523 | 523 |
| 524 DoDrawQuad(frame, &quad, nullptr); | 524 DoDrawQuad(frame, &quad, nullptr); |
| 525 } | 525 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 ScopedResource* texture = render_pass_textures_.get(id); | 568 ScopedResource* texture = render_pass_textures_.get(id); |
| 569 return texture && texture->id(); | 569 return texture && texture->id(); |
| 570 } | 570 } |
| 571 | 571 |
| 572 // static | 572 // static |
| 573 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 573 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
| 574 return render_pass->output_rect.size(); | 574 return render_pass->output_rect.size(); |
| 575 } | 575 } |
| 576 | 576 |
| 577 } // namespace cc | 577 } // namespace cc |
| OLD | NEW |