diff options
author | 2017-04-11 09:51:32 -0400 | |
---|---|---|
committer | 2017-04-11 14:27:28 +0000 | |
commit | 68feef423dfa1f3e2e6e9b0f4df1027f6e8645b1 (patch) | |
tree | 39da66c24218258f5b8abb1c64a7a236ab1529e4 /include | |
parent | 3fbca26e9c0e6e3c27c9dd437c9f790a31f20675 (diff) |
Allow BF and BRD clients to request an output color space
Bug: skia:
Change-Id: I0f0d3bfdd5c47544ab71167fd7984ee8e8ac5903
Reviewed-on: https://skia-review.googlesource.com/11601
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/android/SkBitmapRegionDecoder.h | 5 | ||||
-rw-r--r-- | include/codec/SkAndroidCodec.h | 10 |
2 files changed, 12 insertions, 3 deletions
diff --git a/include/android/SkBitmapRegionDecoder.h b/include/android/SkBitmapRegionDecoder.h index 660aa0aefc..841bf8d415 100644 --- a/include/android/SkBitmapRegionDecoder.h +++ b/include/android/SkBitmapRegionDecoder.h @@ -55,11 +55,14 @@ public: * if this color type is unsupported. * @param requireUnpremul If the image is not opaque, we will use this to determine the * alpha type to use. + * @param prefColorSpace If non-null and supported, this is the color space that we will + * decode into. Otherwise, we will choose a default. * */ virtual bool decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocator, const SkIRect& desiredSubset, int sampleSize, - SkColorType colorType, bool requireUnpremul) = 0; + SkColorType colorType, bool requireUnpremul, + sk_sp<SkColorSpace> prefColorSpace = nullptr) = 0; /* * @param Requested destination color type * @return true if we support the requested color type and false otherwise diff --git a/include/codec/SkAndroidCodec.h b/include/codec/SkAndroidCodec.h index 8e9ad4e2d3..87d514dfff 100644 --- a/include/codec/SkAndroidCodec.h +++ b/include/codec/SkAndroidCodec.h @@ -76,11 +76,17 @@ public: SkAlphaType computeOutputAlphaType(bool requestedUnpremul); /** - * @param outputColorType Color type that the client will decode to + * @param outputColorType Color type that the client will decode to. + * @param prefColorSpace Preferred color space to decode to. + * This may not return |prefColorSpace| for a couple reasons. + * (1) Android Principles: 565 must be sRGB, F16 must be + * linear sRGB, transfer function must be parametric. + * (2) Codec Limitations: F16 requires a linear color space. * * Returns the appropriate color space to decode to. */ - sk_sp<SkColorSpace> computeOutputColorSpace(SkColorType outputColorType); + sk_sp<SkColorSpace> computeOutputColorSpace(SkColorType outputColorType, + sk_sp<SkColorSpace> prefColorSpace = nullptr); /** * Returns the dimensions of the scaled output image, for an input |