diff options
author | 2017-05-12 10:56:49 -0400 | |
---|---|---|
committer | 2017-05-15 13:46:50 +0000 | |
commit | dedac85b4f08546e92143d96c13b753cb1b80e23 (patch) | |
tree | e72b5beac8c764e800a9c6aeace0c177a1eade29 /src/core/SkImageInfoPriv.h | |
parent | 297a7efd54495a06a7473eb8d99b211fd511766c (diff) |
Allow numerical color spaces with legacy rendering
Bug: 720083
Change-Id: Ibd4dbf6ee95ac14857e8280a441f81976710e5e8
Reviewed-on: https://skia-review.googlesource.com/16700
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
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 |