aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2018-07-06 13:57:01 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-06 18:34:58 +0000
commita50205fca5f7cff36dd3adac841b4c23a90a0b7d (patch)
tree4aa111a0c4b80400dfa39ef5b36e8ef391c164ab /tests
parent5a619a740f12f0b1f504f305b8964efe4c85ee26 (diff)
Add color type to the image filter DAG's OutputProperties
Don't try to guess the pixel config to use for intermediates. Instead, just make the intermediates in the same color type (and space) as the final destination. This removes some no-longer-correct logic that was using sRGB configs, resulting in linear blending and precision loss. Change-Id: I627c47193a9f2889c3dc121170ff3e7d5d315fa0 Reviewed-on: https://skia-review.googlesource.com/139547 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ImageFilterTest.cpp20
-rw-r--r--tests/SpecialImageTest.cpp4
2 files changed, 12 insertions, 12 deletions
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index f38b71496a..d452c112d6 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -544,7 +544,7 @@ static void test_crop_rects(skiatest::Reporter* reporter,
for (int i = 0; i < filters.count(); ++i) {
SkImageFilter* filter = filters.getFilter(i);
SkIPoint offset;
- SkImageFilter::OutputProperties noColorSpace(nullptr);
+ SkImageFilter::OutputProperties noColorSpace(kN32_SkColorType, nullptr);
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr, noColorSpace);
sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offset));
REPORTER_ASSERT(reporter, resultImg, filters.getName(i));
@@ -567,7 +567,7 @@ static void test_negative_blur_sigma(skiatest::Reporter* reporter,
gradient));
SkIPoint offset;
- SkImageFilter::OutputProperties noColorSpace(nullptr);
+ SkImageFilter::OutputProperties noColorSpace(kN32_SkColorType, nullptr);
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(32, 32), nullptr, noColorSpace);
sk_sp<SkSpecialImage> positiveResult1(positiveFilter->filterImage(imgSrc.get(), ctx, &offset));
@@ -644,7 +644,7 @@ static void test_zero_blur_sigma(skiatest::Reporter* reporter, GrContext* contex
sk_sp<SkSpecialImage> image(surf->makeImageSnapshot());
SkIPoint offset;
- SkImageFilter::OutputProperties noColorSpace(nullptr);
+ SkImageFilter::OutputProperties noColorSpace(kN32_SkColorType, nullptr);
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(32, 32), nullptr, noColorSpace);
sk_sp<SkSpecialImage> result(filter->filterImage(image.get(), ctx, &offset));
@@ -681,7 +681,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterZeroBlurSigma_Gpu, reporter, ctxIn
static void test_fail_affects_transparent_black(skiatest::Reporter* reporter, GrContext* context) {
sk_sp<FailImageFilter> failFilter(new FailImageFilter());
sk_sp<SkSpecialImage> source(create_empty_special_image(context, 5));
- SkImageFilter::OutputProperties noColorSpace(nullptr);
+ SkImageFilter::OutputProperties noColorSpace(kN32_SkColorType, nullptr);
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 1, 1), nullptr, noColorSpace);
sk_sp<SkColorFilter> green(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkBlendMode::kSrc));
SkASSERT(green->affectsTransparentBlack());
@@ -975,7 +975,7 @@ static void test_imagefilter_merge_result_size(skiatest::Reporter* reporter, GrC
sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, 1));
- SkImageFilter::OutputProperties noColorSpace(nullptr);
+ SkImageFilter::OutputProperties noColorSpace(kN32_SkColorType, nullptr);
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 100, 100), nullptr,
noColorSpace);
SkIPoint offset;
@@ -1144,7 +1144,7 @@ static void test_big_kernel(skiatest::Reporter* reporter, GrContext* context) {
SkASSERT(srcImg);
SkIPoint offset;
- SkImageFilter::OutputProperties noColorSpace(nullptr);
+ SkImageFilter::OutputProperties noColorSpace(kN32_SkColorType, nullptr);
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr, noColorSpace);
sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offset));
REPORTER_ASSERT(reporter, resultImg);
@@ -1216,7 +1216,7 @@ static void test_clipped_picture_imagefilter(skiatest::Reporter* reporter, GrCon
sk_sp<SkImageFilter> imageFilter(SkPictureImageFilter::Make(picture));
SkIPoint offset;
- SkImageFilter::OutputProperties noColorSpace(nullptr);
+ SkImageFilter::OutputProperties noColorSpace(kN32_SkColorType, nullptr);
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), nullptr, noColorSpace);
sk_sp<SkSpecialImage> resultImage(imageFilter->filterImage(srcImg.get(), ctx, &offset));
@@ -1469,7 +1469,7 @@ static void test_composed_imagefilter_offset(skiatest::Reporter* reporter, GrCon
sk_sp<SkImageFilter> composedFilter(SkComposeImageFilter::Make(std::move(blurFilter),
std::move(offsetFilter)));
SkIPoint offset;
- SkImageFilter::OutputProperties noColorSpace(nullptr);
+ SkImageFilter::OutputProperties noColorSpace(kN32_SkColorType, nullptr);
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr, noColorSpace);
sk_sp<SkSpecialImage> resultImg(composedFilter->filterImage(srcImg.get(), ctx, &offset));
@@ -1504,7 +1504,7 @@ static void test_composed_imagefilter_bounds(skiatest::Reporter* reporter, GrCon
std::move(pictureFilter)));
sk_sp<SkSpecialImage> sourceImage(create_empty_special_image(context, 100));
- SkImageFilter::OutputProperties noColorSpace(nullptr);
+ SkImageFilter::OutputProperties noColorSpace(kN32_SkColorType, nullptr);
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr, noColorSpace);
SkIPoint offset;
sk_sp<SkSpecialImage> result(composedFilter->filterImage(sourceImage.get(), ctx, &offset));
@@ -1532,7 +1532,7 @@ static void test_partial_crop_rect(skiatest::Reporter* reporter, GrContext* cont
SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::kHasHeight_CropEdge);
sk_sp<SkImageFilter> filter(make_grayscale(nullptr, &cropRect));
SkIPoint offset;
- SkImageFilter::OutputProperties noColorSpace(nullptr);
+ SkImageFilter::OutputProperties noColorSpace(kN32_SkColorType, nullptr);
SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr, noColorSpace);
sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offset));
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index d2549c4bbb..368e594ab8 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -87,7 +87,7 @@ static void test_image(const sk_sp<SkSpecialImage>& img, skiatest::Reporter* rep
//--------------
// Test that draw restricts itself to the subset
- SkImageFilter::OutputProperties outProps(img->getColorSpace());
+ SkImageFilter::OutputProperties outProps(kN32_SkColorType, img->getColorSpace());
sk_sp<SkSpecialSurface> surf(img->makeSurface(outProps, SkISize::Make(kFullSize, kFullSize),
kPremul_SkAlphaType));
@@ -124,7 +124,7 @@ static void test_image(const sk_sp<SkSpecialImage>& img, skiatest::Reporter* rep
REPORTER_ASSERT(reporter, isGPUBacked != !!tightImg->peekPixels(&tmpPixmap));
}
{
- SkImageFilter::OutputProperties outProps(img->getColorSpace());
+ SkImageFilter::OutputProperties outProps(kN32_SkColorType, img->getColorSpace());
sk_sp<SkSurface> tightSurf(img->makeTightSurface(outProps, subset.size()));
REPORTER_ASSERT(reporter, tightSurf->width() == subset.width());