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

Unified Diff: tests/ImageTest.cpp

Issue 1908493002: Add instructions for building with MSAN (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Respond to Hal's comments Created 4 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
« no previous file with comments | « site/user/special/msan.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageTest.cpp
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index c4d6e12e226b2339dcf7e99fc0dbc00d03615106..9cba74e57faf205d828ef7086f1b01925c24061c 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -67,6 +67,25 @@ static sk_sp<SkImage> create_image() {
draw_image_test_pattern(surface->getCanvas());
return surface->makeImageSnapshot();
}
+
+static SkData* create_image_data(SkImageInfo* info) {
+ *info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
+ const size_t rowBytes = info->minRowBytes();
+ SkAutoTUnref<SkData> data(SkData::NewUninitialized(rowBytes * info->height()));
+ {
+ SkBitmap bm;
+ bm.installPixels(*info, data->writable_data(), rowBytes);
+ SkCanvas canvas(bm);
+ draw_image_test_pattern(&canvas);
+ }
+ return data.release();
+}
+static sk_sp<SkImage> create_data_image() {
+ SkImageInfo info;
+ sk_sp<SkData> data(create_image_data(&info));
+ return SkImage::MakeRasterData(info, data, info.minRowBytes());
+}
+#if SK_SUPPORT_GPU // not gpu-specific but currently only used in GPU tests
static sk_sp<SkImage> create_image_565() {
const SkImageInfo info = SkImageInfo::Make(20, 20, kRGB_565_SkColorType, kOpaque_SkAlphaType);
auto surface(SkSurface::MakeRaster(info));
@@ -90,24 +109,6 @@ static sk_sp<SkImage> create_image_ct() {
SkImageInfo info = SkImageInfo::Make(5, 5, kIndex_8_SkColorType, kPremul_SkAlphaType);
return SkImage::MakeRasterCopy(SkPixmap(info, data, 5, colorTable));
}
-static SkData* create_image_data(SkImageInfo* info) {
- *info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
- const size_t rowBytes = info->minRowBytes();
- SkAutoTUnref<SkData> data(SkData::NewUninitialized(rowBytes * info->height()));
- {
- SkBitmap bm;
- bm.installPixels(*info, data->writable_data(), rowBytes);
- SkCanvas canvas(bm);
- draw_image_test_pattern(&canvas);
- }
- return data.release();
-}
-static sk_sp<SkImage> create_data_image() {
- SkImageInfo info;
- sk_sp<SkData> data(create_image_data(&info));
- return SkImage::MakeRasterData(info, data, info.minRowBytes());
-}
-#if SK_SUPPORT_GPU // not gpu-specific but currently only used in GPU tests
static sk_sp<SkImage> create_picture_image() {
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(10, 10);
« no previous file with comments | « site/user/special/msan.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698