diff options
author | Brian Osman <brianosman@google.com> | 2018-03-27 09:56:31 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-27 14:45:14 +0000 |
commit | 052ef695708eddeaa81c3fcf5747824c1f0ad073 (patch) | |
tree | 1122ad13a7fe3a97d2e6bf4b160f5b9582e679de /src/image | |
parent | f830443814fb21bd4b1009186b23680e3a38935e (diff) |
Pin color type when a cross-context image is constructed
Fixes issues with gray images that may be incorrectly re-interpreted as
alpha when re-wrapped. (https://github.com/flutter/flutter/issues/15600)
Change-Id: I4a78466073e14d212108d168eed0b2df1bc92ffe
Reviewed-on: https://skia-review.googlesource.com/116484
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 4733cae06e..3c05f1d219 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -723,7 +723,9 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromEncoded(GrContext* context, sk_sp<Sk sk_sp<GrSemaphore> sema = gpu->prepareTextureForCrossContextUsage(texture.get()); auto gen = GrBackendTextureImageGenerator::Make(std::move(texture), proxy->origin(), - std::move(sema), codecImage->alphaType(), + std::move(sema), + as_IB(codecImage)->onImageInfo().colorType(), + codecImage->alphaType(), std::move(texColorSpace)); return SkImage::MakeFromGenerator(std::move(gen)); } @@ -778,7 +780,8 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromPixmap(GrContext* context, const SkP sk_sp<GrSemaphore> sema = gpu->prepareTextureForCrossContextUsage(texture.get()); auto gen = GrBackendTextureImageGenerator::Make(std::move(texture), proxy->origin(), - std::move(sema), pixmap.alphaType(), + std::move(sema), pixmap.colorType(), + pixmap.alphaType(), pixmap.info().refColorSpace()); return SkImage::MakeFromGenerator(std::move(gen)); } |