Bug 1555329 - Fix BGRA support with ICCv4 QCMS profiles. r=miko

Differential Revision: https://phabricator.services.mozilla.com/D33004
This commit is contained in:
Andrew Osmond 2019-05-29 08:58:33 -04:00
Родитель 1ffb741e7d
Коммит d8f7e96b8d
1 изменённых файлов: 12 добавлений и 5 удалений

Просмотреть файл

@ -714,12 +714,16 @@ static void qcms_transform_data_tetra_clut_template(const qcms_transform *transf
} }
} }
static void qcms_transform_data_tetra_clut_rgb(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) {
qcms_transform_data_tetra_clut_template<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX>(transform, src, dest, length);
}
static void qcms_transform_data_tetra_clut_rgba(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) { static void qcms_transform_data_tetra_clut_rgba(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) {
qcms_transform_data_tetra_clut_template<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX, RGBA_A_INDEX>(transform, src, dest, length); qcms_transform_data_tetra_clut_template<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX, RGBA_A_INDEX>(transform, src, dest, length);
} }
static void qcms_transform_data_tetra_clut(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) { static void qcms_transform_data_tetra_clut_bgra(const qcms_transform *transform, const unsigned char *src, unsigned char *dest, size_t length) {
qcms_transform_data_tetra_clut_template<RGBA_R_INDEX, RGBA_G_INDEX, RGBA_B_INDEX>(transform, src, dest, length); qcms_transform_data_tetra_clut_template<BGRA_R_INDEX, BGRA_G_INDEX, BGRA_B_INDEX, BGRA_A_INDEX>(transform, src, dest, length);
} }
template <size_t kRIndex, size_t kGIndex, size_t kBIndex, size_t kAIndex = NO_A_INDEX> template <size_t kRIndex, size_t kGIndex, size_t kBIndex, size_t kAIndex = NO_A_INDEX>
@ -1101,9 +1105,12 @@ qcms_transform* qcms_transform_precacheLUT_float(qcms_transform *transform, qcms
transform->grid_size = samples; transform->grid_size = samples;
if (in_type == QCMS_DATA_RGBA_8) { if (in_type == QCMS_DATA_RGBA_8) {
transform->transform_fn = qcms_transform_data_tetra_clut_rgba; transform->transform_fn = qcms_transform_data_tetra_clut_rgba;
} else { } else if (in_type == QCMS_DATA_BGRA_8) {
transform->transform_fn = qcms_transform_data_tetra_clut; transform->transform_fn = qcms_transform_data_tetra_clut_bgra;
} else if (in_type == QCMS_DATA_RGB_8) {
transform->transform_fn = qcms_transform_data_tetra_clut_rgb;
} }
assert(transform->transform_fn);
} }
} }
@ -1162,7 +1169,7 @@ qcms_transform* qcms_transform_create(
// This precache assumes RGB_SIGNATURE (fails on GRAY_SIGNATURE, for instance) // This precache assumes RGB_SIGNATURE (fails on GRAY_SIGNATURE, for instance)
if (qcms_supports_iccv4 && if (qcms_supports_iccv4 &&
(in_type == QCMS_DATA_RGB_8 || in_type == QCMS_DATA_RGBA_8) && (in_type == QCMS_DATA_RGB_8 || in_type == QCMS_DATA_RGBA_8 || in_type == QCMS_DATA_BGRA_8) &&
(in->A2B0 || out->B2A0 || in->mAB || out->mAB)) (in->A2B0 || out->B2A0 || in->mAB || out->mAB))
{ {
// Precache the transformation to a CLUT 33x33x33 in size. // Precache the transformation to a CLUT 33x33x33 in size.