aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-03-24 11:22:31 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-24 17:22:15 +0000
commitf4d443fd1bd8cffbcd7a07a48f3488ae871414e9 (patch)
treea991319413c9a0131c9343b3f35c14dd8701c890 /src/image
parentf3880933092c3226cd7ffd1690fe72c9c0cc376c (diff)
Fix SkImage_Gpu::getROPixels
The dstColorSpace is a badly named parameter. It's a hint about where/how the returned pixels are going to be used. Raster and GPU are meant to ignore that information - codecs use it to drive our decoding heuristic. I've adopted that name in several places, although it's quite bad. Maybe usageColorSpace would be better? Bug: skia: Change-Id: I99acaac4bed57ed8acd8433e1c5b39a60c3af09e Reviewed-on: https://skia-review.googlesource.com/10109 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/image')
-rw-r--r--src/image/SkImage_Gpu.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 762e11895a..66fc813d45 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -62,12 +62,7 @@ SkImageInfo SkImage_Gpu::onImageInfo() const {
return SkImageInfo::Make(fProxy->width(), fProxy->height(), ct, fAlphaType, fColorSpace);
}
-static SkImageInfo make_info(int w, int h, SkAlphaType at, sk_sp<SkColorSpace> colorSpace) {
- return SkImageInfo::MakeN32(w, h, at, std::move(colorSpace));
-}
-
-bool SkImage_Gpu::getROPixels(SkBitmap* dst, SkColorSpace* dstColorSpace,
- CachingHint chint) const {
+bool SkImage_Gpu::getROPixels(SkBitmap* dst, SkColorSpace* dstColorSpace, CachingHint chint) const {
if (SkBitmapCache::Find(this->uniqueID(), dst)) {
SkASSERT(dst->getGenerationID() == this->uniqueID());
SkASSERT(dst->isImmutable());
@@ -75,15 +70,12 @@ bool SkImage_Gpu::getROPixels(SkBitmap* dst, SkColorSpace* dstColorSpace,
return true;
}
- SkImageInfo ii = make_info(this->width(), this->height(), this->alphaType(),
- sk_ref_sp(dstColorSpace));
- if (!dst->tryAllocPixels(ii)) {
+ if (!dst->tryAllocPixels(this->onImageInfo())) {
return false;
}
- sk_sp<GrSurfaceContext> sContext = fContext->contextPriv().makeWrappedSurfaceContext(
- fProxy,
- fColorSpace);
+ sk_sp<GrSurfaceContext> sContext =
+ fContext->contextPriv().makeWrappedSurfaceContext(fProxy, fColorSpace);
if (!sContext) {
return false;
}
@@ -201,9 +193,8 @@ bool SkImage_Gpu::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size
flags = GrContext::kUnpremul_PixelOpsFlag;
}
- sk_sp<GrSurfaceContext> sContext = fContext->contextPriv().makeWrappedSurfaceContext(
- fProxy,
- fColorSpace);
+ sk_sp<GrSurfaceContext> sContext =
+ fContext->contextPriv().makeWrappedSurfaceContext(fProxy, fColorSpace);
if (!sContext) {
return false;
}