Revert "Fix SkImage_Gpu::getROPixels"
This reverts commit f4d443fd1b
.
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>
This commit is contained in:
parent
c119a2f3b5
commit
2084ffa9a3
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user