mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
jxl: remove C-style casts
This commit is contained in:
parent
3790a89cd1
commit
8af9a0f9d9
@ -63,7 +63,7 @@ bool QJpegXLHandler::canRead(QIODevice *device)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
JxlSignature signature = JxlSignatureCheck((const uint8_t *)header.constData(), header.size());
|
JxlSignature signature = JxlSignatureCheck(reinterpret_cast<const uint8_t *>(header.constData()), header.size());
|
||||||
if (signature == JXL_SIG_CODESTREAM || signature == JXL_SIG_CONTAINER) {
|
if (signature == JXL_SIG_CODESTREAM || signature == JXL_SIG_CONTAINER) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ bool QJpegXLHandler::ensureDecoder()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
JxlSignature signature = JxlSignatureCheck((const uint8_t *)m_rawData.constData(), m_rawData.size());
|
JxlSignature signature = JxlSignatureCheck(reinterpret_cast<const uint8_t *>(m_rawData.constData()), m_rawData.size());
|
||||||
if (signature != JXL_SIG_CODESTREAM && signature != JXL_SIG_CONTAINER) {
|
if (signature != JXL_SIG_CODESTREAM && signature != JXL_SIG_CONTAINER) {
|
||||||
m_parseState = ParseJpegXLError;
|
m_parseState = ParseJpegXLError;
|
||||||
return false;
|
return false;
|
||||||
@ -139,7 +139,7 @@ bool QJpegXLHandler::ensureDecoder()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JxlDecoderSetInput(m_decoder, (const uint8_t *)m_rawData.constData(), m_rawData.size()) != JXL_DEC_SUCCESS) {
|
if (JxlDecoderSetInput(m_decoder, reinterpret_cast<const uint8_t *>(m_rawData.constData()), m_rawData.size()) != JXL_DEC_SUCCESS) {
|
||||||
qWarning("ERROR: JxlDecoderSetInput failed");
|
qWarning("ERROR: JxlDecoderSetInput failed");
|
||||||
m_parseState = ParseJpegXLError;
|
m_parseState = ParseJpegXLError;
|
||||||
return false;
|
return false;
|
||||||
@ -273,8 +273,12 @@ bool QJpegXLHandler::countALLFrames()
|
|||||||
size_t icc_size = 0;
|
size_t icc_size = 0;
|
||||||
if (JxlDecoderGetICCProfileSize(m_decoder, &m_input_pixel_format, JXL_COLOR_PROFILE_TARGET_DATA, &icc_size) == JXL_DEC_SUCCESS) {
|
if (JxlDecoderGetICCProfileSize(m_decoder, &m_input_pixel_format, JXL_COLOR_PROFILE_TARGET_DATA, &icc_size) == JXL_DEC_SUCCESS) {
|
||||||
if (icc_size > 0) {
|
if (icc_size > 0) {
|
||||||
QByteArray icc_data((int)icc_size, 0);
|
QByteArray icc_data(icc_size, 0);
|
||||||
if (JxlDecoderGetColorAsICCProfile(m_decoder, &m_input_pixel_format, JXL_COLOR_PROFILE_TARGET_DATA, (uint8_t *)icc_data.data(), icc_data.size())
|
if (JxlDecoderGetColorAsICCProfile(m_decoder,
|
||||||
|
&m_input_pixel_format,
|
||||||
|
JXL_COLOR_PROFILE_TARGET_DATA,
|
||||||
|
reinterpret_cast<uint8_t *>(icc_data.data()),
|
||||||
|
icc_data.size())
|
||||||
== JXL_DEC_SUCCESS) {
|
== JXL_DEC_SUCCESS) {
|
||||||
m_colorspace = QColorSpace::fromIccProfile(icc_data);
|
m_colorspace = QColorSpace::fromIccProfile(icc_data);
|
||||||
|
|
||||||
@ -609,7 +613,7 @@ bool QJpegXLHandler::write(const QImage &image)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!convert_color_profile && iccprofile.size() > 0) {
|
if (!convert_color_profile && iccprofile.size() > 0) {
|
||||||
status = JxlEncoderSetICCProfile(encoder, (const uint8_t *)iccprofile.constData(), iccprofile.size());
|
status = JxlEncoderSetICCProfile(encoder, reinterpret_cast<const uint8_t *>(iccprofile.constData()), iccprofile.size());
|
||||||
if (status != JXL_ENC_SUCCESS) {
|
if (status != JXL_ENC_SUCCESS) {
|
||||||
qWarning("JxlEncoderSetICCProfile failed!");
|
qWarning("JxlEncoderSetICCProfile failed!");
|
||||||
if (runner) {
|
if (runner) {
|
||||||
@ -648,7 +652,7 @@ bool QJpegXLHandler::write(const QImage &image)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (image.hasAlphaChannel() || ((save_depth == 8) && (xsize % 4 == 0))) {
|
if (image.hasAlphaChannel() || ((save_depth == 8) && (xsize % 4 == 0))) {
|
||||||
status = JxlEncoderAddImageFrame(encoder_options, &pixel_format, (void *)tmpimage.constBits(), buffer_size);
|
status = JxlEncoderAddImageFrame(encoder_options, &pixel_format, static_cast<const void *>(tmpimage.constBits()), buffer_size);
|
||||||
} else {
|
} else {
|
||||||
if (save_depth > 8) { // 16bit depth without alpha channel
|
if (save_depth > 8) { // 16bit depth without alpha channel
|
||||||
uint16_t *tmp_buffer = new (std::nothrow) uint16_t[3 * xsize * ysize];
|
uint16_t *tmp_buffer = new (std::nothrow) uint16_t[3 * xsize * ysize];
|
||||||
@ -679,7 +683,7 @@ bool QJpegXLHandler::write(const QImage &image)
|
|||||||
src_pixels += 2; // skipalpha
|
src_pixels += 2; // skipalpha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status = JxlEncoderAddImageFrame(encoder_options, &pixel_format, (void *)tmp_buffer, buffer_size);
|
status = JxlEncoderAddImageFrame(encoder_options, &pixel_format, static_cast<const void *>(tmp_buffer), buffer_size);
|
||||||
delete[] tmp_buffer;
|
delete[] tmp_buffer;
|
||||||
} else { // 8bit depth without alpha channel
|
} else { // 8bit depth without alpha channel
|
||||||
uchar *tmp_buffer8 = new (std::nothrow) uchar[3 * xsize * ysize];
|
uchar *tmp_buffer8 = new (std::nothrow) uchar[3 * xsize * ysize];
|
||||||
@ -698,7 +702,7 @@ bool QJpegXLHandler::write(const QImage &image)
|
|||||||
memcpy(dest_pixels8, tmpimage.constScanLine(y), rowbytes);
|
memcpy(dest_pixels8, tmpimage.constScanLine(y), rowbytes);
|
||||||
dest_pixels8 += rowbytes;
|
dest_pixels8 += rowbytes;
|
||||||
}
|
}
|
||||||
status = JxlEncoderAddImageFrame(encoder_options, &pixel_format, (void *)tmp_buffer8, buffer_size);
|
status = JxlEncoderAddImageFrame(encoder_options, &pixel_format, static_cast<const void *>(tmp_buffer8), buffer_size);
|
||||||
delete[] tmp_buffer8;
|
delete[] tmp_buffer8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -930,7 +934,7 @@ bool QJpegXLHandler::rewind()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JxlDecoderSetInput(m_decoder, (const uint8_t *)m_rawData.constData(), m_rawData.size()) != JXL_DEC_SUCCESS) {
|
if (JxlDecoderSetInput(m_decoder, reinterpret_cast<const uint8_t *>(m_rawData.constData()), m_rawData.size()) != JXL_DEC_SUCCESS) {
|
||||||
qWarning("ERROR: JxlDecoderSetInput failed");
|
qWarning("ERROR: JxlDecoderSetInput failed");
|
||||||
m_parseState = ParseJpegXLError;
|
m_parseState = ParseJpegXLError;
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user