aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2016-04-20 08:27:18 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-20 08:27:18 -0700
commit9d08172828c2119752bc5bceeb1084c02ce7ab33 (patch)
treea6394b690777f09f27836f7f46c874c46418d8cc /tests
parent09aa1fce69b214714171db12c341aebd78dd29ea (diff)
Add instructions for building with MSAN
Move static functions only used by GPU into if SK_SUPPORT_GPU guard. This enables building MSAN, which seems to default to not supporting GPU. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1908493002 DOCS_PREVIEW= https://skia.org/?cl=1908493002 Review URL: https://codereview.chromium.org/1908493002
Diffstat (limited to 'tests')
-rw-r--r--tests/ImageTest.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index c4d6e12e22..9cba74e57f 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);