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

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: Added comments 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
« cc/test/fake_display_list_recording_source.h ('K') | « 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..dcc0c942413d600f3a4ab0877c536ca471ba3a0d 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 CompareDisplayListDrawingResults(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 0 == memcmp(pixels_a.get(), pixels_b.get(), pixel_size);
vmpstr 2015/12/10 01:12:19 return !memcmp(...);
David Trainor- moved to gerrit 2015/12/10 17:10:10 Done.
+}
+
skia::RefPtr<SkImage> CreateDiscardableImage(const gfx::Size& size) {
const SkImageInfo info =
SkImageInfo::MakeN32Premul(size.width(), size.height());
« cc/test/fake_display_list_recording_source.h ('K') | « cc/test/skia_common.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698