mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
kimgio: verify the image color space earlier in jp2 plugin
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
a0afe27554
commit
d598c3cccf
1 changed files with 9 additions and 9 deletions
|
@ -179,15 +179,6 @@ bool JP2Handler::read(QImage *image)
|
|||
return false;
|
||||
}
|
||||
|
||||
*image = QImage(ojimage->comps->w, ojimage->comps->h, QImage::Format_ARGB32);
|
||||
if (Q_UNLIKELY(image->isNull())) {
|
||||
kWarning() << "Could not create image";
|
||||
opj_destroy_codec(ojcodec);
|
||||
opj_stream_destroy(ojstream);
|
||||
opj_image_destroy(ojimage);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (ojimage->color_space) {
|
||||
case OPJ_CLRSPC_UNKNOWN:
|
||||
case OPJ_CLRSPC_UNSPECIFIED: {
|
||||
|
@ -210,6 +201,15 @@ bool JP2Handler::read(QImage *image)
|
|||
}
|
||||
}
|
||||
|
||||
*image = QImage(ojimage->comps->w, ojimage->comps->h, QImage::Format_ARGB32);
|
||||
if (Q_UNLIKELY(image->isNull())) {
|
||||
kWarning() << "Could not create image";
|
||||
opj_destroy_codec(ojcodec);
|
||||
opj_stream_destroy(ojstream);
|
||||
opj_image_destroy(ojimage);
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (ojimage->numcomps) {
|
||||
case 4: {
|
||||
QRgb* imagebits = reinterpret_cast<QRgb*>(image->bits());
|
||||
|
|
Loading…
Add table
Reference in a new issue