* - otherwise match the src color type
*/
inline bool conversion_possible(const SkImageInfo& dst, const SkImageInfo& src) {
- if (dst.profileType() != src.profileType()) {
+ // FIXME: skbug.com/4895
+ // Currently, we treat both kLinear and ksRGB encoded images as if they are kLinear.
+ // This makes sense while we do not have proper support for ksRGB. This is also
+ // the reason why we always allow the client to request kLinear.
+ if (dst.profileType() != src.profileType() &&
+ kLinear_SkColorProfileType != dst.profileType()) {
return false;
}
*numberPassesPtr = numberPasses;
}
- // FIXME: Also need to check for sRGB ( https://bug.skia.org/3471 ).
+ SkColorProfileType profileType = kLinear_SkColorProfileType;
+ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {
+ profileType = kSRGB_SkColorProfileType;
+ }
if (imageInfo) {
- *imageInfo = SkImageInfo::Make(origWidth, origHeight, colorType, alphaType);
+ *imageInfo = SkImageInfo::Make(origWidth, origHeight, colorType, alphaType, profileType);
}
autoClean.detach();
if (png_ptrp) {