static bool png_conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) { // Ensure the alpha type is valid if (!valid_alpha(dst.alphaType(), src.alphaType())) { return false; } // Check for supported color types switch (dst.colorType()) { case kRGBA_8888_SkColorType: case kBGRA_8888_SkColorType: case kRGBA_F16_SkColorType: return true; case kRGB_565_SkColorType: return kOpaque_SkAlphaType == src.alphaType(); default: return dst.colorType() == src.colorType(); } }
/* * Checks if the conversion between the input image and the requested output * image has been implemented */ static bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) { // Ensure that the profile type is unchanged if (dst.profileType() != src.profileType()) { return false; } // Ensure the alpha type is valid if (!valid_alpha(dst.alphaType(), src.alphaType())) { return false; } // Check for supported color types switch (dst.colorType()) { // Allow output to kN32 from any type of input case kN32_SkColorType: return true; // Allow output to kIndex_8 from compatible inputs case kIndex_8_SkColorType: return kIndex_8_SkColorType == src.colorType(); default: return false; } }