Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: cc/output/direct_renderer.cc

Issue 14060015: cc: Async readback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.h » ('j') | cc/output/gl_renderer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698