aboutsummaryrefslogtreecommitdiff
path: root/src/image
diff options
context:
space:
mode:
authorBrian Osman <brianosman@google.com>2018-10-19 14:27:54 -0400
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2018-10-19 19:44:24 +0000
commit6064e1c5d6194137c361e3fc97ebcb71cf6d507f (patch)
treec53ebd0b7796e92f28d80e9c1ace1d84472e4664 /src/image
parent41ba826ad7b4dd1a057de5b88903526dc10d22e2 (diff)
downloadskqp-6064e1c5d6194137c361e3fc97ebcb71cf6d507f.tar.gz
Remove texColorSpace output param from various producer APIs
Just expose colorSpace on the GrTextureProducer, and if a client needs it, they can get it from there. Bug: skia: Change-Id: I5134b1c9b2780274f3d6571d9fe8cd2a6b6ce7e9 Reviewed-on: https://skia-review.googlesource.com/c/163888 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/image')
-rw-r--r--src/image/SkImage_Base.h1
-rw-r--r--src/image/SkImage_Gpu.cpp11
-rw-r--r--src/image/SkImage_GpuBase.cpp3
-rw-r--r--src/image/SkImage_GpuBase.h2
-rw-r--r--src/image/SkImage_Lazy.cpp3
-rw-r--r--src/image/SkImage_Lazy.h1
-rw-r--r--src/image/SkImage_Raster.cpp9
7 files changed, 9 insertions, 21 deletions
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index d40c1c1146..bcec5a19e7 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -54,7 +54,6 @@ public:
virtual GrTextureProxy* peekProxy() const { return nullptr; }
virtual sk_sp<GrTextureProxy> asTextureProxyRef() const { return nullptr; }
virtual sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*, const GrSamplerState&,
- sk_sp<SkColorSpace>*,
SkScalar scaleAdjust[2]) const = 0;
virtual sk_sp<GrTextureProxy> refPinnedTextureProxy(uint32_t* uniqueID) const {
return nullptr;
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 783b1c9d80..e913a6c887 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -344,13 +344,12 @@ sk_sp<SkImage> SkImage::MakeFromNV12TexturesCopyWithExternalBackend(
static sk_sp<SkImage> create_image_from_producer(GrContext* context, GrTextureProducer* producer,
SkAlphaType at, uint32_t id,
GrMipMapped mipMapped) {
- sk_sp<SkColorSpace> texColorSpace;
- sk_sp<GrTextureProxy> proxy(producer->refTextureProxy(mipMapped, &texColorSpace));
+ sk_sp<GrTextureProxy> proxy(producer->refTextureProxy(mipMapped));
if (!proxy) {
return nullptr;
}
return sk_make_sp<SkImage_Gpu>(sk_ref_sp(context), id, at, std::move(proxy),
- std::move(texColorSpace), SkBudgeted::kNo);
+ sk_ref_sp(producer->colorSpace()), SkBudgeted::kNo);
}
sk_sp<SkImage> SkImage::makeTextureImage(GrContext* context, SkColorSpace* dstColorSpace,
@@ -657,12 +656,10 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromEncoded(GrContext* context, sk_sp<Sk
// Turn the codec image into a GrTextureProxy
GrImageTextureMaker maker(context, codecImage.get(), kDisallow_CachingHint);
- sk_sp<SkColorSpace> texColorSpace;
GrSamplerState samplerState(
GrSamplerState::WrapMode::kClamp,
buildMips ? GrSamplerState::Filter::kMipMap : GrSamplerState::Filter::kBilerp);
- sk_sp<GrTextureProxy> proxy(
- maker.refTextureProxyForParams(samplerState, &texColorSpace, nullptr));
+ sk_sp<GrTextureProxy> proxy(maker.refTextureProxyForParams(samplerState, nullptr));
if (!proxy) {
return codecImage;
}
@@ -682,7 +679,7 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromEncoded(GrContext* context, sk_sp<Sk
std::move(sema),
as_IB(codecImage)->onImageInfo().colorType(),
codecImage->alphaType(),
- std::move(texColorSpace));
+ codecImage->refColorSpace());
return SkImage::MakeFromGenerator(std::move(gen));
}
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 50d07ac4b5..006533af78 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -187,7 +187,6 @@ bool SkImage_GpuBase::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels,
sk_sp<GrTextureProxy> SkImage_GpuBase::asTextureProxyRef(GrContext* context,
const GrSamplerState& params,
- sk_sp<SkColorSpace>* texColorSpace,
SkScalar scaleAdjust[2]) const {
if (context->uniqueID() != fContext->uniqueID()) {
SkASSERT(0);
@@ -196,7 +195,7 @@ sk_sp<GrTextureProxy> SkImage_GpuBase::asTextureProxyRef(GrContext* context,
GrTextureAdjuster adjuster(fContext.get(), this->asTextureProxyRef(), fAlphaType,
this->uniqueID(), fColorSpace.get());
- return adjuster.refTextureProxyForParams(params, texColorSpace, scaleAdjust);
+ return adjuster.refTextureProxyForParams(params, scaleAdjust);
}
GrBackendTexture SkImage_GpuBase::onGetBackendTexture(bool flushPendingGrContextIO,
diff --git a/src/image/SkImage_GpuBase.h b/src/image/SkImage_GpuBase.h
index 3c3de1e66c..2f9f454907 100644
--- a/src/image/SkImage_GpuBase.h
+++ b/src/image/SkImage_GpuBase.h
@@ -34,7 +34,7 @@ public:
SkASSERT(false);
return this->INHERITED::asTextureProxyRef();
}
- sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*, const GrSamplerState&, sk_sp<SkColorSpace>*,
+ sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*, const GrSamplerState&,
SkScalar scaleAdjust[2]) const final;
sk_sp<GrTextureProxy> refPinnedTextureProxy(uint32_t* uniqueID) const final {
diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp
index d93c6d0ea1..658cb1059c 100644
--- a/src/image/SkImage_Lazy.cpp
+++ b/src/image/SkImage_Lazy.cpp
@@ -287,14 +287,13 @@ bool SkImage_Lazy::onIsValid(GrContext* context) const {
#if SK_SUPPORT_GPU
sk_sp<GrTextureProxy> SkImage_Lazy::asTextureProxyRef(GrContext* context,
const GrSamplerState& params,
- sk_sp<SkColorSpace>* texColorSpace,
SkScalar scaleAdjust[2]) const {
if (!context) {
return nullptr;
}
GrImageTextureMaker textureMaker(context, this, kAllow_CachingHint);
- return textureMaker.refTextureProxyForParams(params, texColorSpace, scaleAdjust);
+ return textureMaker.refTextureProxyForParams(params, scaleAdjust);
}
#endif
diff --git a/src/image/SkImage_Lazy.h b/src/image/SkImage_Lazy.h
index 332133ca2a..b9bfe91245 100644
--- a/src/image/SkImage_Lazy.h
+++ b/src/image/SkImage_Lazy.h
@@ -47,7 +47,6 @@ public:
#if SK_SUPPORT_GPU
sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*,
const GrSamplerState&,
- sk_sp<SkColorSpace>*,
SkScalar scaleAdjust[2]) const override;
sk_sp<SkCachedData> getPlanes(SkYUVSizeInfo*, SkYUVAIndex[4],
SkYUVColorSpace*, const void* planes[4]) override;
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index af99dde2b3..4a55e872d0 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -82,7 +82,7 @@ public:
const SkBitmap* onPeekBitmap() const override { return &fBitmap; }
#if SK_SUPPORT_GPU
- sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*, const GrSamplerState&, sk_sp<SkColorSpace>*,
+ sk_sp<GrTextureProxy> asTextureProxyRef(GrContext*, const GrSamplerState&,
SkScalar scaleAdjust[2]) const override;
#endif
@@ -172,7 +172,6 @@ bool SkImage_Raster::getROPixels(SkBitmap* dst, CachingHint) const {
#if SK_SUPPORT_GPU
sk_sp<GrTextureProxy> SkImage_Raster::asTextureProxyRef(GrContext* context,
const GrSamplerState& params,
- sk_sp<SkColorSpace>* texColorSpace,
SkScalar scaleAdjust[2]) const {
if (!context) {
return nullptr;
@@ -183,11 +182,7 @@ sk_sp<GrTextureProxy> SkImage_Raster::asTextureProxyRef(GrContext* context,
if (tex) {
GrTextureAdjuster adjuster(context, fPinnedProxy, fBitmap.alphaType(), fPinnedUniqueID,
fBitmap.colorSpace());
- return adjuster.refTextureProxyForParams(params, texColorSpace, scaleAdjust);
- }
-
- if (texColorSpace) {
- *texColorSpace = fBitmap.refColorSpace();
+ return adjuster.refTextureProxyForParams(params, scaleAdjust);
}
return GrRefCachedBitmapTextureProxy(context, fBitmap, params, scaleAdjust);