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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); | 186 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); |
187 DCHECK(root_render_pass); | 187 DCHECK(root_render_pass); |
188 | 188 |
189 DrawingFrame frame; | 189 DrawingFrame frame; |
190 frame.root_render_pass = root_render_pass; | 190 frame.root_render_pass = root_render_pass; |
191 frame.root_damage_rect = | 191 frame.root_damage_rect = |
192 Capabilities().using_partial_swap && client_->AllowPartialSwap() ? | 192 Capabilities().using_partial_swap && client_->AllowPartialSwap() ? |
193 root_render_pass->damage_rect : root_render_pass->output_rect; | 193 root_render_pass->damage_rect : root_render_pass->output_rect; |
194 frame.root_damage_rect.Intersect(gfx::Rect(ViewportSize())); | 194 frame.root_damage_rect.Intersect(gfx::Rect(ViewportSize())); |
195 | 195 |
196 std::vector<base::Closure> copy_callbacks; | |
197 | |
198 BeginDrawingFrame(&frame); | 196 BeginDrawingFrame(&frame); |
199 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { | 197 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { |
200 DrawRenderPass(&frame, render_passes_in_draw_order->at(i)); | 198 DrawRenderPass(&frame, render_passes_in_draw_order->at(i)); |
201 | 199 |
202 const RenderPass* pass = frame.current_render_pass; | 200 const RenderPass* pass = frame.current_render_pass; |
203 for (size_t i = 0; i < pass->copy_callbacks.size(); ++i) { | 201 for (size_t i = 0; i < pass->copy_callbacks.size(); ++i) |
204 scoped_ptr<SkBitmap> bitmap(new SkBitmap); | 202 CopyCurrentRenderPassToBitmap(&frame, pass->copy_callbacks[i]); |
205 CopyCurrentRenderPassToBitmap(&frame, bitmap.get()); | |
206 pass->copy_callbacks[i].Run(bitmap.Pass()); | |
207 } | |
208 } | 203 } |
209 FinishDrawingFrame(&frame); | 204 FinishDrawingFrame(&frame); |
210 | 205 |
211 render_passes_in_draw_order->clear(); | 206 render_passes_in_draw_order->clear(); |
212 } | 207 } |
213 | 208 |
214 gfx::RectF DirectRenderer::ComputeScissorRectForRenderPass( | 209 gfx::RectF DirectRenderer::ComputeScissorRectForRenderPass( |
215 const DrawingFrame* frame) { | 210 const DrawingFrame* frame) { |
216 gfx::RectF render_pass_scissor = frame->current_render_pass->output_rect; | 211 gfx::RectF render_pass_scissor = frame->current_render_pass->output_rect; |
217 | 212 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { | 345 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
351 return render_pass->output_rect.size(); | 346 return render_pass->output_rect.size(); |
352 } | 347 } |
353 | 348 |
354 // static | 349 // static |
355 GLenum DirectRenderer::RenderPassTextureFormat(const RenderPass* render_pass) { | 350 GLenum DirectRenderer::RenderPassTextureFormat(const RenderPass* render_pass) { |
356 return GL_RGBA; | 351 return GL_RGBA; |
357 } | 352 } |
358 | 353 |
359 } // namespace cc | 354 } // namespace cc |
OLD | NEW |