From d4d017e13286b6d328dd5a62d324149b863189ad Mon Sep 17 00:00:00 2001 From: "danakj@chromium.org" Date: Thu, 20 Jun 2013 21:46:11 +0000 Subject: cc: Allow output readback/copy requests to specify a sub-rect to copy. The CopyOutputRequest API is on cc::Layer, so the rect it is given should be in layer space. Also add tests for CompositeAndReadback which no longer had any pixel test coverage in cc/ to ensure that its inputs are correctly applied as device viewport space. Clean up the layer tree pixel test framework by passing the test type (GL/Software cross Bitmap/Texture) as a parameter to RunPixelTest() instead of having tests set a pair of bools. Forces all tests to specify the test type. Tests: LayerTreeHostReadbackPixelTest.ReadbackSubrect_Software LayerTreeHostReadbackPixelTest.ReadbackSubrect_GL_Bitmap LayerTreeHostReadbackPixelTest.ReadbackSubrect_GL LayerTreeHostReadbackPixelTest.ReadbackNonRootLayerSubrect_Software LayerTreeHostReadbackPixelTest.ReadbackNonRootLayerSubrect_GL_Bitmap LayerTreeHostReadbackPixelTest.ReadbackNonRootLayerSubrect_GL LayerTreeHostReadbackDeviceScalePixelTest.ReadbackSubrect_Software LayerTreeHostReadbackDeviceScalePixelTest.ReadbackSubrect_GL LayerTreeHostReadbackDeviceScalePixelTest.ReadbackNonRootLayerSubrect_Software LayerTreeHostReadbackDeviceScalePixelTest.ReadbackNonRootLayerSubrect_GL LayerTreeHostReadbackViaCompositeAndReadbackPixelTest.CompositeAndReadback_Software_1 LayerTreeHostReadbackViaCompositeAndReadbackPixelTest.CompositeAndReadback_Software_2 LayerTreeHostReadbackViaCompositeAndReadbackPixelTest.CompositeAndReadback_GL_1 LayerTreeHostReadbackViaCompositeAndReadbackPixelTest.CompositeAndReadback_GL_2 R=piman BUG=251754 Merged https://codereview.chromium.org/17449014/ and https://codereview.chromium.org/17261009/ into this CL. Review URL: https://chromiumcodereview.appspot.com/17335011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207589 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/output/gl_renderer.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'cc/output/gl_renderer.cc') diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 2a27ff7..3527ed1 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -1914,8 +1914,13 @@ void GLRenderer::EnsureScissorTestDisabled() { void GLRenderer::CopyCurrentRenderPassToBitmap( DrawingFrame* frame, scoped_ptr request) { - GetFramebufferPixelsAsync(frame->current_render_pass->output_rect, - request.Pass()); + 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()); + } + GetFramebufferPixelsAsync(copy_rect, request.Pass()); } void GLRenderer::ToGLMatrix(float* gl_matrix, const gfx::Transform& transform) { -- cgit v1.1