diff options
author | Brian Osman <brianosman@google.com> | 2019-01-14 11:15:50 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2019-01-14 18:01:15 +0000 |
commit | f48c9965ecd90917d6c796f3b561b77eb1566328 (patch) | |
tree | 639ffa0a047c57d42769a103aacc5651a5a49b74 /include | |
parent | 4ca9fa30bab977178fee9cad194556b5ae6e5adf (diff) | |
download | skqp-f48c9965ecd90917d6c796f3b561b77eb1566328.tar.gz |
Revert "Revert "Add SkImage::makeColorTypeAndColorSpace""
This reverts commit 9a97c96c9c3a04374af1726d698ddc35e0d728c4.
This works like makeColorSpace, but allows changing color type as well.
Added a GM to test, although the GM demonstrates several ways this can
fail (especially when using this on lazy images).
For simple use-cases (8888 <-> F16), everything should be fine.
For the reland, add logic to the GM to guard against context abandon
failures, and to ensure that lazy images can be decoded (by calling
makeRasterImage) before trying to draw them. That prevents the DDL
recorder from seeing them.
Bug: skia:
Change-Id: Ibc7b07c3399979b1a44d85a38424e5487e606607
Reviewed-on: https://skia-review.googlesource.com/c/183800
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkImage.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h index c35ae95b70..764447f39b 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -1020,6 +1020,19 @@ public: */ sk_sp<SkImage> makeColorSpace(sk_sp<SkColorSpace> target) const; + /** Experimental. + Creates SkImage in target SkColorType and SkColorSpace. + Returns nullptr if SkImage could not be created. + + Returns original SkImage if it is in target SkColorType and SkColorSpace. + + @param targetColorType SkColorType of returned SkImage + @param targetColorSpace SkColorSpace of returned SkImage + @return created SkImage in target SkColorType and SkColorSpace + */ + sk_sp<SkImage> makeColorTypeAndColorSpace(SkColorType targetColorType, + sk_sp<SkColorSpace> targetColorSpace) const; + private: SkImage(int width, int height, uint32_t uniqueID); friend class SkImage_Base; |