2008-11-05 09:21:04 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
2006-04-08 17:10:47 -07:00
|
|
|
|
2006-10-27 20:02:23 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <tiffio.h>
|
|
|
|
|
2008-11-05 09:21:04 -08:00
|
|
|
#ifdef HAVE_EVIL
|
|
|
|
# include <Evil.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "evas_common.h"
|
|
|
|
#include "evas_private.h"
|
|
|
|
|
2010-04-08 15:55:54 -07:00
|
|
|
static int _evas_loader_tiff_log_dom = -1;
|
2010-04-08 10:39:01 -07:00
|
|
|
|
|
|
|
#ifdef ERR
|
|
|
|
# undef ERR
|
|
|
|
#endif
|
|
|
|
#define ERR(...) EINA_LOG_DOM_ERR(_evas_loader_tiff_log_dom, __VA_ARGS__)
|
|
|
|
|
|
|
|
#ifdef INF
|
|
|
|
# undef INF
|
|
|
|
#endif
|
|
|
|
#define INF(...) EINA_LOG_DOM_INFO(_evas_loader_tiff_log_dom, __VA_ARGS__)
|
|
|
|
|
2009-12-22 15:11:57 -08:00
|
|
|
static Eina_Bool evas_image_load_file_head_tiff(Image_Entry *ie, const char *file, const char *key, int *error) EINA_ARG_NONNULL(1, 2, 4);
|
|
|
|
static Eina_Bool evas_image_load_file_data_tiff(Image_Entry *ie, const char *file, const char *key, int *error) EINA_ARG_NONNULL(1, 2, 4);
|
2006-04-08 17:10:47 -07:00
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static Evas_Image_Load_Func evas_image_load_tiff_func =
|
2006-04-08 17:10:47 -07:00
|
|
|
{
|
2009-12-24 05:15:34 -08:00
|
|
|
EINA_TRUE,
|
2006-04-08 17:10:47 -07:00
|
|
|
evas_image_load_file_head_tiff,
|
|
|
|
evas_image_load_file_data_tiff
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct TIFFRGBAImage_Extra TIFFRGBAImage_Extra;
|
|
|
|
|
|
|
|
struct TIFFRGBAImage_Extra {
|
|
|
|
TIFFRGBAImage rgba;
|
|
|
|
tileContigRoutine put_contig;
|
|
|
|
tileSeparateRoutine put_separate;
|
2008-06-03 02:09:39 -07:00
|
|
|
Image_Entry *image;
|
2006-04-08 17:10:47 -07:00
|
|
|
char pper;
|
|
|
|
uint32 num_pixels;
|
|
|
|
uint32 py;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void put_contig_and_raster(TIFFRGBAImage *, uint32 *,
|
|
|
|
uint32, uint32, uint32, uint32, int32,
|
|
|
|
int32, unsigned char *);
|
|
|
|
static void put_separate_and_raster(TIFFRGBAImage *, uint32 *, uint32,
|
|
|
|
uint32, uint32, uint32, int32,
|
|
|
|
int32, unsigned char *,
|
|
|
|
unsigned char *, unsigned char *,
|
|
|
|
unsigned char *);
|
|
|
|
static void raster(TIFFRGBAImage_Extra * img, uint32 * raster, uint32 x,
|
|
|
|
uint32 y, uint32 w, uint32 h);
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
put_contig_and_raster(TIFFRGBAImage * img, uint32 * rast,
|
|
|
|
uint32 x, uint32 y, uint32 w, uint32 h,
|
|
|
|
int32 fromskew, int32 toskew, unsigned char *cp)
|
|
|
|
{
|
|
|
|
(*(((TIFFRGBAImage_Extra *) img)->put_contig)) (img, rast, x, y, w, h,
|
|
|
|
fromskew, toskew, cp);
|
|
|
|
raster((TIFFRGBAImage_Extra *) img, rast, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
put_separate_and_raster(TIFFRGBAImage * img, uint32 * rast,
|
|
|
|
uint32 x, uint32 y, uint32 w, uint32 h,
|
|
|
|
int32 fromskew, int32 toskew,
|
|
|
|
unsigned char *r, unsigned char *g, unsigned char *b,
|
|
|
|
unsigned char *a)
|
|
|
|
{
|
|
|
|
(*(((TIFFRGBAImage_Extra *) img)->put_separate))
|
|
|
|
(img, rast, x, y, w, h, fromskew, toskew, r, g, b, a);
|
|
|
|
raster((TIFFRGBAImage_Extra *) img, rast, x, y, w, h);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* needs orientation code */
|
|
|
|
|
|
|
|
static void
|
|
|
|
raster(TIFFRGBAImage_Extra * img, uint32 * rast,
|
|
|
|
uint32 x, uint32 y, uint32 w, uint32 h)
|
|
|
|
{
|
2010-09-18 16:07:31 -07:00
|
|
|
unsigned int image_width, image_height;
|
2006-04-08 17:10:47 -07:00
|
|
|
uint32 *pixel, pixel_value;
|
2010-09-18 16:07:31 -07:00
|
|
|
int i, dy, rast_offset;
|
2008-06-03 02:09:39 -07:00
|
|
|
DATA32 *buffer_pixel, *buffer = evas_cache_image_pixels(img->image);
|
2009-02-22 01:19:11 -08:00
|
|
|
int alpha_premult = 0;
|
2006-04-08 17:10:47 -07:00
|
|
|
|
2008-06-03 02:09:39 -07:00
|
|
|
image_width = img->image->w;
|
|
|
|
image_height = img->image->h;
|
2006-04-08 17:10:47 -07:00
|
|
|
|
2010-09-18 16:07:31 -07:00
|
|
|
dy = h > y ? -1 : ((int)y - (int)h);
|
2006-04-08 17:10:47 -07:00
|
|
|
|
|
|
|
/* rast seems to point to the beginning of the last strip processed */
|
|
|
|
/* so you need use negative offsets. Bizzare. Someone please check this */
|
|
|
|
/* I don't understand why, but that seems to be what's going on. */
|
|
|
|
/* libtiff needs better docs! */
|
|
|
|
|
2006-11-04 21:07:53 -08:00
|
|
|
if (img->rgba.alpha == EXTRASAMPLE_UNASSALPHA)
|
|
|
|
alpha_premult = 1;
|
2006-04-08 17:10:47 -07:00
|
|
|
for (i = y, rast_offset = 0; i > dy; i--, rast_offset--)
|
|
|
|
{
|
2010-09-18 16:07:31 -07:00
|
|
|
unsigned int j;
|
|
|
|
|
2006-04-08 17:10:47 -07:00
|
|
|
pixel = rast + (rast_offset * image_width);
|
|
|
|
buffer_pixel = buffer + ((((image_height - 1) - i) * image_width) + x);
|
|
|
|
|
|
|
|
for (j = 0; j < w; j++)
|
|
|
|
{
|
2010-09-18 16:07:31 -07:00
|
|
|
unsigned int a, r, g, b;
|
2006-04-08 17:10:47 -07:00
|
|
|
|
|
|
|
pixel_value = (*(pixel++));
|
|
|
|
a = TIFFGetA(pixel_value);
|
|
|
|
r = TIFFGetR(pixel_value);
|
|
|
|
g = TIFFGetG(pixel_value);
|
|
|
|
b = TIFFGetB(pixel_value);
|
2006-09-30 03:21:23 -07:00
|
|
|
if (!alpha_premult && (a < 255))
|
2006-04-08 17:10:47 -07:00
|
|
|
{
|
2006-09-30 03:21:23 -07:00
|
|
|
r = (r * (a + 1)) >> 8;
|
|
|
|
g = (g * (a + 1)) >> 8;
|
|
|
|
b = (b * (a + 1)) >> 8;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
2010-06-07 22:39:46 -07:00
|
|
|
(*(buffer_pixel++)) = ARGB_JOIN(a, r, g, b);
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-22 15:11:57 -08:00
|
|
|
static Eina_Bool
|
|
|
|
evas_image_load_file_head_tiff(Image_Entry *ie, const char *file, const char *key __UNUSED__, int *error)
|
2006-04-08 17:10:47 -07:00
|
|
|
{
|
|
|
|
char txt[1024];
|
|
|
|
TIFFRGBAImage tiff_image;
|
|
|
|
TIFF *tif = NULL;
|
|
|
|
FILE *ffile;
|
|
|
|
int fd;
|
|
|
|
uint16 magic_number;
|
|
|
|
|
|
|
|
ffile = fopen(file, "rb");
|
|
|
|
if (!ffile)
|
2009-12-22 15:11:57 -08:00
|
|
|
{
|
|
|
|
*error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2006-04-08 17:10:47 -07:00
|
|
|
|
2007-10-28 03:08:32 -07:00
|
|
|
if (fread(&magic_number, sizeof(uint16), 1, ffile) != 1)
|
|
|
|
{
|
|
|
|
fclose(ffile);
|
2010-09-18 18:14:56 -07:00
|
|
|
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
|
2009-12-22 15:11:57 -08:00
|
|
|
return EINA_FALSE;
|
2007-10-28 03:08:32 -07:00
|
|
|
}
|
2006-04-08 17:10:47 -07:00
|
|
|
/* Apparently rewind(f) isn't sufficient */
|
2010-09-18 18:14:56 -07:00
|
|
|
fseek(ffile, 0, SEEK_SET);
|
2006-04-08 17:10:47 -07:00
|
|
|
|
|
|
|
if ((magic_number != TIFF_BIGENDIAN) /* Checks if actually tiff file */
|
|
|
|
&& (magic_number != TIFF_LITTLEENDIAN))
|
|
|
|
{
|
|
|
|
fclose(ffile);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
|
|
|
|
return EINA_FALSE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fd = fileno(ffile);
|
|
|
|
fd = dup(fd);
|
|
|
|
lseek(fd, (long)0, SEEK_SET);
|
|
|
|
fclose(ffile);
|
|
|
|
|
|
|
|
tif = TIFFFdOpen(fd, file, "r");
|
|
|
|
if (!tif)
|
2009-12-22 15:11:57 -08:00
|
|
|
{
|
|
|
|
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2006-04-08 17:10:47 -07:00
|
|
|
|
2006-05-27 23:22:10 -07:00
|
|
|
strcpy(txt, "Evas Tiff loader: cannot be processed by libtiff");
|
2006-04-08 17:10:47 -07:00
|
|
|
if (!TIFFRGBAImageOK(tif, txt))
|
|
|
|
{
|
|
|
|
TIFFClose(tif);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
|
|
|
|
return EINA_FALSE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
2006-05-27 23:22:10 -07:00
|
|
|
strcpy(txt, "Evas Tiff loader: cannot begin reading tiff");
|
2008-02-05 04:00:19 -08:00
|
|
|
if (!TIFFRGBAImageBegin(& tiff_image, tif, 1, txt))
|
2006-04-08 17:10:47 -07:00
|
|
|
{
|
|
|
|
TIFFClose(tif);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
|
|
|
|
return EINA_FALSE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tiff_image.alpha != EXTRASAMPLE_UNSPECIFIED)
|
2008-06-03 02:09:39 -07:00
|
|
|
ie->flags.alpha = 1;
|
2006-11-04 21:07:53 -08:00
|
|
|
if ((tiff_image.width < 1) || (tiff_image.height < 1) ||
|
2009-09-16 02:48:05 -07:00
|
|
|
(tiff_image.width > IMG_MAX_SIZE) || (tiff_image.height > IMG_MAX_SIZE) ||
|
|
|
|
IMG_TOO_BIG(tiff_image.width, tiff_image.height))
|
2006-11-04 21:07:53 -08:00
|
|
|
{
|
|
|
|
TIFFClose(tif);
|
2009-12-22 15:11:57 -08:00
|
|
|
if (IMG_TOO_BIG(tiff_image.width, tiff_image.height))
|
|
|
|
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
|
|
else
|
|
|
|
*error = EVAS_LOAD_ERROR_GENERIC;
|
|
|
|
return EINA_FALSE;
|
2006-11-04 21:07:53 -08:00
|
|
|
}
|
2008-06-03 02:09:39 -07:00
|
|
|
ie->w = tiff_image.width;
|
|
|
|
ie->h = tiff_image.height;
|
2006-04-08 17:10:47 -07:00
|
|
|
|
2009-01-10 14:44:04 -08:00
|
|
|
TIFFRGBAImageEnd(&tiff_image);
|
2006-04-08 17:10:47 -07:00
|
|
|
TIFFClose(tif);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_NONE;
|
|
|
|
return EINA_TRUE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
|
2009-12-22 15:11:57 -08:00
|
|
|
static Eina_Bool
|
|
|
|
evas_image_load_file_data_tiff(Image_Entry *ie, const char *file, const char *key __UNUSED__, int *error)
|
2006-04-08 17:10:47 -07:00
|
|
|
{
|
|
|
|
char txt[1024];
|
|
|
|
TIFFRGBAImage_Extra rgba_image;
|
|
|
|
TIFF *tif = NULL;
|
|
|
|
FILE *ffile;
|
|
|
|
uint32 *rast = NULL;
|
|
|
|
uint32 num_pixels;
|
|
|
|
int fd;
|
|
|
|
uint16 magic_number;
|
2006-04-23 08:38:23 -07:00
|
|
|
|
2006-04-08 17:10:47 -07:00
|
|
|
ffile = fopen(file, "rb");
|
|
|
|
if (!ffile)
|
2009-12-22 15:11:57 -08:00
|
|
|
{
|
|
|
|
*error = EVAS_LOAD_ERROR_DOES_NOT_EXIST;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2006-04-08 17:10:47 -07:00
|
|
|
|
2010-09-18 16:39:30 -07:00
|
|
|
if (fread(&magic_number, sizeof(uint16), 1, ffile) != 1)
|
|
|
|
{
|
|
|
|
fclose(ffile);
|
|
|
|
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2006-04-08 17:10:47 -07:00
|
|
|
/* Apparently rewind(f) isn't sufficient */
|
|
|
|
fseek(ffile, (long)0, SEEK_SET);
|
|
|
|
|
|
|
|
if ((magic_number != TIFF_BIGENDIAN) /* Checks if actually tiff file */
|
|
|
|
&& (magic_number != TIFF_LITTLEENDIAN))
|
|
|
|
{
|
|
|
|
fclose(ffile);
|
2010-09-18 16:39:30 -07:00
|
|
|
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
|
2009-12-22 15:11:57 -08:00
|
|
|
return EINA_FALSE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fd = fileno(ffile);
|
|
|
|
fd = dup(fd);
|
|
|
|
lseek(fd, (long)0, SEEK_SET);
|
|
|
|
fclose(ffile);
|
|
|
|
|
|
|
|
tif = TIFFFdOpen(fd, file, "r");
|
|
|
|
if (!tif)
|
2009-12-22 15:11:57 -08:00
|
|
|
{
|
|
|
|
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
2006-04-08 17:10:47 -07:00
|
|
|
|
2006-05-27 23:22:10 -07:00
|
|
|
strcpy(txt, "Evas Tiff loader: cannot be processed by libtiff");
|
2006-04-08 17:10:47 -07:00
|
|
|
if (!TIFFRGBAImageOK(tif, txt))
|
|
|
|
{
|
|
|
|
TIFFClose(tif);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
|
|
|
|
return EINA_FALSE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
2006-05-27 23:22:10 -07:00
|
|
|
strcpy(txt, "Evas Tiff loader: cannot begin reading tiff");
|
2006-04-08 17:10:47 -07:00
|
|
|
if (!TIFFRGBAImageBegin((TIFFRGBAImage *) & rgba_image, tif, 0, txt))
|
|
|
|
{
|
|
|
|
TIFFClose(tif);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
|
|
|
|
return EINA_FALSE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
2008-06-03 02:09:39 -07:00
|
|
|
rgba_image.image = ie;
|
2006-04-08 17:10:47 -07:00
|
|
|
|
|
|
|
if (rgba_image.rgba.alpha != EXTRASAMPLE_UNSPECIFIED)
|
2008-06-03 02:09:39 -07:00
|
|
|
ie->flags.alpha = 1;
|
|
|
|
if ((rgba_image.rgba.width != ie->w) ||
|
|
|
|
(rgba_image.rgba.height != ie->h))
|
2006-11-04 21:07:53 -08:00
|
|
|
{
|
|
|
|
TIFFClose(tif);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
|
|
return EINA_FALSE;
|
2006-11-04 21:07:53 -08:00
|
|
|
}
|
2006-04-08 17:10:47 -07:00
|
|
|
|
2008-06-03 02:09:39 -07:00
|
|
|
evas_cache_image_surface_alloc(ie, rgba_image.rgba.width, rgba_image.rgba.height);
|
|
|
|
if (!evas_cache_image_pixels(ie))
|
2006-04-08 17:10:47 -07:00
|
|
|
{
|
|
|
|
TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image);
|
|
|
|
TIFFClose(tif);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
|
|
return EINA_FALSE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
|
2008-06-03 02:09:39 -07:00
|
|
|
rgba_image.num_pixels = num_pixels = ie->w * ie->h;
|
2008-04-11 17:32:30 -07:00
|
|
|
|
2006-04-08 17:10:47 -07:00
|
|
|
rgba_image.pper = rgba_image.py = 0;
|
|
|
|
rast = (uint32 *) _TIFFmalloc(sizeof(uint32) * num_pixels);
|
|
|
|
|
|
|
|
if (!rast)
|
|
|
|
{
|
2009-10-22 09:39:20 -07:00
|
|
|
ERR("Evas Tiff loader: out of memory");
|
2009-12-22 15:11:57 -08:00
|
|
|
|
2009-09-21 09:08:51 -07:00
|
|
|
TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image);
|
|
|
|
TIFFClose(tif);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
|
|
|
|
return EINA_FALSE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
|
2010-08-21 06:52:25 -07:00
|
|
|
if (!rgba_image.rgba.put.any)
|
2006-04-08 17:10:47 -07:00
|
|
|
{
|
2009-10-22 09:39:20 -07:00
|
|
|
ERR("Evas Tiff loader: no put function");
|
2006-04-08 17:10:47 -07:00
|
|
|
|
|
|
|
_TIFFfree(rast);
|
|
|
|
TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image);
|
|
|
|
TIFFClose(tif);
|
|
|
|
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_GENERIC;
|
|
|
|
return EINA_FALSE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (rgba_image.rgba.isContig)
|
|
|
|
{
|
|
|
|
rgba_image.put_contig = rgba_image.rgba.put.contig;
|
|
|
|
rgba_image.rgba.put.contig = put_contig_and_raster;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rgba_image.put_separate = rgba_image.rgba.put.separate;
|
|
|
|
rgba_image.rgba.put.separate = put_separate_and_raster;
|
|
|
|
}
|
|
|
|
}
|
2008-04-11 17:32:30 -07:00
|
|
|
|
2006-04-08 17:10:47 -07:00
|
|
|
/* if (rgba_image.rgba.samplesperpixel == 8)*/
|
|
|
|
if (rgba_image.rgba.bitspersample == 8)
|
|
|
|
{
|
2008-02-05 04:00:19 -08:00
|
|
|
if (!TIFFRGBAImageGet((TIFFRGBAImage *) &rgba_image, rast,
|
2006-04-08 17:10:47 -07:00
|
|
|
rgba_image.rgba.width, rgba_image.rgba.height))
|
|
|
|
{
|
|
|
|
_TIFFfree(rast);
|
|
|
|
TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image);
|
|
|
|
TIFFClose(tif);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_CORRUPT_FILE;
|
|
|
|
return EINA_FALSE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-10-22 09:39:20 -07:00
|
|
|
INF("channel bits == %i", (int)rgba_image.rgba.samplesperpixel);
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
_TIFFfree(rast);
|
|
|
|
|
|
|
|
TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image);
|
|
|
|
|
|
|
|
TIFFClose(tif);
|
|
|
|
|
2008-06-03 02:09:39 -07:00
|
|
|
evas_common_image_set_alpha_sparse(ie);
|
2009-12-22 15:11:57 -08:00
|
|
|
*error = EVAS_LOAD_ERROR_NONE;
|
|
|
|
return EINA_TRUE;
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static int
|
2006-09-06 00:28:46 -07:00
|
|
|
module_open(Evas_Module *em)
|
2006-04-08 17:10:47 -07:00
|
|
|
{
|
|
|
|
if (!em) return 0;
|
2010-04-08 10:39:01 -07:00
|
|
|
_evas_loader_tiff_log_dom = eina_log_domain_register("EvasLoaderTiff", EVAS_DEFAULT_LOG_COLOR);
|
|
|
|
if (_evas_loader_tiff_log_dom < 0)
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Impossible to create a log domain for the LoaderTiff loader.\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2006-04-08 17:10:47 -07:00
|
|
|
em->functions = (void *)(&evas_image_load_tiff_func);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static void
|
cleanup: fix some "unused" errors from -Wextra.
As we're heading for a release we better remove as much errors as
possible and as the first step I'm removing warnings due unused
parameters, variables and functions. These tend to pollute real errors
spotted by -Wall and clang/llvm.
This does not fixes all, just the clear that could be set to
__UNUSED__, particularly to do (and I'd like some help from the
authors):
* src/lib/engines/common/evas_font_{draw,query}.c (tasn):
intl_props is just used while doing BIDI, but also used in other
#ifdef blocks :-/
* evas_map_* (raster):
huge amount of warnings, code is quite confusing and thus I'm not
touching it. I have no idea whenever the commented blocks or extra
parameters are intended to be used or no.
* src/modules/engines/fbevas_fb_main.c (raster?):
is fb_setvt() to be used? If not do you mind removing it?
* src/modules/engines/gl_{common,x11} (raster):
huge amount of warnings, code is quite nested and full of #ifdefs
that does not help to give a clear picture of what's going on.
* src/bin/evas_cserve_main.c (raster):
I could have ignored most of the errors, but is the code correct? I
mean, there is no unload of images being applied. If you confirm
none of those warnings are harmful I can flag them as unused.
* src/lib/engines/common_8 (dottedmag):
lots of unused functions that were acquired from common_16, they
are unused and if they will not, then they should be removed.
SVN revision: 52421
2010-09-18 12:17:41 -07:00
|
|
|
module_close(Evas_Module *em __UNUSED__)
|
2006-04-08 17:10:47 -07:00
|
|
|
{
|
2010-04-08 10:39:01 -07:00
|
|
|
eina_log_domain_unregister(_evas_loader_tiff_log_dom);
|
2006-04-08 17:10:47 -07:00
|
|
|
}
|
|
|
|
|
2009-06-16 06:01:36 -07:00
|
|
|
static Evas_Module_Api evas_modapi =
|
2006-04-08 17:10:47 -07:00
|
|
|
{
|
|
|
|
EVAS_MODULE_API_VERSION,
|
2009-06-16 06:01:36 -07:00
|
|
|
"tiff",
|
|
|
|
"none",
|
|
|
|
{
|
|
|
|
module_open,
|
|
|
|
module_close
|
|
|
|
}
|
2006-04-08 17:10:47 -07:00
|
|
|
};
|
2009-06-16 06:01:36 -07:00
|
|
|
|
|
|
|
EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_IMAGE_LOADER, image_loader, tiff);
|
|
|
|
|
|
|
|
#ifndef EVAS_STATIC_BUILD_TIFF
|
|
|
|
EVAS_EINA_MODULE_DEFINE(image_loader, tiff);
|
|
|
|
#endif
|