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

Unified Diff: cc/output/software_renderer.cc

Issue 17335011: cc: Allow output readback/copy requests to specify a sub-rect to copy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copy-subrect: 3 patches in one Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/test/layer_tree_pixel_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/software_renderer.cc
diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc
index 1082086f721cec28706b8ef45bbf6cfe684aa911..2fefebc8d24ea8b6f28de46b154fc7c624f801c5 100644
--- a/cc/output/software_renderer.cc
+++ b/cc/output/software_renderer.cc
@@ -452,12 +452,20 @@ void SoftwareRenderer::DrawUnsupportedQuad(const DrawingFrame* frame,
void SoftwareRenderer::CopyCurrentRenderPassToBitmap(
DrawingFrame* frame,
scoped_ptr<CopyOutputRequest> request) {
+ gfx::Rect copy_rect = frame->current_render_pass->output_rect;
+ if (request->has_area()) {
+ // Intersect with the request's area, positioned with its origin at the
+ // origin of the full copy_rect.
+ copy_rect.Intersect(request->area() - copy_rect.OffsetFromOrigin());
+ }
+ gfx::Rect window_copy_rect = MoveFromDrawToWindowSpace(copy_rect);
+
scoped_ptr<SkBitmap> bitmap(new SkBitmap);
bitmap->setConfig(SkBitmap::kARGB_8888_Config,
- current_viewport_rect_.width(),
- current_viewport_rect_.height());
+ window_copy_rect.width(),
+ window_copy_rect.height());
current_canvas_->readPixels(
- bitmap.get(), current_viewport_rect_.x(), current_viewport_rect_.y());
+ bitmap.get(), window_copy_rect.x(), window_copy_rect.y());
request->SendBitmapResult(bitmap.Pass());
}
« no previous file with comments | « cc/output/gl_renderer.cc ('k') | cc/test/layer_tree_pixel_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698