// Idea: If/when SkImageGenerator supports a native-scaling API (where the generator itself
// can scale more efficiently) we should take advantage of it here.
//
- SkDestinationSurfaceColorMode decodeColorMode = dst.info().colorSpace()
- ? SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware
- : SkDestinationSurfaceColorMode::kLegacy;
SkBitmap bm;
- if (as_IB(this)->getROPixels(&bm, decodeColorMode, chint)) {
+ if (as_IB(this)->getROPixels(&bm, dst.info().colorSpace(), chint)) {
bm.lockPixels();
SkPixmap pmap;
// Note: By calling the pixmap scaler, we never cache the final result, so the chint
// to produce a cached raster-bitmap form, so that drawing to a raster canvas should be fast.
//
SkBitmap bm;
- if (as_IB(this)->getROPixels(&bm, SkDestinationSurfaceColorMode::kLegacy)) {
+ SkColorSpace* legacyColorSpace = nullptr;
+ if (as_IB(this)->getROPixels(&bm, legacyColorSpace)) {
bm.lockPixels();
bm.unlockPixels();
}
// TODO: Right now, the encoders don't handle F16 or linearly premultiplied data. Once they do,
// we should decode in "color space aware" mode, then re-encode that. For now, work around this
// by asking for a legacy decode (which gives us the raw data in N32).
- if (as_IB(this)->getROPixels(&bm, SkDestinationSurfaceColorMode::kLegacy)) {
+ SkColorSpace* legacyColorSpace = nullptr;
+ if (as_IB(this)->getROPixels(&bm, legacyColorSpace)) {
SkDynamicMemoryWStream buf;
return SkEncodeImage(&buf, bm, type, quality) ? buf.detachAsData().release() : nullptr;
}
// TODO: Right now, the encoders don't handle F16 or linearly premultiplied data. Once they do,
// we should decode in "color space aware" mode, then re-encode that. For now, work around this
// by asking for a legacy decode (which gives us the raw data in N32).
- if (as_IB(this)->getROPixels(&bm, SkDestinationSurfaceColorMode::kLegacy) &&
+ SkColorSpace* legacyColorSpace = nullptr;
+ if (as_IB(this)->getROPixels(&bm, legacyColorSpace) &&
bm.requestLock(&apu)) {
if (serializer) {
return serializer->encode(apu.pixmap());
return nullptr;
}
SkColorSpace* colorSpace = as_IB(this)->onImageInfo().colorSpace();
- SkDestinationSurfaceColorMode decodeColorMode = colorSpace
- ? SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware
- : SkDestinationSurfaceColorMode::kLegacy;
sk_sp<SkSpecialImage> srcSpecialImage = SkSpecialImage::MakeFromImage(
- subset, sk_ref_sp(const_cast<SkImage*>(this)), decodeColorMode);
+ subset, sk_ref_sp(const_cast<SkImage*>(this)), colorSpace);
if (!srcSpecialImage) {
return nullptr;
}