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

Unified Diff: cc/test/pixel_test.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 side-by-side diff with in-line comments
Download patch
Index: cc/test/pixel_test.cc
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc
index 8563440aa789dc00b68151fdb86e8e6bd8ef5c96..8de14a9c7fefca40a9ffc93b7bc67c698b1d6196 100644
--- a/cc/test/pixel_test.cc
+++ b/cc/test/pixel_test.cc
@@ -77,26 +77,26 @@ void PixelTest::SetUp() {
resource_provider_->set_offscreen_context_provider(offscreen_contexts);
}
+bool PixelTest::ReadbackResult(scoped_ptr<SkBitmap> bitmap) {
+ result_bitmap_ = bitmap.Pass();
+}
+
bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file,
const PixelComparator& comparator) {
- gfx::Rect device_viewport_rect(device_viewport_size_);
-
- SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kARGB_8888_Config,
- device_viewport_rect.width(),
- device_viewport_rect.height());
- bitmap.allocPixels();
- unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels());
- renderer_->GetFramebufferPixels(pixels, device_viewport_rect);
-
base::FilePath test_data_dir;
if (!PathService::Get(cc::DIR_TEST_DATA, &test_data_dir))
return false;
+ // If this is false, we didn't set up a readback on a render pass.
+ if (!result_bitmap_)
+ return false;
+
// To rebaseline:
- // return WritePNGFile(bitmap, test_data_dir.Append(ref_file));
+ // return WritePNGFile(*result_bitmap_, test_data_dir.Append(ref_file), true);
- return MatchesPNGFile(bitmap, test_data_dir.Append(ref_file), comparator);
+ return MatchesPNGFile(*result_bitmap_,
+ test_data_dir.Append(ref_file),
+ comparator);
}
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698