From dedac85b4f08546e92143d96c13b753cb1b80e23 Mon Sep 17 00:00:00 2001 From: Matt Sarett Date: Fri, 12 May 2017 10:56:49 -0400 Subject: Allow numerical color spaces with legacy rendering Bug: 720083 Change-Id: Ibd4dbf6ee95ac14857e8280a441f81976710e5e8 Reviewed-on: https://skia-review.googlesource.com/16700 Reviewed-by: Brian Osman Commit-Queue: Matt Sarett --- src/core/SkImageInfoPriv.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/core/SkImageInfoPriv.h') 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 @@ -75,6 +75,19 @@ static inline bool SkImageInfoIsValidRenderingCS(const SkImageInfo& info) { return true; } +/** + * 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: -- cgit v1.2.3