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

Unified Diff: cc/test/layer_tree_pixel_test.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/test/layer_tree_pixel_test.h ('k') | cc/test/solid_color_content_layer_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/layer_tree_pixel_test.cc
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc
index 3d757cab3d46b98e3beb8ab50de2806f3e047842..b948302cc4b07d7801f0b2184c93929ad151041c 100644
--- a/cc/test/layer_tree_pixel_test.cc
+++ b/cc/test/layer_tree_pixel_test.cc
@@ -21,7 +21,8 @@
namespace cc {
LayerTreePixelTest::LayerTreePixelTest()
- : pixel_comparator_(new ExactPixelComparator(true)), use_gl_(true) {}
+ : pixel_comparator_(new ExactPixelComparator(true)),
+ test_type_(GL_WITH_DEFAULT) {}
LayerTreePixelTest::~LayerTreePixelTest() {}
@@ -30,23 +31,32 @@ scoped_ptr<OutputSurface> LayerTreePixelTest::CreateOutputSurface() {
gfx::Size surface_expansion_size(40, 60);
scoped_ptr<PixelTestOutputSurface> output_surface;
- if (!use_gl_) {
- scoped_ptr<PixelTestSoftwareOutputDevice> software_output_device(
- new PixelTestSoftwareOutputDevice);
- software_output_device->set_surface_expansion_size(surface_expansion_size);
- output_surface = make_scoped_ptr(
- new PixelTestOutputSurface(
- software_output_device.PassAs<SoftwareOutputDevice>()));
- } else {
- CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL));
-
- using WebKit::WebGraphicsContext3D;
- using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
- scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d(
- WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
- WebGraphicsContext3D::Attributes()));
- output_surface = make_scoped_ptr(
- new PixelTestOutputSurface(context3d.PassAs<WebGraphicsContext3D>()));
+ switch (test_type_) {
+ case SOFTWARE_WITH_DEFAULT:
+ case SOFTWARE_WITH_BITMAP: {
+ scoped_ptr<PixelTestSoftwareOutputDevice> software_output_device(
+ new PixelTestSoftwareOutputDevice);
+ software_output_device->set_surface_expansion_size(
+ surface_expansion_size);
+ output_surface = make_scoped_ptr(
+ new PixelTestOutputSurface(
+ software_output_device.PassAs<SoftwareOutputDevice>()));
+ break;
+ }
+
+ case GL_WITH_DEFAULT:
+ case GL_WITH_BITMAP: {
+ CHECK(gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL));
+
+ using WebKit::WebGraphicsContext3D;
+ using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
+ scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d(
+ WebGraphicsContext3DInProcessCommandBufferImpl::
+ CreateOffscreenContext(WebGraphicsContext3D::Attributes()));
+ output_surface = make_scoped_ptr(
+ new PixelTestOutputSurface(context3d.PassAs<WebGraphicsContext3D>()));
+ break;
+ }
}
output_surface->set_viewport_offset(viewport_offset);
@@ -141,8 +151,10 @@ scoped_refptr<SolidColorLayer> LayerTreePixelTest::
}
void LayerTreePixelTest::RunPixelTest(
+ PixelTestType test_type,
scoped_refptr<Layer> content_root,
base::FilePath file_name) {
+ test_type_ = test_type;
content_root_ = content_root;
readback_target_ = NULL;
ref_file_ = file_name;
@@ -150,9 +162,11 @@ void LayerTreePixelTest::RunPixelTest(
}
void LayerTreePixelTest::RunPixelTestWithReadbackTarget(
+ PixelTestType test_type,
scoped_refptr<Layer> content_root,
Layer* target,
base::FilePath file_name) {
+ test_type_ = test_type;
content_root_ = content_root;
readback_target_ = target;
ref_file_ = file_name;
« no previous file with comments | « cc/test/layer_tree_pixel_test.h ('k') | cc/test/solid_color_content_layer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698