aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-27 17:32:18 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-27 22:02:58 +0000
commit2084ffa9a3fa7eb3c7e17ec5b55750be9942bafc (patch)
treefad758388f0bd64ce0158dd2ad7ac53abd26ee6f /src/image
parentc119a2f3b5f2ca4ce792d44bd8fa7a6e3334a5c9 (diff)
Revert "Fix SkImage_Gpu::getROPixels"
This reverts commit f4d443fd1bd8cffbcd7a07a48f3488ae871414e9. Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=705156 Original change's description: > 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> > TBR=msarett@google.com,robertphillips@google.com,brianosman@google.com,reed@google.com,reviews@skia.org # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Id46226e41ca287ef3351710815ae2e842da4d293 Reviewed-on: https://skia-review.googlesource.com/10210 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/image')
-rw-r--r--src/image/SkImage_Gpu.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 68a2df05a1..1dcc69c041 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -62,6 +62,10 @@ 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 {
const auto desc = SkBitmapCacheDesc::Make(this);
if (SkBitmapCache::Find(desc, dst)) {
@@ -71,12 +75,15 @@ bool SkImage_Gpu::getROPixels(SkBitmap* dst, SkColorSpace* dstColorSpace, Cachin
return true;
}
- if (!dst->tryAllocPixels(this->onImageInfo())) {
+ SkImageInfo ii = make_info(this->width(), this->height(), this->alphaType(),
+ sk_ref_sp(dstColorSpace));
+ if (!dst->tryAllocPixels(ii)) {
return false;
}
- sk_sp<GrSurfaceContext> sContext =
- fContext->contextPriv().makeWrappedSurfaceContext(fProxy, fColorSpace);
+ sk_sp<GrSurfaceContext> sContext = fContext->contextPriv().makeWrappedSurfaceContext(
+ fProxy,
+ fColorSpace);
if (!sContext) {
return false;
}
@@ -188,8 +195,9 @@ 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;
}