diff options
Diffstat (limited to 'src/core/SkImageInfoPriv.h')
-rw-r--r-- | src/core/SkImageInfoPriv.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/SkImageInfoPriv.h b/src/core/SkImageInfoPriv.h index 42e80cab2b..c9b4b6c3d9 100644 --- a/src/core/SkImageInfoPriv.h +++ b/src/core/SkImageInfoPriv.h @@ -76,6 +76,19 @@ static inline bool SkImageInfoIsValidRenderingCS(const SkImageInfo& info) { } /** + * Returns true if |info| contains a valid combination of width, height, colorType, alphaType, + * colorSpace. Uses |colorMode| to decide how to treat color spaces. + */ +static inline bool SkImageInfoIsValid(const SkImageInfo& info, + SkDestinationSurfaceColorMode colorMode) { + if (SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware == colorMode) { + return SkImageInfoIsValidRenderingCS(info); + } + + return SkImageInfoIsValidAllowNumericalCS(info); +} + +/** * Returns true if Skia has defined a pixel conversion from the |src| to the |dst|. * Returns false otherwise. Some discussion of false cases: * We will not convert to kIndex8 unless it exactly matches the src, since color tables |