Add SkImage::colorSpace() and SkImage::refColorSpace()

BUG=skia:

Change-Id: I31c2a2731cd70e4e5162905de0ad129516dacc6b
Reviewed-on: https://skia-review.googlesource.com/9152
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Mike Reed <reed@google.com>
This commit is contained in:
Matt Sarett 2017-03-02 12:42:35 -05:00 committed by Skia Commit-Bot
parent 025e2444c1
commit 5b4599f137
2 changed files with 18 additions and 0 deletions

View File

@ -180,6 +180,16 @@ public:
uint32_t uniqueID() const { return fUniqueID; }
SkAlphaType alphaType() const;
/**
* Returns the color space of the SkImage.
*
* This is the color space that was supplied on creation of the SkImage or a color
* space that was parsed from encoded data. This color space is not guaranteed to be
* renderable. Can return nullptr if the SkImage was created without a color space.
*/
SkColorSpace* colorSpace() const;
sk_sp<SkColorSpace> refColorSpace() const;
/**
* Returns true fi the image will be drawn as a mask, with no intrinsic color of its own.
*/

View File

@ -82,6 +82,14 @@ SkAlphaType SkImage::alphaType() const {
return as_IB(this)->onAlphaType();
}
SkColorSpace* SkImage::colorSpace() const {
return as_IB(this)->onImageInfo().colorSpace();
}
sk_sp<SkColorSpace> SkImage::refColorSpace() const {
return as_IB(this)->onImageInfo().refColorSpace();
}
sk_sp<SkShader> SkImage::makeShader(SkShader::TileMode tileX, SkShader::TileMode tileY,
const SkMatrix* localMatrix) const {
return SkImageShader::Make(sk_ref_sp(const_cast<SkImage*>(this)), tileX, tileY, localMatrix);