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" |
| 11 #include "base/hash_tables.h" |
11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
12 #include "cc/base/math_util.h" | 13 #include "cc/base/math_util.h" |
13 #include "cc/quads/draw_quad.h" | 14 #include "cc/quads/draw_quad.h" |
14 #include "ui/gfx/rect_conversions.h" | 15 #include "ui/gfx/rect_conversions.h" |
15 #include "ui/gfx/transform.h" | 16 #include "ui/gfx/transform.h" |
16 | 17 |
17 static gfx::Transform OrthoProjectionMatrix(float left, | 18 static gfx::Transform OrthoProjectionMatrix(float left, |
18 float right, | 19 float right, |
19 float bottom, | 20 float bottom, |
20 float top) { | 21 float top) { |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); | 186 const RenderPass* root_render_pass = render_passes_in_draw_order->back(); |
186 DCHECK(root_render_pass); | 187 DCHECK(root_render_pass); |
187 | 188 |
188 DrawingFrame frame; | 189 DrawingFrame frame; |
189 frame.root_render_pass = root_render_pass; | 190 frame.root_render_pass = root_render_pass; |
190 frame.root_damage_rect = | 191 frame.root_damage_rect = |
191 Capabilities().using_partial_swap && client_->AllowPartialSwap() ? | 192 Capabilities().using_partial_swap && client_->AllowPartialSwap() ? |
192 root_render_pass->damage_rect : root_render_pass->output_rect; | 193 root_render_pass->damage_rect : root_render_pass->output_rect; |
193 frame.root_damage_rect.Intersect(gfx::Rect(ViewportSize())); | 194 frame.root_damage_rect.Intersect(gfx::Rect(ViewportSize())); |
194 | 195 |
| 196 std::vector<base::Closure> copy_callbacks; |
| 197 |
195 BeginDrawingFrame(&frame); | 198 BeginDrawingFrame(&frame); |
196 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) | 199 for (size_t i = 0; i < render_passes_in_draw_order->size(); ++i) { |
197 DrawRenderPass(&frame, render_passes_in_draw_order->at(i)); | 200 DrawRenderPass(&frame, render_passes_in_draw_order->at(i)); |
| 201 |
| 202 const RenderPass* pass = frame.current_render_pass; |
| 203 for (size_t i = 0; i < pass->copy_callbacks.size(); ++i) { |
| 204 scoped_ptr<SkBitmap> bitmap(new SkBitmap); |
| 205 CopyCurrentRenderPassToBitmap(&frame, bitmap.get()); |
| 206 pass->copy_callbacks[i].Run(bitmap.Pass()); |
| 207 } |
| 208 } |
198 FinishDrawingFrame(&frame); | 209 FinishDrawingFrame(&frame); |
199 | 210 |
200 render_passes_in_draw_order->clear(); | 211 render_passes_in_draw_order->clear(); |
201 } | 212 } |
202 | 213 |
203 gfx::RectF DirectRenderer::ComputeScissorRectForRenderPass( | 214 gfx::RectF DirectRenderer::ComputeScissorRectForRenderPass( |
204 const DrawingFrame* frame) { | 215 const DrawingFrame* frame) { |
205 gfx::RectF render_pass_scissor = frame->current_render_pass->output_rect; | 216 gfx::RectF render_pass_scissor = frame->current_render_pass->output_rect; |
206 | 217 |
207 if (frame->root_damage_rect == frame->root_render_pass->output_rect) | 218 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) { | 350 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { |
340 return render_pass->output_rect.size(); | 351 return render_pass->output_rect.size(); |
341 } | 352 } |
342 | 353 |
343 // static | 354 // static |
344 GLenum DirectRenderer::RenderPassTextureFormat(const RenderPass* render_pass) { | 355 GLenum DirectRenderer::RenderPassTextureFormat(const RenderPass* render_pass) { |
345 return GL_RGBA; | 356 return GL_RGBA; |
346 } | 357 } |
347 | 358 |
348 } // namespace cc | 359 } // namespace cc |
OLD | NEW |