kF16,
};
-#ifdef SK_USE_LEGACY_MAKE_PICTURE_API
+ /**
+ * Create a new image from the specified picture.
+ * This SkImage has no defined BitDepth or SkColorSpace, it is a flexible container for
+ * draw commands.
+ */
static sk_sp<SkImage> MakeFromPicture(sk_sp<SkPicture> picture, const SkISize& dimensions,
const SkMatrix* matrix, const SkPaint* paint);
-#endif
/**
* Create a new image from the specified picture.
- * Creating an SkImage from an SkPicture requires snapping the picture to a particular
- * BitDepth and SkColorSpace.
+ * On creation of the SkImage, snap the SkPicture to a particular BitDepth and SkColorSpace.
*/
static sk_sp<SkImage> MakeFromPicture(sk_sp<SkPicture>, const SkISize& dimensions,
const SkMatrix*, const SkPaint*, BitDepth,
const SkMatrix* matrix, const SkPaint* paint,
SkImage::BitDepth bitDepth,
sk_sp<SkColorSpace> colorSpace) {
- if (!picture || size.isEmpty() || !colorSpace) {
+ if (!picture || size.isEmpty()) {
return nullptr;
}
- if (SkImage::BitDepth::kF16 == bitDepth && !colorSpace->gammaIsLinear()) {
+ if (SkImage::BitDepth::kF16 == bitDepth && (!colorSpace || !colorSpace->gammaIsLinear())) {
return nullptr;
}
- if (!colorSpace->gammaCloseToSRGB() && !colorSpace->gammaIsLinear()) {
+ if (colorSpace && (!colorSpace->gammaCloseToSRGB() && !colorSpace->gammaIsLinear())) {
return nullptr;
}
return true;
}
-#ifdef SK_USE_LEGACY_MAKE_PICTURE_API
sk_sp<SkImage> SkImage::MakeFromPicture(sk_sp<SkPicture> picture, const SkISize& dimensions,
const SkMatrix* matrix, const SkPaint* paint) {
return SkImage::MakeFromPicture(std::move(picture), dimensions, matrix, paint, BitDepth::kU8,
- SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named));
+ nullptr);
}
-#endif
sk_sp<SkImage> SkImage::MakeFromPicture(sk_sp<SkPicture> picture, const SkISize& dimensions,
const SkMatrix* matrix, const SkPaint* paint,