rgba_s3tc_dxt2 = 15, [[DirectDraw DXT2 format with premultiplied RGBA. Not supported by OpenGL itself. @since 1.11.]]
rgba_s3tc_dxt3 = 16, [[OpenGL COMPRESSED_RGBA_S3TC_DXT3_EXT format with RGBA. @since 1.11.]]
rgba_s3tc_dxt4 = 17, [[DirectDraw DXT4 format with premultiplied RGBA. Not supported by OpenGL itself. @since 1.11.]]
- rgba_s3tc_dxt5 = 18 [[OpenGL COMPRESSED_RGBA_S3TC_DXT5_EXT format with RGBA. @since 1.11.]]
+ rgba_s3tc_dxt5 = 18, [[OpenGL COMPRESSED_RGBA_S3TC_DXT5_EXT format with RGBA. @since 1.11.]]
+ palette
}
enum Efl.Gfx.Render_Op {
unsigned char l, r, t, b;
} borders;
+ struct
+ {
+ unsigned char red;
+ unsigned char green;
+ unsigned char blue;
+ unsigned char alpha;
+ } palette[256];
+
const Emile_Colorspace *cspaces;
Emile_Colorspace cspace;
Emile_Image_Encoding encoding;
+ int num_palette;
+
unsigned int w;
unsigned int h;
unsigned int row_stride;
int scale_down_by;
Eina_Bool orientation;
+ Eina_Bool can_load_colormap;
};
// FIXME: should we set region at load time, instead of head time
#define EVAS_COLORSPACE_RGBA_S3TC_DXT3 EFL_GFX_COLORSPACE_RGBA_S3TC_DXT3
#define EVAS_COLORSPACE_RGBA_S3TC_DXT4 EFL_GFX_COLORSPACE_RGBA_S3TC_DXT4
#define EVAS_COLORSPACE_RGBA_S3TC_DXT5 EFL_GFX_COLORSPACE_RGBA_S3TC_DXT5
+#define EVAS_COLORSPACE_PALETTE EFL_GFX_COLORSPACE_PALETTE
struct _Evas_Image_Load_Func
{
0,
0,
+ EINA_FALSE,
EINA_FALSE
},
EINA_FALSE
(EINA_DBL_EQ(lo->emile.dpi, 0.0)) &&
((lo->emile.w == 0) || (lo->emile.h == 0)) &&
((lo->emile.region.w == 0) || (lo->emile.region.h == 0)) &&
- (lo->emile.orientation == 0)
+ (lo->emile.orientation == 0) &&
+ (lo->emile.can_load_colormap == 0)
))
{
*plo = (Evas_Image_Load_Opts*) &prevent;
hkey[offset] = 'o';
offset += 1;
}
+ else
+ {
+ hkey[offset] = '/';
+ offset += 1;
+ hkey[offset] = 'x';
+ offset += 1;
+ }
+ if (lo->emile.can_load_colormap)
+ {
+ hkey[offset] = '/';
+ offset += 1;
+ hkey[offset] = 'o';
+ offset += 1;
+ }
+ else
+ {
+ hkey[offset] = '/';
+ offset += 1;
+ hkey[offset] = 'x';
+ offset += 1;
+ }
}
hkey[offset] = '\0';
int scale_hint;
} scale_load;
Eina_Bool orientation : 1;
+ Eina_Bool can_load_colormap : 1;
};
struct _Evas_Object_Image_Pixels
o->prev = eina_cow_alloc(evas_object_image_state_cow);
o->proxy_src_clip = EINA_TRUE;
+ if (!strcmp(obj->layer->evas->engine.module->definition->name, "wayland_egl"))
+ {
+ EINA_COW_LOAD_OPTS_WRITE_BEGIN(o, low)
+ low->can_load_colormap = EINA_TRUE;
+ EINA_COW_LOAD_OPTS_WRITE_END(o, low)
+ }
+
cspace = ENFN->image_colorspace_get(ENC, o->engine_data);
+
if (cspace != o->cur->cspace)
{
EINA_COW_IMAGE_STATE_WRITE_BEGIN(o, state_write)
lo->emile.scale_load.scale_hint = o->load_opts->scale_load.scale_hint;
lo->emile.orientation = o->load_opts->orientation;
lo->emile.degree = 0;
+ lo->emile.can_load_colormap = o->load_opts->can_load_colormap;
lo->skip_head = o->skip_head;
}
lo.emile.scale_load.scale_hint = o->load_opts->scale_load.scale_hint;
lo.emile.orientation = o->load_opts->orientation;
lo.emile.degree = 0;
+ lo.emile.can_load_colormap = o->load_opts->can_load_colormap;
lo.skip_head = o->skip_head;
o->engine_data = ENFN->image_mmap(ENC, o->cur->f, o->cur->key, &o->load_error, &lo);
case EVAS_COLORSPACE_ARGB8888:
case EVAS_COLORSPACE_AGRY88:
case EVAS_COLORSPACE_GRY8:
+ case EVAS_COLORSPACE_PALETTE:
// all good
break;
case EVAS_COLORSPACE_ETC1:
{
Evas_Image_Load_Func *evas_image_load_func = NULL;
Eina_Bool r = EINA_TRUE;
+ int i;
if (!evas_module_load(em)) goto load_error;
evas_image_load_func = em->functions;
if (property.cspaces) ie->cspaces = property.cspaces;
ie->flags.rotated = property.rotated;
ie->flags.flipped = property.flipped;
+ ie->num_palette = property.num_palette;
+
+ for (i = 0; i < ie->num_palette; i++)
+ {
+ ie->palette[i].red = property.palette[i].red;
+ ie->palette[i].green = property.palette[i].green;
+ ie->palette[i].blue = property.palette[i].blue;
+ ie->palette[i].alpha = property.palette[i].alpha;
+#if 0
+ ERR("[%d] %d %d %d %d", i,
+ ie->palette[i].red,
+ ie->palette[i].green,
+ ie->palette[i].blue,
+ ie->palette[i].alpha
+ );
+#endif
+ }
+
r = EINA_FALSE;
}
else
switch (cspace)
{
+ case EVAS_COLORSPACE_PALETTE:
case EVAS_COLORSPACE_GRY8: siz = w * h * sizeof(DATA8); break;
case EVAS_COLORSPACE_AGRY88: siz = w * h * sizeof(DATA16); break;
case EVAS_COLORSPACE_RGBA8_ETC2_EAC:
Evas_Image_Load_Func *loader;
} info;
+ struct
+ {
+ DATA8 red;
+ DATA8 green;
+ DATA8 blue;
+ DATA8 alpha;
+ } palette[256];
+
SLK(lock);
SLK(lock_cancel);
int connect_num;
int channel;
int load_error;
+ int num_palette;
};
struct _Engine_Image_Entry
evas_gl_common_image_alloc_ensure(im);
switch (cspace)
{
+ case EVAS_COLORSPACE_PALETTE:
case EVAS_COLORSPACE_ARGB8888:
evas_cache_image_colorspace(&im->im->cache_entry, cspace);
if (im->cs.data)
png_infop info_ptr = NULL;
png_uint_32 w32, h32;
int bit_depth, color_type, interlace_type;
+ int num_trans;
volatile char hasa;
volatile Eina_Bool r = EINA_FALSE;
+ png_colorp palette;
+ png_bytep trans;
opts = loader->opts;
f = loader->f;
case PNG_COLOR_TYPE_GRAY:
if (!hasa) prop->cspaces = cspace_grey;
break;
+ case PNG_COLOR_TYPE_PALETTE:
+ if (!opts->emile.can_load_colormap) break;
+ if (png_get_PLTE(png_ptr, info_ptr, &palette, &prop->num_palette)
+ != PNG_INFO_PLTE)
+ {
+ *error = EVAS_LOAD_ERROR_GENERIC;
+ goto close_file;
+ }
+ int i;
+ for (i = 0; i < prop->num_palette; i++)
+ {
+ prop->palette[i].red = palette[i].red;
+ prop->palette[i].green = palette[i].green;
+ prop->palette[i].blue = palette[i].blue;
+ prop->palette[i].alpha = 0xff;
+ }
+ if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL)
+ == PNG_INFO_tRNS)
+ {
+ for (i = 0; i < num_trans; i++)
+ {
+ prop->palette[i].alpha = trans[i];
+ }
+ }
+
+ break;
}
if (hasa) prop->alpha = 1;
}
surface = pixels;
- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
+ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)
+ && !((color_type == PNG_COLOR_TYPE_PALETTE) && opts->emile.can_load_colormap))
{
/* expand transparency entry -> alpha channel if present */
png_set_tRNS_to_alpha(png_ptr);
/* Prep for transformations... ultimately we want ARGB */
/* expand palette -> RGB if necessary */
- if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png_ptr);
+ if ((color_type == PNG_COLOR_TYPE_PALETTE) && !opts->emile.can_load_colormap)
+ png_set_palette_to_rgb(png_ptr);
/* expand gray (w/reduced bits) -> 8-bit RGB if necessary */
if ((color_type == PNG_COLOR_TYPE_GRAY) ||
(color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
pack_offset = sizeof(DATA16);
break;
case EVAS_COLORSPACE_GRY8: pack_offset = sizeof(DATA8); break;
+ case EVAS_COLORSPACE_PALETTE: break;
default: abort();
}
+ if ((color_type == PNG_COLOR_TYPE_PALETTE) && opts->emile.can_load_colormap)
+ pack_offset = sizeof(DATA8);
+
passes = png_set_interlace_handling(png_ptr);
/* we read image line by line if scale down was set */