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

Unified Diff: cc/test/skia_common.cc

Issue 1512823002: Serialize DisplayListRecordingSource to protos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years 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/skia_common.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/skia_common.cc
diff --git a/cc/test/skia_common.cc b/cc/test/skia_common.cc
index 22d546cc75573d47bbe2a92b43a9194f7365eb2d..aed402563dca6715bca00d9b9ee5427e7dec2624 100644
--- a/cc/test/skia_common.cc
+++ b/cc/test/skia_common.cc
@@ -35,6 +35,21 @@ void DrawDisplayList(unsigned char* buffer,
list->Raster(&canvas, NULL, gfx::Rect(), 1.0f);
}
+bool AreDisplayListDrawingResultsSame(const gfx::Rect& layer_rect,
+ scoped_refptr<DisplayItemList> list_a,
+ scoped_refptr<DisplayItemList> list_b) {
+ const size_t pixel_size = 4 * layer_rect.size().GetArea();
+
+ scoped_ptr<unsigned char[]> pixels_a(new unsigned char[pixel_size]);
+ scoped_ptr<unsigned char[]> pixels_b(new unsigned char[pixel_size]);
+ memset(pixels_a.get(), 0, pixel_size);
+ memset(pixels_b.get(), 0, pixel_size);
+ DrawDisplayList(pixels_a.get(), layer_rect, list_a);
+ DrawDisplayList(pixels_b.get(), layer_rect, list_b);
+
+ return !memcmp(pixels_a.get(), pixels_b.get(), pixel_size);
+}
+
skia::RefPtr<SkImage> CreateDiscardableImage(const gfx::Size& size) {
const SkImageInfo info =
SkImageInfo::MakeN32Premul(size.width(), size.height());
« no previous file with comments | « cc/test/skia_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698