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