зеркало из https://github.com/mozilla/gecko-dev.git
Bug 489133 - Handle bad cHRM chunks in PNGs. r=joe
This commit is contained in:
Родитель
780d2ffe8c
Коммит
dcd15d3bce
|
@ -520,7 +520,10 @@ qcms_profile* qcms_profile_create_rgb_with_gamma(
|
|||
return NO_MEM_PROFILE;
|
||||
|
||||
//XXX: should store the whitepoint
|
||||
set_rgb_colorants(profile, white_point, primaries);
|
||||
if (!set_rgb_colorants(profile, white_point, primaries)) {
|
||||
qcms_profile_fini(profile);
|
||||
return INVALID_PROFILE;
|
||||
}
|
||||
|
||||
profile->redTRC = curve_from_gamma(gamma);
|
||||
profile->blueTRC = curve_from_gamma(gamma);
|
||||
|
@ -546,7 +549,10 @@ qcms_profile* qcms_profile_create_rgb_with_table(
|
|||
return NO_MEM_PROFILE;
|
||||
|
||||
//XXX: should store the whitepoint
|
||||
set_rgb_colorants(profile, white_point, primaries);
|
||||
if (!set_rgb_colorants(profile, white_point, primaries)) {
|
||||
qcms_profile_fini(profile);
|
||||
return INVALID_PROFILE;
|
||||
}
|
||||
|
||||
profile->redTRC = curve_from_table(table, num_entries);
|
||||
profile->blueTRC = curve_from_table(table, num_entries);
|
||||
|
|
|
@ -139,4 +139,4 @@ static inline s15Fixed16Number double_to_s15Fixed16Number(double v)
|
|||
}
|
||||
|
||||
void precache_release(struct precache_output *p);
|
||||
void set_rgb_colorants(qcms_profile *profile, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries);
|
||||
qcms_bool set_rgb_colorants(qcms_profile *profile, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries);
|
||||
|
|
|
@ -522,12 +522,15 @@ static struct matrix adapt_matrix_to_D50(struct matrix r, qcms_CIE_xyY source_wh
|
|||
return matrix_multiply(Bradford, r);
|
||||
}
|
||||
|
||||
void set_rgb_colorants(qcms_profile *profile, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries)
|
||||
qcms_bool set_rgb_colorants(qcms_profile *profile, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries)
|
||||
{
|
||||
struct matrix colorants;
|
||||
colorants = build_RGB_to_XYZ_transfer_matrix(white_point, primaries);
|
||||
colorants = adapt_matrix_to_D50(colorants, white_point);
|
||||
|
||||
if (colorants.invalid)
|
||||
return false;
|
||||
|
||||
/* note: there's a transpose type of operation going on here */
|
||||
profile->redColorant.X = double_to_s15Fixed16Number(colorants.m[0][0]);
|
||||
profile->redColorant.Y = double_to_s15Fixed16Number(colorants.m[1][0]);
|
||||
|
@ -540,6 +543,8 @@ void set_rgb_colorants(qcms_profile *profile, qcms_CIE_xyY white_point, qcms_CIE
|
|||
profile->blueColorant.X = double_to_s15Fixed16Number(colorants.m[0][2]);
|
||||
profile->blueColorant.Y = double_to_s15Fixed16Number(colorants.m[1][2]);
|
||||
profile->blueColorant.Z = double_to_s15Fixed16Number(colorants.m[2][2]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint16_t *invert_lut(uint16_t *table, int length)
|
||||
|
|
Загрузка…
Ссылка в новой задаче