mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-02 20:04:15 +01:00
wrlib: light changes to the code for ImageMagick
- changed header used for MagickWand to the one specified in the online documentation - changed a comparison to 'MagickTrue' because its value does not allow a compiler optimisation that would be expected in present case - fixed potential crash, if loading with Magick fails it could return a pointer to a de-allocated area Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
f17ec34cce
commit
9a0c3ab737
@@ -21,9 +21,8 @@
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include <wand/magick_wand.h>
|
||||
#include <wand/MagickWand.h>
|
||||
|
||||
#include "wraster.h"
|
||||
#include "imgformat.h"
|
||||
@@ -67,14 +66,15 @@ RImage *RLoadMagick(const char *file_name)
|
||||
}
|
||||
|
||||
ptr = image->data;
|
||||
if (hasAlfa == MagickTrue)
|
||||
mrc = MagickExportImagePixels(m_wand, 0, 0, (size_t)w, (size_t)h, "RGBA", CharPixel, ptr);
|
||||
else
|
||||
if (hasAlfa == MagickFalse)
|
||||
mrc = MagickExportImagePixels(m_wand, 0, 0, (size_t)w, (size_t)h, "RGB", CharPixel, ptr);
|
||||
else
|
||||
mrc = MagickExportImagePixels(m_wand, 0, 0, (size_t)w, (size_t)h, "RGBA", CharPixel, ptr);
|
||||
|
||||
if (mrc == MagickFalse) {
|
||||
RErrorCode = RERR_BADIMAGEFILE;
|
||||
RReleaseImage(image);
|
||||
image = NULL;
|
||||
goto bye;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user