diff options
author | brianosman <brianosman@google.com> | 2016-09-23 13:04:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-23 13:04:05 -0700 |
commit | eed6b0e1d865a1f93143c09961debba0aca592ca (patch) | |
tree | 961a464d586a0f11007b8a9a482df912e8c5d305 /tests/SpecialImageTest.cpp | |
parent | 49da334086c4a2c0bc4cb99e97965600dcb72f73 (diff) |
Change SkSpecialImage::makeSurface and makeTightSurface to take output
properties (color space), bounds, and (optional) alphaType.
We were being pretty inconsistent before. Raster was honoring all
components of the info. GPU was using the supplied color type, but
propagating the source's color space. All call sites were saying N32.
What we want to do is propagate the original device's color space, and
pick a good format from that. Rather than force all the clients to
jump through hoops constructing an SkImageInfo that meets our criteria,
just have them supply the few bits we care about, and do everything else
internally.
This also lets us always use RGBA on GPU, but N32 on raster.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2349373004
Committed: https://skia.googlesource.com/skia/+/53c38087949252d27cde668368a3eeb59cc2eb00
Review-Url: https://codereview.chromium.org/2349373004
Diffstat (limited to 'tests/SpecialImageTest.cpp')
-rw-r--r-- | tests/SpecialImageTest.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp index ba0eb58f4e..e992177430 100644 --- a/tests/SpecialImageTest.cpp +++ b/tests/SpecialImageTest.cpp @@ -85,9 +85,9 @@ static void test_image(const sk_sp<SkSpecialImage>& img, skiatest::Reporter* rep //-------------- // Test that draw restricts itself to the subset - SkImageInfo info = SkImageInfo::MakeN32(kFullSize, kFullSize, kOpaque_SkAlphaType); - - sk_sp<SkSpecialSurface> surf(img->makeSurface(info)); + SkImageFilter::OutputProperties outProps(img->getColorSpace()); + sk_sp<SkSpecialSurface> surf(img->makeSurface(outProps, SkISize::Make(kFullSize, kFullSize), + kOpaque_SkAlphaType)); SkCanvas* canvas = surf->getCanvas(); @@ -122,9 +122,8 @@ static void test_image(const sk_sp<SkSpecialImage>& img, skiatest::Reporter* rep REPORTER_ASSERT(reporter, peekTextureSucceeds != !!tightImg->peekPixels(&tmpPixmap)); } { - SkImageInfo info = SkImageInfo::MakeN32(subset.width(), subset.height(), - kPremul_SkAlphaType); - sk_sp<SkSurface> tightSurf(img->makeTightSurface(info)); + SkImageFilter::OutputProperties outProps(img->getColorSpace()); + sk_sp<SkSurface> tightSurf(img->makeTightSurface(outProps, subset.size())); REPORTER_ASSERT(reporter, tightSurf->width() == subset.width()); REPORTER_ASSERT(reporter, tightSurf->height() == subset.height()); |