forked from enlightenment/efl
parent
4907a1f07e
commit
fe8b378c87
|
@ -14,9 +14,10 @@ struct _Evas_Engine_Info_XRender_Xcb
|
||||||
/* engine specific data & parameters it needs to set up */
|
/* engine specific data & parameters it needs to set up */
|
||||||
struct {
|
struct {
|
||||||
xcb_connection_t *conn;
|
xcb_connection_t *conn;
|
||||||
|
xcb_screen_t *screen;
|
||||||
xcb_drawable_t drawable;
|
xcb_drawable_t drawable;
|
||||||
xcb_pixmap_t mask;
|
xcb_pixmap_t mask;
|
||||||
xcb_visualid_t visual;
|
xcb_visualtype_t *visual;
|
||||||
unsigned char destination_alpha : 1;
|
unsigned char destination_alpha : 1;
|
||||||
} info;
|
} info;
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,7 +22,8 @@ struct _Render_Engine_Update
|
||||||
struct _Render_Engine
|
struct _Render_Engine
|
||||||
{
|
{
|
||||||
xcb_connection_t *conn;
|
xcb_connection_t *conn;
|
||||||
xcb_visualid_t vis;
|
xcb_screen_t *screen;
|
||||||
|
xcb_visualtype_t *visual;
|
||||||
xcb_drawable_t win;
|
xcb_drawable_t win;
|
||||||
xcb_pixmap_t mask;
|
xcb_pixmap_t mask;
|
||||||
unsigned char destination_alpha : 1;
|
unsigned char destination_alpha : 1;
|
||||||
|
@ -66,9 +67,9 @@ eng_info_free(Evas *e, void *info)
|
||||||
static void
|
static void
|
||||||
eng_setup(Evas *e, void *in)
|
eng_setup(Evas *e, void *in)
|
||||||
{
|
{
|
||||||
Render_Engine *re;
|
Render_Engine *re;
|
||||||
Evas_Engine_Info_XRender_Xcb *info;
|
Evas_Engine_Info_XRender_Xcb *info;
|
||||||
int resize = 1;
|
int resize = 1;
|
||||||
|
|
||||||
info = (Evas_Engine_Info_XRender_Xcb *)in;
|
info = (Evas_Engine_Info_XRender_Xcb *)in;
|
||||||
if (!e->engine.data.output)
|
if (!e->engine.data.output)
|
||||||
|
@ -98,13 +99,14 @@ eng_setup(Evas *e, void *in)
|
||||||
if (!e->engine.data.context) e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
if (!e->engine.data.context) e->engine.data.context = e->engine.func->context_new(e->engine.data.output);
|
||||||
|
|
||||||
re->conn = info->info.conn;
|
re->conn = info->info.conn;
|
||||||
re->vis = info->info.visual;
|
re->screen = info->info.screen;
|
||||||
|
re->visual = info->info.visual;
|
||||||
re->win = info->info.drawable;
|
re->win = info->info.drawable;
|
||||||
re->mask = info->info.mask;
|
re->mask = info->info.mask;
|
||||||
re->destination_alpha = info->info.destination_alpha;
|
re->destination_alpha = info->info.destination_alpha;
|
||||||
|
|
||||||
if (re->xcbinf) _xr_image_info_free(re->xcbinf);
|
if (re->xcbinf) _xr_image_info_free(re->xcbinf);
|
||||||
re->xcbinf = _xr_image_info_get(re->conn, re->win, re->vis);
|
re->xcbinf = _xr_image_info_get(re->conn, re->screen, re->win, re->visual);
|
||||||
|
|
||||||
if (re->output) _xr_render_surface_free(re->output);
|
if (re->output) _xr_render_surface_free(re->output);
|
||||||
if (re->mask_output) _xr_render_surface_free(re->mask_output);
|
if (re->mask_output) _xr_render_surface_free(re->mask_output);
|
||||||
|
@ -112,14 +114,10 @@ eng_setup(Evas *e, void *in)
|
||||||
re->output = _xr_render_surface_adopt(re->xcbinf, re->win, e->output.w, e->output.h, re->destination_alpha);
|
re->output = _xr_render_surface_adopt(re->xcbinf, re->win, e->output.w, e->output.h, re->destination_alpha);
|
||||||
else
|
else
|
||||||
re->output = _xr_render_surface_adopt(re->xcbinf, re->win, e->output.w, e->output.h, 0);
|
re->output = _xr_render_surface_adopt(re->xcbinf, re->win, e->output.w, e->output.h, 0);
|
||||||
if (re->mask) {
|
if (re->mask)
|
||||||
xcb_drawable_t draw;
|
re->mask_output = _xr_render_surface_format_adopt(re->xcbinf, re->mask,
|
||||||
|
|
||||||
draw = re->mask;
|
|
||||||
re->mask_output = _xr_render_surface_format_adopt(re->xcbinf, draw,
|
|
||||||
e->output.w, e->output.h,
|
e->output.w, e->output.h,
|
||||||
re->xcbinf->fmt1, 1);
|
re->xcbinf->fmt1, 1);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
re->mask_output = NULL;
|
re->mask_output = NULL;
|
||||||
if (resize)
|
if (resize)
|
||||||
|
@ -173,11 +171,8 @@ eng_output_resize(void *data, int w, int h)
|
||||||
re->output = _xr_render_surface_adopt(re->xcbinf, re->win, w, h, 0);
|
re->output = _xr_render_surface_adopt(re->xcbinf, re->win, w, h, 0);
|
||||||
if (re->mask_output)
|
if (re->mask_output)
|
||||||
{
|
{
|
||||||
xcb_drawable_t draw;
|
|
||||||
|
|
||||||
if (re->mask_output) _xr_render_surface_free(re->mask_output);
|
if (re->mask_output) _xr_render_surface_free(re->mask_output);
|
||||||
draw = re->mask;
|
re->mask_output = _xr_render_surface_format_adopt(re->xcbinf, re->mask,
|
||||||
re->mask_output = _xr_render_surface_format_adopt(re->xcbinf, draw,
|
|
||||||
w, h,
|
w, h,
|
||||||
re->xcbinf->fmt1, 1);
|
re->xcbinf->fmt1, 1);
|
||||||
}
|
}
|
||||||
|
@ -354,6 +349,114 @@ eng_polygon_draw(void *data, void *context, void *surface, void *polygon)
|
||||||
_xre_poly_draw((Xcb_Render_Surface *)surface, (RGBA_Draw_Context *)context, (RGBA_Polygon_Point *)polygon);
|
_xre_poly_draw((Xcb_Render_Surface *)surface, (RGBA_Draw_Context *)context, (RGBA_Polygon_Point *)polygon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_color_np_stop_insert(void *data, void *gradient, int r, int g, int b, int a, float pos)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_clear(void *data, void *gradient)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_fill_transform_set(void *data, void *gradient, void *transform)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_fill_spread_set
|
||||||
|
(void *data, void *gradient, int spread)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
eng_gradient2_linear_new(void *data)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_linear_free(void *data, void *linear_gradient)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_linear_fill_set(void *data, void *linear_gradient, int x0, int y0, int x1, int y1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
eng_gradient2_linear_is_opaque(void *data, void *context, void *linear_gradient, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
eng_gradient2_linear_is_visible(void *data, void *context, void *linear_gradient, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_linear_render_pre(void *data, void *context, void *linear_gradient)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_linear_render_post(void *data, void *linear_gradient)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_linear_draw(void *data, void *context, void *surface, void *linear_gradient, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
eng_gradient2_radial_new(void *data)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_radial_free(void *data, void *radial_gradient)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_radial_fill_set(void *data, void *radial_gradient, float cx, float cy, float rx, float ry)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
eng_gradient2_radial_is_opaque(void *data, void *context, void *radial_gradient, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
eng_gradient2_radial_is_visible(void *data, void *context, void *radial_gradient, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_radial_render_pre(void *data, void *context, void *radial_gradient)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_radial_render_post(void *data, void *radial_gradient)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
eng_gradient2_radial_draw(void *data, void *context, void *surface, void *radial_gradient, int x, int y, int w, int h)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
eng_gradient_new(void *data)
|
eng_gradient_new(void *data)
|
||||||
{
|
{
|
||||||
|
@ -504,7 +607,7 @@ eng_image_new_from_data(void *data, int w, int h, DATA32 *image_data, int alpha,
|
||||||
XR_Image *im;
|
XR_Image *im;
|
||||||
|
|
||||||
re = (Render_Engine *)data;
|
re = (Render_Engine *)data;
|
||||||
im = _xre_image_new_from_data(re->xcbinf, w, h, image_data);
|
im = _xre_image_new_from_data(re->xcbinf, w, h, image_data, alpha, cspace);
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,7 +618,7 @@ eng_image_new_from_copied_data(void *data, int w, int h, DATA32 *image_data, int
|
||||||
XR_Image *im;
|
XR_Image *im;
|
||||||
|
|
||||||
re = (Render_Engine *)data;
|
re = (Render_Engine *)data;
|
||||||
im = _xre_image_new_from_copied_data(re->xcbinf, w, h, image_data);
|
im = _xre_image_new_from_copied_data(re->xcbinf, w, h, image_data, alpha, cspace);
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,29 +640,26 @@ eng_image_size_get(void *data, void *image, int *w, int *h)
|
||||||
static void *
|
static void *
|
||||||
eng_image_size_set(void *data, void *image, int w, int h)
|
eng_image_size_set(void *data, void *image, int w, int h)
|
||||||
{
|
{
|
||||||
if (!image) return image;
|
XR_Image *im, *im_old;
|
||||||
|
|
||||||
|
if (!image) return NULL;
|
||||||
|
im_old = image;
|
||||||
|
if ((im_old->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
|
||||||
|
(im_old->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL))
|
||||||
|
w &= ~0x1;
|
||||||
|
if ((im_old) && (im_old->w == w) && (im_old->h == h))
|
||||||
|
return image;
|
||||||
if ((w <= 0) || (h <= 0))
|
if ((w <= 0) || (h <= 0))
|
||||||
{
|
{
|
||||||
_xre_image_free((XR_Image *)image);
|
_xre_image_free(im_old);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (((XR_Image *)image)->references > 1)
|
if (im_old)
|
||||||
{
|
{
|
||||||
XR_Image *old_image;
|
im = _xre_image_new_from_copied_data(im_old->xcbinf, w, h, NULL, im_old->alpha, im_old->cs.space);
|
||||||
|
_xre_image_free(im_old);
|
||||||
old_image = (XR_Image *)image;
|
return im;
|
||||||
image = _xre_image_copy((XR_Image *)old_image);
|
|
||||||
if (image)
|
|
||||||
{
|
|
||||||
((XR_Image *)image)->alpha = old_image->alpha;
|
|
||||||
_xre_image_free(old_image);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
image = old_image;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
_xre_image_dirty((XR_Image *)image);
|
|
||||||
_xre_image_resize((XR_Image *)image, w, h);
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -575,62 +675,109 @@ eng_image_dirty_region(void *data, void *image, int x, int y, int w, int h)
|
||||||
static void *
|
static void *
|
||||||
eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
|
eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data)
|
||||||
{
|
{
|
||||||
if (!image) return image;
|
XR_Image *im;
|
||||||
if (to_write)
|
|
||||||
{
|
|
||||||
if (((XR_Image *)image)->references > 1)
|
|
||||||
{
|
|
||||||
XR_Image *old_image;
|
|
||||||
|
|
||||||
old_image = (XR_Image *)image;
|
if (!image)
|
||||||
image = _xre_image_copy((XR_Image *)old_image);
|
{
|
||||||
if (image)
|
*image_data = NULL;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
im = (XR_Image *)image;
|
||||||
|
if (im->im)
|
||||||
|
evas_cache_image_load_data(&im->im->cache_entry);
|
||||||
|
switch (im->cs.space)
|
||||||
|
{
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
if (to_write)
|
||||||
|
{
|
||||||
|
if (im->references > 1)
|
||||||
{
|
{
|
||||||
((XR_Image *)image)->alpha = old_image->alpha;
|
XR_Image *im_old;
|
||||||
_xre_image_free(old_image);
|
|
||||||
|
im_old = im;
|
||||||
|
im = _xre_image_copy(im_old);
|
||||||
|
if (im)
|
||||||
|
_xre_image_free(im_old);
|
||||||
|
else
|
||||||
|
im = im_old;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
image = old_image;
|
_xre_image_dirty(im);
|
||||||
}
|
}
|
||||||
else
|
break;
|
||||||
_xre_image_dirty((XR_Image *)image);
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (image_data) *image_data = _xre_image_data_get((XR_Image *)image);
|
if (image_data) *image_data = _xre_image_data_get(im);
|
||||||
return image;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
eng_image_data_put(void *data, void *image, DATA32 *image_data)
|
||||||
{
|
{
|
||||||
if (!image) return image;
|
XR_Image *im;
|
||||||
if (_xre_image_data_get((XR_Image *)image) != image_data)
|
|
||||||
{
|
|
||||||
XR_Image *old_image;
|
|
||||||
|
|
||||||
old_image = (XR_Image *)image;
|
if (!image) return NULL;
|
||||||
image = _xre_image_data_find(image_data);
|
im = (XR_Image *)image;
|
||||||
if (image != old_image)
|
|
||||||
|
switch (im->cs.space)
|
||||||
|
{
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
if (_xre_image_data_get(im) != image_data)
|
||||||
{
|
{
|
||||||
if (!image)
|
XR_Image *im_old;
|
||||||
|
|
||||||
|
im_old = im;
|
||||||
|
image = _xre_image_data_find(image_data);
|
||||||
|
if (image != im_old)
|
||||||
{
|
{
|
||||||
image = _xre_image_new_from_data(old_image->xcbinf, old_image->w, old_image->h, image_data);
|
if (!image)
|
||||||
if (image)
|
|
||||||
{
|
{
|
||||||
((XR_Image *)image)->alpha = old_image->alpha;
|
image = _xre_image_new_from_data(im_old->xcbinf, im_old->w, im_old->h, image_data, im_old->alpha, EVAS_COLORSPACE_ARGB8888);
|
||||||
_xre_image_free(old_image);
|
if (image)
|
||||||
|
{
|
||||||
|
((XR_Image *)image)->alpha = im_old->alpha;
|
||||||
|
_xre_image_free(im_old);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
image = im_old;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
image = old_image;
|
{
|
||||||
|
_xre_image_free(im_old);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_xre_image_free(old_image);
|
_xre_image_free(image);
|
||||||
|
image = im_old;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
break;
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
if (_xre_image_data_get(im) != image_data)
|
||||||
{
|
{
|
||||||
_xre_image_free(image);
|
if (im->data)
|
||||||
|
{
|
||||||
|
if (im->free_data) free(im->data);
|
||||||
|
im->data = NULL;
|
||||||
|
}
|
||||||
|
if (im->cs.data)
|
||||||
|
{
|
||||||
|
if (!im->cs.no_free) free(im->cs.data);
|
||||||
|
}
|
||||||
|
im->cs.data = image_data;
|
||||||
|
_xre_image_dirty(im);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
@ -648,7 +795,7 @@ eng_image_data_preload_request(void *data, void *image, void *target)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eng_image_data_preload_cancel(void *data, void *image)
|
eng_image_data_preload_cancel(void *data, void *image, const void *target)
|
||||||
{
|
{
|
||||||
XR_Image *xim = image;
|
XR_Image *xim = image;
|
||||||
RGBA_Image *im;
|
RGBA_Image *im;
|
||||||
|
@ -662,28 +809,31 @@ eng_image_data_preload_cancel(void *data, void *image)
|
||||||
static void *
|
static void *
|
||||||
eng_image_alpha_set(void *data, void *image, int has_alpha)
|
eng_image_alpha_set(void *data, void *image, int has_alpha)
|
||||||
{
|
{
|
||||||
if (!image) return image;
|
XR_Image *im;
|
||||||
if (((((XR_Image *)image)->alpha) && (has_alpha)) ||
|
|
||||||
((!((XR_Image *)image)->alpha) && (!has_alpha)))
|
|
||||||
return image;
|
|
||||||
if (((XR_Image *)image)->references > 1)
|
|
||||||
{
|
|
||||||
XR_Image *old_image;
|
|
||||||
|
|
||||||
old_image = (XR_Image *)image;
|
im = (XR_Image *)image;
|
||||||
image = _xre_image_copy((XR_Image *)old_image);
|
if (!im) return im;
|
||||||
if (image)
|
if (im->cs.space != EVAS_COLORSPACE_ARGB8888) return im;
|
||||||
|
if (((im->alpha) && (has_alpha)) || ((!im->alpha) && (!has_alpha)))
|
||||||
|
return im;
|
||||||
|
if (im->references > 1)
|
||||||
|
{
|
||||||
|
XR_Image *old_im;
|
||||||
|
|
||||||
|
old_im = im;
|
||||||
|
im = _xre_image_copy(old_im);
|
||||||
|
if (im)
|
||||||
{
|
{
|
||||||
((XR_Image *)image)->alpha = old_image->alpha;
|
im->alpha = old_im->alpha;
|
||||||
_xre_image_free(old_image);
|
_xre_image_free(old_im);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
image = old_image;
|
im = old_im;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_xre_image_dirty((XR_Image *)image);
|
_xre_image_dirty(im);
|
||||||
_xre_image_alpha_set((XR_Image *)image, has_alpha);
|
_xre_image_alpha_set(im, has_alpha);
|
||||||
return image;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -739,12 +889,51 @@ eng_image_format_get(void *data, void *image)
|
||||||
static void
|
static void
|
||||||
eng_image_colorspace_set(void *data, void *image, int cspace)
|
eng_image_colorspace_set(void *data, void *image, int cspace)
|
||||||
{
|
{
|
||||||
|
XR_Image *im;
|
||||||
|
|
||||||
|
if (!image) return;
|
||||||
|
im = (XR_Image *)image;
|
||||||
|
if (im->cs.space == cspace) return;
|
||||||
|
|
||||||
|
if (im->im) evas_cache_image_drop(&im->im->cache_entry);
|
||||||
|
im->im = NULL;
|
||||||
|
|
||||||
|
switch (cspace)
|
||||||
|
{
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
if (im->cs.data)
|
||||||
|
{
|
||||||
|
if (!im->cs.no_free) free(im->cs.data);
|
||||||
|
im->cs.data = NULL;
|
||||||
|
im->cs.no_free = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
if ((im->free_data) && (im->data)) free(im->data);
|
||||||
|
im->data = NULL;
|
||||||
|
if (im->cs.data)
|
||||||
|
{
|
||||||
|
if (!im->cs.no_free) free(im->cs.data);
|
||||||
|
}
|
||||||
|
if (im->h > 0)
|
||||||
|
im->cs.data = calloc(1, im->h * sizeof(unsigned char *) * 2);
|
||||||
|
im->cs.no_free = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
im->cs.space = cspace;
|
||||||
|
_xre_image_dirty(im);
|
||||||
|
_xre_image_region_dirty(im, 0, 0, im->w, im->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
eng_image_colorspace_get(void *data, void *image)
|
eng_image_colorspace_get(void *data, void *image)
|
||||||
{
|
{
|
||||||
return EVAS_COLORSPACE_ARGB8888;
|
if (!image) return EVAS_COLORSPACE_ARGB8888;
|
||||||
|
return ((XR_Image *)image)->cs.space;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -790,14 +979,14 @@ eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y
|
||||||
|
|
||||||
re = (Render_Engine *)data;
|
re = (Render_Engine *)data;
|
||||||
|
|
||||||
|
_xr_render_surface_clips_set((Xcb_Render_Surface *)surface, (RGBA_Draw_Context *)context, x, y, w, h);
|
||||||
|
|
||||||
im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
|
im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
|
||||||
((Xcb_Render_Surface *)surface)->w,
|
((Xcb_Render_Surface *)surface)->w,
|
||||||
((Xcb_Render_Surface *)surface)->h,
|
((Xcb_Render_Surface *)surface)->h,
|
||||||
surface,
|
surface,
|
||||||
0, EVAS_COLORSPACE_ARGB8888);
|
0, EVAS_COLORSPACE_ARGB8888);
|
||||||
|
|
||||||
_xr_render_surface_clips_set((Xcb_Render_Surface *)surface, (RGBA_Draw_Context *)context, x, y, w, h);
|
|
||||||
|
|
||||||
evas_common_draw_context_font_ext_set(context,
|
evas_common_draw_context_font_ext_set(context,
|
||||||
re->xcbinf,
|
re->xcbinf,
|
||||||
_xre_font_surface_new,
|
_xre_font_surface_new,
|
||||||
|
@ -810,6 +999,8 @@ eng_font_draw(void *data, void *context, void *surface, void *font, int x, int y
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
evas_common_cpu_end_opt();
|
evas_common_cpu_end_opt();
|
||||||
|
|
||||||
|
evas_cache_image_drop(&im->cache_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* module advertising code */
|
/* module advertising code */
|
||||||
|
@ -839,6 +1030,28 @@ module_open(Evas_Module *em)
|
||||||
ORD(rectangle_draw);
|
ORD(rectangle_draw);
|
||||||
ORD(line_draw);
|
ORD(line_draw);
|
||||||
ORD(polygon_draw);
|
ORD(polygon_draw);
|
||||||
|
|
||||||
|
ORD(gradient2_color_np_stop_insert);
|
||||||
|
ORD(gradient2_clear);
|
||||||
|
ORD(gradient2_fill_transform_set);
|
||||||
|
ORD(gradient2_fill_spread_set);
|
||||||
|
ORD(gradient2_linear_new);
|
||||||
|
ORD(gradient2_linear_free);
|
||||||
|
ORD(gradient2_linear_fill_set);
|
||||||
|
ORD(gradient2_linear_is_opaque);
|
||||||
|
ORD(gradient2_linear_is_visible);
|
||||||
|
ORD(gradient2_linear_render_pre);
|
||||||
|
ORD(gradient2_linear_render_post);
|
||||||
|
ORD(gradient2_linear_draw);
|
||||||
|
ORD(gradient2_radial_new);
|
||||||
|
ORD(gradient2_radial_free);
|
||||||
|
ORD(gradient2_radial_fill_set);
|
||||||
|
ORD(gradient2_radial_is_opaque);
|
||||||
|
ORD(gradient2_radial_is_visible);
|
||||||
|
ORD(gradient2_radial_render_pre);
|
||||||
|
ORD(gradient2_radial_render_post);
|
||||||
|
ORD(gradient2_radial_draw);
|
||||||
|
|
||||||
ORD(gradient_new);
|
ORD(gradient_new);
|
||||||
ORD(gradient_free);
|
ORD(gradient_free);
|
||||||
ORD(gradient_color_stop_add);
|
ORD(gradient_color_stop_add);
|
||||||
|
|
|
@ -15,10 +15,11 @@ typedef struct _Xcb_Render_Surface Xcb_Render_Surface;
|
||||||
struct _Xcb_Image_Info
|
struct _Xcb_Image_Info
|
||||||
{
|
{
|
||||||
xcb_connection_t *conn;
|
xcb_connection_t *conn;
|
||||||
|
xcb_screen_t *screen;
|
||||||
xcb_drawable_t root;
|
xcb_drawable_t root;
|
||||||
xcb_drawable_t draw;
|
xcb_drawable_t draw;
|
||||||
int depth;
|
int depth;
|
||||||
xcb_visualid_t vis;
|
xcb_visualtype_t *visual;
|
||||||
int pool_mem;
|
int pool_mem;
|
||||||
Eina_List *pool;
|
Eina_List *pool;
|
||||||
unsigned char can_do_shm;
|
unsigned char can_do_shm;
|
||||||
|
@ -27,6 +28,7 @@ struct _Xcb_Image_Info
|
||||||
xcb_render_pictforminfo_t *fmt8;
|
xcb_render_pictforminfo_t *fmt8;
|
||||||
xcb_render_pictforminfo_t *fmt4;
|
xcb_render_pictforminfo_t *fmt4;
|
||||||
xcb_render_pictforminfo_t *fmt1;
|
xcb_render_pictforminfo_t *fmt1;
|
||||||
|
xcb_render_pictforminfo_t *fmtdef;
|
||||||
unsigned char mul_r;
|
unsigned char mul_r;
|
||||||
unsigned char mul_g;
|
unsigned char mul_g;
|
||||||
unsigned char mul_b;
|
unsigned char mul_b;
|
||||||
|
@ -63,7 +65,7 @@ struct _Xcb_Render_Surface
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ximage support calls (ximage vs xshmimage, cache etc.) */
|
/* ximage support calls (ximage vs xshmimage, cache etc.) */
|
||||||
Xcb_Image_Info *_xr_image_info_get(xcb_connection_t *conn, xcb_drawable_t draw, xcb_visualid_t vis);
|
Xcb_Image_Info *_xr_image_info_get(xcb_connection_t *conn, xcb_screen_t *screen, xcb_drawable_t draw, xcb_visualtype_t *visual);
|
||||||
void _xr_image_info_free(Xcb_Image_Info *xcbinf);
|
void _xr_image_info_free(Xcb_Image_Info *xcbinf);
|
||||||
void _xr_image_info_pool_flush(Xcb_Image_Info *xcbinf, int max_num, int max_mem);
|
void _xr_image_info_pool_flush(Xcb_Image_Info *xcbinf, int max_num, int max_mem);
|
||||||
Xcb_Image_Image *_xr_image_new(Xcb_Image_Info *xcbinf, int w, int h, int depth);
|
Xcb_Image_Image *_xr_image_new(Xcb_Image_Info *xcbinf, int w, int h, int depth);
|
||||||
|
@ -77,16 +79,16 @@ Xcb_Render_Surface *_xr_render_surface_format_adopt(Xcb_Image_Info *xcbinf, xcb_
|
||||||
void _xr_render_surface_free(Xcb_Render_Surface *rs);
|
void _xr_render_surface_free(Xcb_Render_Surface *rs);
|
||||||
void _xr_render_surface_repeat_set(Xcb_Render_Surface *rs, int repeat);
|
void _xr_render_surface_repeat_set(Xcb_Render_Surface *rs, int repeat);
|
||||||
void _xr_render_surface_solid_rectangle_set(Xcb_Render_Surface *rs, int r, int g, int b, int a, int x, int y, int w, int h);
|
void _xr_render_surface_solid_rectangle_set(Xcb_Render_Surface *rs, int r, int g, int b, int a, int x, int y, int w, int h);
|
||||||
void _xr_render_surface_argb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void *pixels, int x, int y, int w, int h);
|
void _xr_render_surface_argb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void *pixels, int x, int y, int w, int h, int ox, int oy);
|
||||||
void _xr_render_surface_rgb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void *pixels, int x, int y, int w, int h);
|
void _xr_render_surface_rgb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void *pixels, int x, int y, int w, int h, int ox, int oy);
|
||||||
void _xr_render_surface_clips_set(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, int rx, int ry, int rw, int rh);
|
void _xr_render_surface_clips_set(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, int rx, int ry, int rw, int rh);
|
||||||
void _xr_render_surface_composite(Xcb_Render_Surface *srs, Xcb_Render_Surface *drs, RGBA_Draw_Context *dc, int sx, int sy, int sw, int sh, int x, int y, int w, int h, int smooth);
|
void _xr_render_surface_composite(Xcb_Render_Surface *srs, Xcb_Render_Surface *drs, RGBA_Draw_Context *dc, int sx, int sy, int sw, int sh, int x, int y, int w, int h, int smooth);
|
||||||
void _xr_render_surface_copy(Xcb_Render_Surface *srs, Xcb_Render_Surface *drs, int sx, int sy, int x, int y, int w, int h);
|
void _xr_render_surface_copy(Xcb_Render_Surface *srs, Xcb_Render_Surface *drs, int sx, int sy, int x, int y, int w, int h);
|
||||||
void _xr_render_surface_rectangle_draw(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, int x, int y, int w, int h);
|
void _xr_render_surface_rectangle_draw(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, int x, int y, int w, int h);
|
||||||
void _xr_render_surface_line_draw(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, int x1, int y1, int x2, int y2);
|
void _xr_render_surface_line_draw(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, int x1, int y1, int x2, int y2);
|
||||||
void _xre_poly_draw(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points);
|
void _xre_poly_draw(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points);
|
||||||
|
|
||||||
|
|
||||||
typedef struct _XR_Image XR_Image;
|
typedef struct _XR_Image XR_Image;
|
||||||
|
|
||||||
struct _XR_Image
|
struct _XR_Image
|
||||||
|
@ -104,14 +106,19 @@ struct _XR_Image
|
||||||
const char *comment;
|
const char *comment;
|
||||||
Tilebuf *updates;
|
Tilebuf *updates;
|
||||||
RGBA_Image_Loadopts load_opts;
|
RGBA_Image_Loadopts load_opts;
|
||||||
|
struct {
|
||||||
|
int space;
|
||||||
|
void *data;
|
||||||
|
unsigned char no_free : 1;
|
||||||
|
} cs;
|
||||||
unsigned char alpha : 1;
|
unsigned char alpha : 1;
|
||||||
unsigned char dirty : 1;
|
unsigned char dirty : 1;
|
||||||
unsigned char free_data : 1;
|
unsigned char free_data : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
XR_Image *_xre_image_load(Xcb_Image_Info *xcbinf, const char *file, const char *key, Evas_Image_Load_Opts *lo);
|
XR_Image *_xre_image_load(Xcb_Image_Info *xcbinf, const char *file, const char *key, Evas_Image_Load_Opts *lo);
|
||||||
XR_Image *_xre_image_new_from_data(Xcb_Image_Info *xcbinf, int w, int h, void *data);
|
XR_Image *_xre_image_new_from_data(Xcb_Image_Info *xcbinf, int w, int h, void *data, int alpha, int cspace);
|
||||||
XR_Image *_xre_image_new_from_copied_data(Xcb_Image_Info *xcbinf, int w, int h, void *data);
|
XR_Image *_xre_image_new_from_copied_data(Xcb_Image_Info *xcbinf, int w, int h, void *data, int alpha, int cspace);
|
||||||
XR_Image *_xre_image_new(Xcb_Image_Info *xcbinf, int w, int h);
|
XR_Image *_xre_image_new(Xcb_Image_Info *xcbinf, int w, int h);
|
||||||
void _xre_image_resize(XR_Image *im, int w, int h);
|
void _xre_image_resize(XR_Image *im, int w, int h);
|
||||||
void _xre_image_free(XR_Image *im);
|
void _xre_image_free(XR_Image *im);
|
||||||
|
@ -160,7 +167,7 @@ struct _XR_Gradient
|
||||||
Xcb_Image_Info *xcbinf;
|
Xcb_Image_Info *xcbinf;
|
||||||
Xcb_Render_Surface *surface;
|
Xcb_Render_Surface *surface;
|
||||||
RGBA_Gradient *grad;
|
RGBA_Gradient *grad;
|
||||||
unsigned char changed;
|
unsigned char changed : 1;
|
||||||
int sw, sh;
|
int sw, sh;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -180,5 +187,5 @@ void _xre_gradient_offset_set(XR_Gradient *gr, float offset);
|
||||||
void _xre_gradient_direction_set(XR_Gradient *gr, int direction);
|
void _xre_gradient_direction_set(XR_Gradient *gr, int direction);
|
||||||
void _xre_gradient_type_set(XR_Gradient *gr, char *name, char *params);
|
void _xre_gradient_type_set(XR_Gradient *gr, char *name, char *params);
|
||||||
void _xre_gradient_draw(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, XR_Gradient *gr, int x, int y, int w, int h);
|
void _xre_gradient_draw(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, XR_Gradient *gr, int x, int y, int w, int h);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,19 +10,21 @@ _xre_font_surface_new(Xcb_Image_Info *xcbinf, RGBA_Font_Glyph *fg)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
char buf2[256];
|
char buf2[256];
|
||||||
|
uint32_t values[3];
|
||||||
XR_Font_Surface *fs;
|
XR_Font_Surface *fs;
|
||||||
DATA8 *data;
|
DATA8 *data;
|
||||||
int w, h, j;
|
Xcb_Image_Image *xcbim;
|
||||||
Xcb_Image_Image *xcim;
|
|
||||||
Eina_Hash *pool;
|
Eina_Hash *pool;
|
||||||
uint32_t mask;
|
uint32_t mask;
|
||||||
uint32_t values[3];
|
int w;
|
||||||
|
int h;
|
||||||
|
int pitch;
|
||||||
|
|
||||||
data = fg->glyph_out->bitmap.buffer;
|
data = fg->glyph_out->bitmap.buffer;
|
||||||
w = fg->glyph_out->bitmap.width;
|
w = fg->glyph_out->bitmap.width;
|
||||||
h = fg->glyph_out->bitmap.rows;
|
h = fg->glyph_out->bitmap.rows;
|
||||||
j = fg->glyph_out->bitmap.pitch;
|
pitch = fg->glyph_out->bitmap.pitch;
|
||||||
if (j < w) j = w;
|
if (pitch < w) pitch = w;
|
||||||
if ((w <= 0) || (h <= 0)) return NULL;
|
if ((w <= 0) || (h <= 0)) return NULL;
|
||||||
|
|
||||||
if (fg->ext_dat)
|
if (fg->ext_dat)
|
||||||
|
@ -67,18 +69,18 @@ _xre_font_surface_new(Xcb_Image_Info *xcbinf, RGBA_Font_Glyph *fg)
|
||||||
values[2] = 0;
|
values[2] = 0;
|
||||||
fs->pic = xcb_generate_id(xcbinf->conn);
|
fs->pic = xcb_generate_id(xcbinf->conn);
|
||||||
xcb_render_create_picture(xcbinf->conn, fs->pic, fs->draw, xcbinf->fmt8->id, mask, values);
|
xcb_render_create_picture(xcbinf->conn, fs->pic, fs->draw, xcbinf->fmt8->id, mask, values);
|
||||||
|
|
||||||
xcim = _xr_image_new(fs->xcbinf, w, h, xcbinf->fmt8->depth);
|
xcbim = _xr_image_new(fs->xcbinf, w, h, xcbinf->fmt8->depth);
|
||||||
if ((fg->glyph_out->bitmap.num_grays == 256) &&
|
if ((fg->glyph_out->bitmap.num_grays == 256) &&
|
||||||
(fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays))
|
(fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays))
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
DATA8 *p1, *p2;
|
DATA8 *p1, *p2;
|
||||||
|
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
p1 = data + (j * y);
|
p1 = data + (pitch * y);
|
||||||
p2 = ((DATA8 *)xcim->data) + (xcim->line_bytes * y);
|
p2 = ((DATA8 *)xcbim->data) + (xcbim->line_bytes * y);
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
{
|
{
|
||||||
*p2 = *p1;
|
*p2 = *p1;
|
||||||
|
@ -86,23 +88,23 @@ _xre_font_surface_new(Xcb_Image_Info *xcbinf, RGBA_Font_Glyph *fg)
|
||||||
p2++;
|
p2++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DATA8 *tmpbuf = NULL, *dp, *tp, bits;
|
DATA8 *tmpbuf = NULL, *dp, *tp, bits;
|
||||||
int bi, bj, end;
|
int bi, bj, end;
|
||||||
const DATA8 bitrepl[2] = {0x0, 0xff};
|
const DATA8 bitrepl[2] = {0x0, 0xff};
|
||||||
|
|
||||||
tmpbuf = alloca(w);
|
tmpbuf = alloca(w);
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
DATA8 *p1, *p2;
|
DATA8 *p1, *p2;
|
||||||
|
|
||||||
for (y = 0; y < h; y++)
|
for (y = 0; y < h; y++)
|
||||||
{
|
{
|
||||||
p1 = tmpbuf;
|
p1 = tmpbuf;
|
||||||
p2 = ((DATA8 *)xcim->data) + (xcim->line_bytes * y);
|
p2 = ((DATA8 *)xcbim->data) + (xcbim->line_bytes * y);
|
||||||
tp = tmpbuf;
|
tp = tmpbuf;
|
||||||
dp = data + (y * fg->glyph_out->bitmap.pitch);
|
dp = data + (y * fg->glyph_out->bitmap.pitch);
|
||||||
for (bi = 0; bi < w; bi += 8)
|
for (bi = 0; bi < w; bi += 8)
|
||||||
|
@ -126,7 +128,7 @@ _xre_font_surface_new(Xcb_Image_Info *xcbinf, RGBA_Font_Glyph *fg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_xr_image_put(xcim, fs->draw, 0, 0, w, h);
|
_xr_image_put(xcbim, fs->draw, 0, 0, w, h);
|
||||||
return fs;
|
return fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,9 +169,9 @@ _xre_font_surface_draw(Xcb_Image_Info *xcbinf, RGBA_Image *surface, RGBA_Draw_Co
|
||||||
int g;
|
int g;
|
||||||
int b;
|
int b;
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
fs = fg->ext_dat;
|
fs = fg->ext_dat;
|
||||||
if (!fs) return;
|
if (!fs || !fs->xcbinf || !dc || !dc->col.col) return;
|
||||||
target_surface = (Xcb_Render_Surface *)(surface->image.data);
|
target_surface = (Xcb_Render_Surface *)(surface->image.data);
|
||||||
a = (dc->col.col >> 24) & 0xff;
|
a = (dc->col.col >> 24) & 0xff;
|
||||||
r = (dc->col.col >> 16) & 0xff;
|
r = (dc->col.col >> 16) & 0xff;
|
||||||
|
@ -188,15 +190,15 @@ _xre_font_surface_draw(Xcb_Image_Info *xcbinf, RGBA_Image *surface, RGBA_Draw_Co
|
||||||
rect.y = y;
|
rect.y = y;
|
||||||
rect.width = fs->w;
|
rect.width = fs->w;
|
||||||
rect.height = fs->h;
|
rect.height = fs->h;
|
||||||
if ((dc) && (dc->clip.use))
|
if (dc->clip.use)
|
||||||
{
|
{
|
||||||
RECTS_CLIP_TO_RECT(rect.x, rect.y, rect.width, rect.height,
|
RECTS_CLIP_TO_RECT(rect.x, rect.y, rect.width, rect.height,
|
||||||
dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
|
dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);
|
||||||
}
|
}
|
||||||
xcb_render_set_picture_clip_rectangles(target_surface->xcbinf->conn,
|
xcb_render_set_picture_clip_rectangles(target_surface->xcbinf->conn,
|
||||||
target_surface->pic, 0, 0, 1, &rect);
|
target_surface->pic, 0, 0, 1, &rect);
|
||||||
xcb_render_composite(fs->xcbinf->conn, XCB_RENDER_PICT_OP_OVER,
|
xcb_render_composite(fs->xcbinf->conn, XCB_RENDER_PICT_OP_OVER,
|
||||||
fs->xcbinf->mul->pic,
|
fs->xcbinf->mul->pic,
|
||||||
fs->pic,
|
fs->pic,
|
||||||
target_surface->pic,
|
target_surface->pic,
|
||||||
0, 0,
|
0, 0,
|
||||||
|
|
|
@ -158,19 +158,45 @@ _xre_gradient_draw(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc, XR_Gradient *g
|
||||||
{
|
{
|
||||||
int op = dc->render_op, cuse = dc->clip.use;
|
int op = dc->render_op, cuse = dc->clip.use;
|
||||||
RGBA_Image *im;
|
RGBA_Image *im;
|
||||||
|
Xcb_Image_Image *xcbim;
|
||||||
|
|
||||||
im = (RGBA_Image*) evas_cache_image_empty(evas_common_image_cache_get());
|
xcbim = _xr_image_new(gr->xcbinf, w, h, gr->surface->depth);
|
||||||
|
if (!xcbim)
|
||||||
|
{
|
||||||
|
_xr_render_surface_free(gr->surface);
|
||||||
|
gr->surface = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
im = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(),
|
||||||
|
w, h,
|
||||||
|
(DATA32 *)xcbim->data,
|
||||||
|
1, EVAS_COLORSPACE_ARGB8888);
|
||||||
if (!im)
|
if (!im)
|
||||||
{
|
{
|
||||||
_xr_render_surface_free(gr->surface);
|
_xr_render_surface_free(gr->surface);
|
||||||
gr->surface = NULL;
|
gr->surface = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
evas_cache_image_surface_alloc(&im->cache_entry, w, h);
|
|
||||||
dc->render_op = _EVAS_RENDER_FILL;
|
dc->render_op = _EVAS_RENDER_FILL;
|
||||||
dc->clip.use = 0;
|
dc->clip.use = 0;
|
||||||
evas_common_gradient_draw(im, dc, 0, 0, w, h, gr->grad);
|
evas_common_gradient_draw(im, dc, 0, 0, w, h, gr->grad);
|
||||||
_xr_render_surface_argb_pixels_fill(gr->surface, w, h, im->image.data, 0, 0, w, h);
|
if
|
||||||
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
(xcbim->xcbim->byte_order == XCB_IMAGE_ORDER_LSB_FIRST)
|
||||||
|
#else
|
||||||
|
(xcbim->xcbim->byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
DATA32 *p = im->image.data, *pe = p + (w * h);
|
||||||
|
while (p < pe)
|
||||||
|
{
|
||||||
|
*p = (*p << 24) + ((*p << 8) & 0xff0000) + ((*p >> 8) & 0xff00) + (*p >> 24);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_xr_image_put(xcbim, gr->surface->draw, 0, 0, w, h);
|
||||||
evas_cache_image_drop(&im->cache_entry);
|
evas_cache_image_drop(&im->cache_entry);
|
||||||
dc->render_op = op;
|
dc->render_op = op;
|
||||||
dc->clip.use = cuse;
|
dc->clip.use = cuse;
|
||||||
|
|
|
@ -13,7 +13,7 @@ static void
|
||||||
__xre_image_dirty_hash_add(XR_Image *im)
|
__xre_image_dirty_hash_add(XR_Image *im)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
if (!im->data) return;
|
if (!im->data) return;
|
||||||
snprintf(buf, sizeof(buf), "%p", im->data);
|
snprintf(buf, sizeof(buf), "%p", im->data);
|
||||||
if (!_xr_image_dirty_hash) _xr_image_dirty_hash = eina_hash_string_superfast_new(NULL);
|
if (!_xr_image_dirty_hash) _xr_image_dirty_hash = eina_hash_string_superfast_new(NULL);
|
||||||
|
@ -24,7 +24,7 @@ static void
|
||||||
__xre_image_dirty_hash_del(XR_Image *im)
|
__xre_image_dirty_hash_del(XR_Image *im)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
if (!im->data) return;
|
if (!im->data) return;
|
||||||
snprintf(buf, sizeof(buf), "%p", im->data);
|
snprintf(buf, sizeof(buf), "%p", im->data);
|
||||||
eina_hash_del(_xr_image_dirty_hash, buf, im);
|
eina_hash_del(_xr_image_dirty_hash, buf, im);
|
||||||
|
@ -34,7 +34,7 @@ static XR_Image *
|
||||||
__xre_image_dirty_hash_find(void *data)
|
__xre_image_dirty_hash_find(void *data)
|
||||||
{
|
{
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%p", data);
|
snprintf(buf, sizeof(buf), "%p", data);
|
||||||
return eina_hash_find(_xr_image_dirty_hash, buf);
|
return eina_hash_find(_xr_image_dirty_hash, buf);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ _xre_image_load(Xcb_Image_Info *xcbinf, const char *file, const char *key, Evas_
|
||||||
{
|
{
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
im = calloc(1, sizeof(XR_Image));
|
im = calloc(1, sizeof(XR_Image));
|
||||||
if (!im) return NULL;
|
if (!im) return NULL;
|
||||||
im->im = evas_common_load_image_from_file(file, key, lo);
|
im->im = evas_common_load_image_from_file(file, key, lo);
|
||||||
|
@ -103,6 +103,7 @@ _xre_image_load(Xcb_Image_Info *xcbinf, const char *file, const char *key, Evas_
|
||||||
}
|
}
|
||||||
im->xcbinf = xcbinf;
|
im->xcbinf = xcbinf;
|
||||||
im->xcbinf->references++;
|
im->xcbinf->references++;
|
||||||
|
im->cs.space = EVAS_COLORSPACE_ARGB8888;
|
||||||
im->fkey = strdup(buf);
|
im->fkey = strdup(buf);
|
||||||
im->file = (char *)eina_stringshare_add(file);
|
im->file = (char *)eina_stringshare_add(file);
|
||||||
if (key) im->key = (char *)eina_stringshare_add(key);
|
if (key) im->key = (char *)eina_stringshare_add(key);
|
||||||
|
@ -114,12 +115,12 @@ _xre_image_load(Xcb_Image_Info *xcbinf, const char *file, const char *key, Evas_
|
||||||
/* if (im->im->info.format == 1) im->format = eina_stringshare_add("png"); */
|
/* if (im->im->info.format == 1) im->format = eina_stringshare_add("png"); */
|
||||||
if (im->im->cache_entry.flags.alpha) im->alpha = 1;
|
if (im->im->cache_entry.flags.alpha) im->alpha = 1;
|
||||||
if (!_xr_image_hash) _xr_image_hash = eina_hash_string_superfast_new(NULL);
|
if (!_xr_image_hash) _xr_image_hash = eina_hash_string_superfast_new(NULL);
|
||||||
_xr_image_hash = eina_hash_direct_add(_xr_image_hash, im->fkey, im);
|
eina_hash_direct_add(_xr_image_hash, im->fkey, im);
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
XR_Image *
|
XR_Image *
|
||||||
_xre_image_new_from_data(Xcb_Image_Info *xcbinf, int w, int h, void *data)
|
_xre_image_new_from_data(Xcb_Image_Info *xcbinf, int w, int h, void *data, int alpha, int cspace)
|
||||||
{
|
{
|
||||||
XR_Image *im;
|
XR_Image *im;
|
||||||
|
|
||||||
|
@ -127,44 +128,74 @@ _xre_image_new_from_data(Xcb_Image_Info *xcbinf, int w, int h, void *data)
|
||||||
if (!im) return NULL;
|
if (!im) return NULL;
|
||||||
im->xcbinf = xcbinf;
|
im->xcbinf = xcbinf;
|
||||||
im->xcbinf->references++;
|
im->xcbinf->references++;
|
||||||
|
im->cs.space = cspace;
|
||||||
im->w = w;
|
im->w = w;
|
||||||
im->h = h;
|
im->h = h;
|
||||||
im->references = 1;
|
im->references = 1;
|
||||||
im->data = data;
|
switch (im->cs.space)
|
||||||
im->alpha = 1;
|
{
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
im->data = data;
|
||||||
|
im->alpha = alpha;
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
im->cs.data = data;
|
||||||
|
im->cs.no_free = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
|
}
|
||||||
im->dirty = 1;
|
im->dirty = 1;
|
||||||
__xre_image_dirty_hash_add(im);
|
__xre_image_dirty_hash_add(im);
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
XR_Image *
|
XR_Image *
|
||||||
_xre_image_new_from_copied_data(Xcb_Image_Info *xcbinf, int w, int h, void *data)
|
_xre_image_new_from_copied_data(Xcb_Image_Info *xcbinf, int w, int h, void *data, int alpha, int cspace)
|
||||||
{
|
{
|
||||||
XR_Image *im;
|
XR_Image *im;
|
||||||
|
|
||||||
im = calloc(1, sizeof(XR_Image));
|
im = calloc(1, sizeof(XR_Image));
|
||||||
if (!im) return NULL;
|
if (!im) return NULL;
|
||||||
im->data = malloc(w * h * 4);
|
im->cs.space = cspace;
|
||||||
if (!im->data)
|
switch (im->cs.space)
|
||||||
{
|
{
|
||||||
free(im);
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
return NULL;
|
im->data = malloc(w * h * 4);
|
||||||
}
|
if (!im->data)
|
||||||
if (data)
|
{
|
||||||
{
|
free(im);
|
||||||
Gfx_Func_Copy func;
|
return NULL;
|
||||||
|
}
|
||||||
func = evas_common_draw_func_copy_get(w * h, 0);
|
if (data)
|
||||||
if (func) func(data, im->data, w * h);
|
{
|
||||||
evas_common_cpu_end_opt();
|
Gfx_Func_Copy func;
|
||||||
|
|
||||||
|
func = evas_common_draw_func_copy_get(w * h, 0);
|
||||||
|
if (func) func(data, im->data, w * h);
|
||||||
|
evas_common_cpu_end_opt();
|
||||||
|
}
|
||||||
|
im->alpha = alpha;
|
||||||
|
im->free_data = 1;
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
im->cs.no_free = 0;
|
||||||
|
im->cs.data = calloc(1, h * sizeof(unsigned char *) * 2);
|
||||||
|
if ((data) && (im->cs.data))
|
||||||
|
memcpy(im->cs.data, data, h * sizeof(unsigned char *) * 2);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
im->w = w;
|
im->w = w;
|
||||||
im->h = h;
|
im->h = h;
|
||||||
im->references = 1;
|
im->references = 1;
|
||||||
im->xcbinf = xcbinf;
|
im->xcbinf = xcbinf;
|
||||||
im->xcbinf->references++;
|
im->xcbinf->references++;
|
||||||
im->free_data = 1;
|
|
||||||
im->alpha = 1;
|
|
||||||
im->dirty = 1;
|
im->dirty = 1;
|
||||||
__xre_image_dirty_hash_add(im);
|
__xre_image_dirty_hash_add(im);
|
||||||
return im;
|
return im;
|
||||||
|
@ -186,6 +217,7 @@ _xre_image_new(Xcb_Image_Info *xcbinf, int w, int h)
|
||||||
im->w = w;
|
im->w = w;
|
||||||
im->h = h;
|
im->h = h;
|
||||||
im->references = 1;
|
im->references = 1;
|
||||||
|
im->cs.space = EVAS_COLORSPACE_ARGB8888;
|
||||||
im->xcbinf = xcbinf;
|
im->xcbinf = xcbinf;
|
||||||
im->xcbinf->references++;
|
im->xcbinf->references++;
|
||||||
im->free_data = 1;
|
im->free_data = 1;
|
||||||
|
@ -198,6 +230,10 @@ _xre_image_new(Xcb_Image_Info *xcbinf, int w, int h)
|
||||||
static void
|
static void
|
||||||
__xre_image_real_free(XR_Image *im)
|
__xre_image_real_free(XR_Image *im)
|
||||||
{
|
{
|
||||||
|
if (im->cs.data)
|
||||||
|
{
|
||||||
|
if (!im->cs.no_free) free(im->cs.data);
|
||||||
|
}
|
||||||
if (im->file) eina_stringshare_del(im->file);
|
if (im->file) eina_stringshare_del(im->file);
|
||||||
if (im->key) eina_stringshare_del(im->key);
|
if (im->key) eina_stringshare_del(im->key);
|
||||||
if (im->fkey) free(im->fkey);
|
if (im->fkey) free(im->fkey);
|
||||||
|
@ -233,7 +269,7 @@ _xre_image_free(XR_Image *im)
|
||||||
|
|
||||||
void
|
void
|
||||||
_xre_image_region_dirty(XR_Image *im, int x, int y, int w, int h)
|
_xre_image_region_dirty(XR_Image *im, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
if (!im->updates)
|
if (!im->updates)
|
||||||
{
|
{
|
||||||
im->updates = evas_common_tilebuf_new(im->w, im->h);
|
im->updates = evas_common_tilebuf_new(im->w, im->h);
|
||||||
|
@ -260,9 +296,11 @@ _xre_image_copy(XR_Image *im)
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
|
|
||||||
if (im->data) data = im->data;
|
if (im->data) data = im->data;
|
||||||
|
else if (im->cs.data) data = im->cs.data;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!im->im) im->im = evas_common_load_image_from_file(im->file, im->key, &(im->load_opts));
|
if (!im->im)
|
||||||
|
im->im = evas_common_load_image_from_file(im->file, im->key, &(im->load_opts));
|
||||||
if (im->im)
|
if (im->im)
|
||||||
{
|
{
|
||||||
evas_cache_image_load_data(&im->im->cache_entry);
|
evas_cache_image_load_data(&im->im->cache_entry);
|
||||||
|
@ -270,13 +308,7 @@ _xre_image_copy(XR_Image *im)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!data) return NULL;
|
if (!data) return NULL;
|
||||||
im2 = _xre_image_new_from_copied_data(im->xcbinf, im->w, im->h, data);
|
im2 = _xre_image_new_from_copied_data(im->xcbinf, im->w, im->h, data, im->alpha, im->cs.space);
|
||||||
if (im2) im2->alpha = im->alpha;
|
|
||||||
if ((im->im) && (!im->dirty))
|
|
||||||
{
|
|
||||||
evas_cache_image_drop(&im->im->cache_entry);
|
|
||||||
im->im = NULL;
|
|
||||||
}
|
|
||||||
return im2;
|
return im2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,94 +319,65 @@ _xre_image_resize(XR_Image *im, int w, int h)
|
||||||
if (im->surface)
|
if (im->surface)
|
||||||
{
|
{
|
||||||
Xcb_Render_Surface *old_surface;
|
Xcb_Render_Surface *old_surface;
|
||||||
int x = 0, y = 0, ww, hh;
|
|
||||||
|
|
||||||
ww = w; hh = h;
|
|
||||||
RECTS_CLIP_TO_RECT(x, y, ww, hh, 0, 0, im->w, im->h);
|
|
||||||
old_surface = im->surface;
|
old_surface = im->surface;
|
||||||
im->surface = _xr_render_surface_new(old_surface->xcbinf,
|
im->surface = _xr_render_surface_new(old_surface->xcbinf, w + 2, h + 2, old_surface->fmt, old_surface->alpha);
|
||||||
w + 1, h + 1, old_surface->fmt, old_surface->alpha);
|
|
||||||
if (im->surface)
|
|
||||||
_xr_render_surface_copy(old_surface, im->surface, 0, 0, 0, 0, ww, hh);
|
|
||||||
_xr_render_surface_free(old_surface);
|
_xr_render_surface_free(old_surface);
|
||||||
}
|
}
|
||||||
if (im->data)
|
switch (im->cs.space)
|
||||||
{
|
{
|
||||||
Gfx_Func_Copy func;
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
int x = 0, y = 0, ww, hh;
|
if (im->data)
|
||||||
unsigned int *sp, *dp;
|
|
||||||
void *data;
|
|
||||||
|
|
||||||
data = malloc(w * h * 4);
|
|
||||||
if (!data)
|
|
||||||
{
|
{
|
||||||
if (im->surface)
|
if (im->free_data)
|
||||||
{
|
{
|
||||||
_xr_render_surface_free(im->surface);
|
if (im->data) free(im->data);
|
||||||
im->surface = NULL;
|
im->data = malloc(w * h * 4);
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
ww = w; hh = h;
|
else if (im->im)
|
||||||
|
|
||||||
RECTS_CLIP_TO_RECT(x, y, ww, hh, 0, 0, im->w, im->h);
|
|
||||||
func = evas_common_draw_func_copy_get(w * h, 0);
|
|
||||||
if (func)
|
|
||||||
{
|
{
|
||||||
for (y = 0; y < hh; y++)
|
evas_cache_image_drop(&im->im->cache_entry);
|
||||||
|
im->im = NULL;
|
||||||
|
if (im->free_data)
|
||||||
{
|
{
|
||||||
sp = ((unsigned int *)im->data) + (y * im->w);
|
if (im->data) free(im->data);
|
||||||
dp = ((unsigned int *)data) + (y * w);
|
im->data = malloc(w * h * 4);
|
||||||
func(sp, dp, ww);
|
|
||||||
}
|
}
|
||||||
evas_common_cpu_end_opt();
|
|
||||||
}
|
}
|
||||||
__xre_image_dirty_hash_del(im);
|
else
|
||||||
free(im->data);
|
|
||||||
im->data = data;
|
|
||||||
__xre_image_dirty_hash_add(im);
|
|
||||||
}
|
|
||||||
else if (im->im)
|
|
||||||
{
|
|
||||||
RGBA_Image *im_old;
|
|
||||||
|
|
||||||
im_old = im->im;
|
|
||||||
im->im = (RGBA_Image*) evas_cache_image_empty(evas_common_image_cache_get());
|
|
||||||
if (!im->im)
|
|
||||||
{
|
{
|
||||||
im->im = im_old;
|
im->data = malloc(w * h * 4);
|
||||||
if (im->surface)
|
im->free_data = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
if (im->data)
|
||||||
|
{
|
||||||
|
if (im->free_data)
|
||||||
{
|
{
|
||||||
_xr_render_surface_free(im->surface);
|
if (im->data) free(im->data);
|
||||||
im->surface = NULL;
|
|
||||||
}
|
}
|
||||||
return;
|
im->data = NULL;
|
||||||
}
|
}
|
||||||
evas_cache_image_load_data(&im->im->cache_entry);
|
if (im->im)
|
||||||
if (im_old->image.data)
|
|
||||||
{
|
{
|
||||||
int x = 0, y = 0, ww, hh;
|
evas_cache_image_drop(&im->im->cache_entry);
|
||||||
|
im->im = NULL;
|
||||||
ww = w; hh = h;
|
|
||||||
RECTS_CLIP_TO_RECT(x, y, ww, hh, 0, 0, im->w, im->h);
|
|
||||||
evas_common_blit_rectangle(im_old, im->im, 0, 0, ww, hh, 0, 0);
|
|
||||||
evas_common_cpu_end_opt();
|
|
||||||
}
|
}
|
||||||
im->free_data = 1;
|
if (!im->cs.no_free)
|
||||||
/* FIXME: Hum ? */
|
{
|
||||||
im->data = im->im->image.data;
|
if (im->cs.data) free(im->cs.data);
|
||||||
im->im->image.data = NULL;
|
im->cs.data = calloc(1, h * sizeof(unsigned char *) * 2);
|
||||||
evas_cache_image_drop(&im->im->cache_entry);
|
}
|
||||||
im->im = NULL;
|
break;
|
||||||
evas_cache_image_drop(&im_old->cache_entry);
|
default:
|
||||||
__xre_image_dirty_hash_add(im);
|
abort();
|
||||||
}
|
break;
|
||||||
else
|
|
||||||
{
|
|
||||||
im->data = malloc(w * h * 4);
|
|
||||||
im->free_data = 1;
|
|
||||||
__xre_image_dirty_hash_add(im);
|
|
||||||
}
|
}
|
||||||
|
__xre_image_dirty_hash_del(im);
|
||||||
|
__xre_image_dirty_hash_add(im);
|
||||||
im->w = w;
|
im->w = w;
|
||||||
im->h = h;
|
im->h = h;
|
||||||
}
|
}
|
||||||
|
@ -383,8 +386,9 @@ void *
|
||||||
_xre_image_data_get(XR_Image *im)
|
_xre_image_data_get(XR_Image *im)
|
||||||
{
|
{
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
|
|
||||||
if (im->data) data = im->data;
|
if (im->data) data = im->data;
|
||||||
|
else if (im->cs.data) data = im->cs.data;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!im->im) im->im = evas_common_load_image_from_file(im->file, im->key, &(im->load_opts));
|
if (!im->im) im->im = evas_common_load_image_from_file(im->file, im->key, &(im->load_opts));
|
||||||
|
@ -401,9 +405,9 @@ XR_Image *
|
||||||
_xre_image_data_find(void *data)
|
_xre_image_data_find(void *data)
|
||||||
{
|
{
|
||||||
XR_Image *im;
|
XR_Image *im;
|
||||||
|
|
||||||
im = __xre_image_dirty_hash_find(data);
|
im = __xre_image_dirty_hash_find(data);
|
||||||
if (im)
|
if (im)
|
||||||
{
|
{
|
||||||
im->references++;
|
im->references++;
|
||||||
}
|
}
|
||||||
|
@ -416,26 +420,46 @@ _xre_image_data_put(XR_Image *im, void *data)
|
||||||
void *imdata = NULL;
|
void *imdata = NULL;
|
||||||
|
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
if (im->data)
|
switch (im->cs.space)
|
||||||
{
|
{
|
||||||
imdata = im->data;
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
if (data == imdata) return;
|
|
||||||
__xre_image_dirty_hash_del(im);
|
|
||||||
if (im->free_data) free(im->data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (im->im) imdata = im->im->image.data;
|
|
||||||
if (data == imdata) return;
|
|
||||||
if (im->im)
|
if (im->im)
|
||||||
{
|
{
|
||||||
evas_cache_image_drop(&im->im->cache_entry);
|
if (data == im->im->image.data) return;
|
||||||
|
evas_cache_image_drop(&im->im->cache_entry);
|
||||||
im->im = NULL;
|
im->im = NULL;
|
||||||
}
|
}
|
||||||
|
if (im->cs.data == data) return;
|
||||||
|
if (im->data)
|
||||||
|
{
|
||||||
|
if (im->data == data) return;
|
||||||
|
if (im->free_data) free(im->data);
|
||||||
|
im->free_data = 0;
|
||||||
|
}
|
||||||
|
im->data = data;
|
||||||
|
im->free_data = 0;
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
if (im->data)
|
||||||
|
{
|
||||||
|
if (im->free_data) free(im->data);
|
||||||
|
im->data = NULL;
|
||||||
|
}
|
||||||
|
im->free_data = 0;
|
||||||
|
if (data == im->cs.data) return;
|
||||||
|
if (!im->cs.no_free)
|
||||||
|
{
|
||||||
|
if (im->cs.data) free(im->cs.data);
|
||||||
|
}
|
||||||
|
im->cs.data = data;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
im->data = data;
|
__xre_image_dirty_hash_del(im);
|
||||||
__xre_image_dirty_hash_add(im);
|
__xre_image_dirty_hash_add(im);
|
||||||
im->free_data = 0;
|
|
||||||
if (im->surface)
|
if (im->surface)
|
||||||
{
|
{
|
||||||
_xr_render_surface_free(im->surface);
|
_xr_render_surface_free(im->surface);
|
||||||
|
@ -458,34 +482,50 @@ void
|
||||||
_xre_image_alpha_set(XR_Image *im, int alpha)
|
_xre_image_alpha_set(XR_Image *im, int alpha)
|
||||||
{
|
{
|
||||||
if (im->alpha == alpha) return;
|
if (im->alpha == alpha) return;
|
||||||
im->alpha = alpha;
|
switch (im->cs.space)
|
||||||
if (im->surface)
|
|
||||||
{
|
{
|
||||||
Xcb_Render_Surface *old_surface;
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
im->alpha = alpha;
|
||||||
old_surface = im->surface;
|
|
||||||
im->surface = NULL;
|
|
||||||
if (im->alpha)
|
|
||||||
im->surface = _xr_render_surface_new(im->xcbinf,
|
|
||||||
im->w + 1, im->h + 1, im->xcbinf->fmt32, 1);
|
|
||||||
else
|
|
||||||
im->surface = _xr_render_surface_new(im->xcbinf,
|
|
||||||
im->w + 1, im->h + 1, im->xcbinf->fmt24, 0);
|
|
||||||
if (im->surface)
|
if (im->surface)
|
||||||
_xr_render_surface_copy(old_surface,
|
{
|
||||||
im->surface, 0, 0, 0, 0, im->w + 1, im->h + 1);
|
Xcb_Render_Surface *old_surface;
|
||||||
_xr_render_surface_free(old_surface);
|
|
||||||
}
|
old_surface = im->surface;
|
||||||
if (im->updates)
|
im->surface = NULL;
|
||||||
{
|
if (im->alpha)
|
||||||
evas_common_tilebuf_free(im->updates);
|
im->surface = _xr_render_surface_new(im->xcbinf, im->w + 2, im->h + 2, im->xcbinf->fmt32, 1);
|
||||||
im->updates = NULL;
|
else
|
||||||
|
{
|
||||||
|
/* FIXME: if im->depth == 16, use xcbinf->fmtdef */
|
||||||
|
if ((im->xcbinf->depth == 16) &&
|
||||||
|
(im->xcbinf->visual->red_mask == 0xf800) &&
|
||||||
|
(im->xcbinf->visual->green_mask == 0x07e0) &&
|
||||||
|
(im->xcbinf->visual->blue_mask == 0x001f))
|
||||||
|
im->surface = _xr_render_surface_new(im->xcbinf, im->w + 2, im->h + 2, im->xcbinf->fmtdef, 0);
|
||||||
|
else
|
||||||
|
im->surface = _xr_render_surface_new(im->xcbinf, im->w + 2, im->h + 2, im->xcbinf->fmt24, 0);
|
||||||
|
}
|
||||||
|
if (im->surface)
|
||||||
|
_xr_render_surface_copy(old_surface, im->surface, 0, 0, 0, 0, im->w + 2, im->h + 2);
|
||||||
|
_xr_render_surface_free(old_surface);
|
||||||
|
}
|
||||||
|
if (im->updates)
|
||||||
|
{
|
||||||
|
evas_common_tilebuf_free(im->updates);
|
||||||
|
im->updates = NULL;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_xre_image_alpha_get(XR_Image *im)
|
_xre_image_alpha_get(XR_Image *im)
|
||||||
{
|
{
|
||||||
|
if (im->im)
|
||||||
|
{
|
||||||
|
if (im->im->cache_entry.space != EVAS_COLORSPACE_ARGB8888) return 0;
|
||||||
|
}
|
||||||
return im->alpha;
|
return im->alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,6 +556,7 @@ void
|
||||||
_xre_image_surface_gen(XR_Image *im)
|
_xre_image_surface_gen(XR_Image *im)
|
||||||
{
|
{
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
|
void *tdata = NULL;
|
||||||
|
|
||||||
if ((im->surface) && (!im->updates)) return;
|
if ((im->surface) && (!im->updates)) return;
|
||||||
if (im->data) data = im->data;
|
if (im->data) data = im->data;
|
||||||
|
@ -528,64 +569,103 @@ _xre_image_surface_gen(XR_Image *im)
|
||||||
data = im->im->image.data;
|
data = im->im->image.data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!data) return;
|
if (!data)
|
||||||
|
{
|
||||||
|
switch (im->cs.space)
|
||||||
|
{
|
||||||
|
case EVAS_COLORSPACE_ARGB8888:
|
||||||
|
return;
|
||||||
|
break;
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
||||||
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
||||||
|
if ((im->cs.data) && (*((unsigned char **)im->cs.data)))
|
||||||
|
{
|
||||||
|
tdata = malloc(im->w * im->h * sizeof(DATA32));
|
||||||
|
if (tdata)
|
||||||
|
evas_common_convert_yuv_420p_601_rgba(im->cs.data,
|
||||||
|
tdata,
|
||||||
|
im->w, im->h);
|
||||||
|
data = tdata;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abort();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!data) return;
|
||||||
|
}
|
||||||
if (im->surface)
|
if (im->surface)
|
||||||
{
|
{
|
||||||
if (im->updates)
|
if (im->updates)
|
||||||
{
|
{
|
||||||
Tilebuf_Rect *rects, *r;
|
Tilebuf_Rect *rects, *r;
|
||||||
|
|
||||||
rects = evas_common_tilebuf_get_render_rects(im->updates);
|
rects = evas_common_tilebuf_get_render_rects(im->updates);
|
||||||
if (rects)
|
if (rects)
|
||||||
{
|
{
|
||||||
EINA_INLIST_FOREACH(rects, r)
|
EINA_INLIST_FOREACH(rects, r)
|
||||||
{
|
{
|
||||||
int rx, ry, rw, rh;
|
int rx, ry, rw, rh;
|
||||||
|
|
||||||
rx = r->x; ry = r->y; rw = r->w, rh = r->h;
|
rx = r->x; ry = r->y; rw = r->w, rh = r->h;
|
||||||
RECTS_CLIP_TO_RECT(rx, ry, rw, rh, 0, 0, im->w, im->h);
|
RECTS_CLIP_TO_RECT(rx, ry, rw, rh, 0, 0, im->w, im->h);
|
||||||
if (im->alpha)
|
if (im->alpha)
|
||||||
_xr_render_surface_argb_pixels_fill(im->surface, im->w, im->h, data, rx, ry, rw, rh);
|
_xr_render_surface_argb_pixels_fill(im->surface, im->w, im->h, data, rx, ry, rw, rh, 1, 1);
|
||||||
else
|
else
|
||||||
_xr_render_surface_rgb_pixels_fill(im->surface, im->w, im->h, data, rx, ry, rw, rh);
|
/* FIXME: if im->depth == 16 - convert to 16bpp then
|
||||||
|
* upload */
|
||||||
|
_xr_render_surface_rgb_pixels_fill(im->surface, im->w, im->h, data, rx, ry, rw, rh, 1, 1);
|
||||||
}
|
}
|
||||||
evas_common_tilebuf_free_render_rects(rects);
|
evas_common_tilebuf_free_render_rects(rects);
|
||||||
}
|
}
|
||||||
evas_common_tilebuf_free(im->updates);
|
evas_common_tilebuf_free(im->updates);
|
||||||
im->updates = NULL;
|
im->updates = NULL;
|
||||||
}
|
}
|
||||||
|
if (tdata) free(tdata);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (im->alpha)
|
if (im->alpha)
|
||||||
{
|
{
|
||||||
im->surface = _xr_render_surface_new(im->xcbinf,
|
im->surface = _xr_render_surface_new(im->xcbinf, im->w + 2, im->h + 2, im->xcbinf->fmt32, 1);
|
||||||
im->w + 1, im->h + 1, im->xcbinf->fmt32, 1);
|
_xr_render_surface_argb_pixels_fill(im->surface, im->w, im->h, data, 0, 0, im->w, im->h, 1, 1);
|
||||||
_xr_render_surface_argb_pixels_fill(im->surface, im->w, im->h, data, 0, 0, im->w, im->h);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
im->surface = _xr_render_surface_new(im->xcbinf,
|
/* FIXME: if im->xcbinf->depth == 16, use xcbinf->fmtdef */
|
||||||
im->w + 1, im->h + 1, im->xcbinf->fmt24, 0);
|
if ((im->xcbinf->depth == 16) &&
|
||||||
_xr_render_surface_rgb_pixels_fill(im->surface, im->w, im->h, data, 0, 0, im->w, im->h);
|
(im->xcbinf->visual->red_mask == 0xf800) &&
|
||||||
}
|
(im->xcbinf->visual->green_mask == 0x07e0) &&
|
||||||
/* fill right and bottom pixel so interpolation works right */
|
(im->xcbinf->visual->blue_mask == 0x001f))
|
||||||
|
im->surface = _xr_render_surface_new(im->xcbinf, im->w + 2, im->h + 2, im->xcbinf->fmtdef, 0);
|
||||||
|
else
|
||||||
|
im->surface = _xr_render_surface_new(im->xcbinf, im->w + 2, im->h + 2, im->xcbinf->fmt24, 0);
|
||||||
|
/* FIXME: if im->depth == 16 - convert to 16bpp then
|
||||||
|
* upload */
|
||||||
|
_xr_render_surface_rgb_pixels_fill(im->surface, im->w, im->h, data, 0, 0, im->w, im->h, 1, 1);
|
||||||
|
}
|
||||||
|
/* fill borders */
|
||||||
_xr_render_surface_copy(im->surface, im->surface,
|
_xr_render_surface_copy(im->surface, im->surface,
|
||||||
im->w - 1, 0,
|
1, 1,
|
||||||
im->w, 0,
|
0, 1,
|
||||||
1, im->h);
|
1, im->h);
|
||||||
_xr_render_surface_copy(im->surface, im->surface,
|
_xr_render_surface_copy(im->surface, im->surface,
|
||||||
0, im->h - 1,
|
0, 1,
|
||||||
0, im->h,
|
0, 0,
|
||||||
im->w, 1);
|
im->w + 2, 1);
|
||||||
_xr_render_surface_copy(im->surface, im->surface,
|
_xr_render_surface_copy(im->surface, im->surface,
|
||||||
im->w - 1, im->h - 1,
|
im->w, 1,
|
||||||
im->w, im->h,
|
im->w + 1, 1,
|
||||||
1, 1);
|
1, im->h);
|
||||||
|
_xr_render_surface_copy(im->surface, im->surface,
|
||||||
|
0, im->h,
|
||||||
|
0, im->h + 1,
|
||||||
|
im->w + 2, 1);
|
||||||
if ((im->im) && (!im->dirty))
|
if ((im->im) && (!im->dirty))
|
||||||
{
|
{
|
||||||
evas_cache_image_drop(&im->im->cache_entry);
|
evas_cache_image_drop(&im->im->cache_entry);
|
||||||
im->im = NULL;
|
im->im = NULL;
|
||||||
}
|
}
|
||||||
|
if (tdata) free(tdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -595,12 +675,12 @@ _xre_image_cache_set(int size)
|
||||||
while (_xr_image_cache_usage > _xr_image_cache_size)
|
while (_xr_image_cache_usage > _xr_image_cache_size)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
l = eina_list_last(_xr_image_cache);
|
l = eina_list_last(_xr_image_cache);
|
||||||
if (l)
|
if (l)
|
||||||
{
|
{
|
||||||
XR_Image *im;
|
XR_Image *im;
|
||||||
|
|
||||||
im = l->data;
|
im = l->data;
|
||||||
_xr_image_cache = eina_list_remove_list(_xr_image_cache, l);
|
_xr_image_cache = eina_list_remove_list(_xr_image_cache, l);
|
||||||
_xr_image_cache_usage -= (im->w * im->h * 4);
|
_xr_image_cache_usage -= (im->w * im->h * 4);
|
||||||
|
|
|
@ -259,7 +259,7 @@ _tmp_xcb_err(xcb_connection_t *conn/* , XErrorEvent *ev */)
|
||||||
}
|
}
|
||||||
|
|
||||||
Xcb_Image_Info *
|
Xcb_Image_Info *
|
||||||
_xr_image_info_get(xcb_connection_t *conn, xcb_drawable_t draw, xcb_visualid_t vis)
|
_xr_image_info_get(xcb_connection_t *conn, xcb_screen_t *screen, xcb_drawable_t draw, xcb_visualtype_t *visual)
|
||||||
{
|
{
|
||||||
xcb_get_geometry_cookie_t cookie;
|
xcb_get_geometry_cookie_t cookie;
|
||||||
xcb_get_geometry_reply_t *rep;
|
xcb_get_geometry_reply_t *rep;
|
||||||
|
@ -281,17 +281,19 @@ _xr_image_info_get(xcb_connection_t *conn, xcb_drawable_t draw, xcb_visualid_t v
|
||||||
|
|
||||||
xcbinf->references = 1;
|
xcbinf->references = 1;
|
||||||
xcbinf->conn = conn;
|
xcbinf->conn = conn;
|
||||||
|
xcbinf->screen = screen;
|
||||||
xcbinf->draw = draw;
|
xcbinf->draw = draw;
|
||||||
cookie = xcb_get_geometry_unchecked(xcbinf->conn, xcbinf->draw);
|
cookie = xcb_get_geometry_unchecked(xcbinf->conn, xcbinf->draw);
|
||||||
rep = xcb_get_geometry_reply(xcbinf->conn, cookie, NULL);
|
rep = xcb_get_geometry_reply(xcbinf->conn, cookie, NULL);
|
||||||
xcbinf->root = rep->root;
|
xcbinf->root = rep->root;
|
||||||
free(rep);
|
free(rep);
|
||||||
xcbinf->vis = vis;
|
xcbinf->visual = visual;
|
||||||
xcbinf->fmt32 = xcb_render_find_standard_pictforminfo(xcbinf->conn, xcb_render_standard_pictforminfoargb_32_t);
|
xcbinf->fmt32 = xcb_render_find_standard_pictforminfo(xcbinf->conn, xcb_render_standard_pictforminfoargb_32_t);
|
||||||
xcbinf->fmt24 = xcb_render_find_standard_pictforminfo(xcbinf->conn, xcb_render_standard_pictforminforgb_24_t);
|
xcbinf->fmt24 = xcb_render_find_standard_pictforminfo(xcbinf->conn, xcb_render_standard_pictforminforgb_24_t);
|
||||||
xcbinf->fmt8 = xcb_render_find_standard_pictforminfo(xcbinf->conn, xcb_render_standard_pictforminfoa_8_t);
|
xcbinf->fmt8 = xcb_render_find_standard_pictforminfo(xcbinf->conn, xcb_render_standard_pictforminfoa_8_t);
|
||||||
xcbinf->fmt4 = xcb_render_find_standard_pictforminfo(xcbinf->conn, xcb_render_standard_pictforminfoa_4_t);
|
xcbinf->fmt4 = xcb_render_find_standard_pictforminfo(xcbinf->conn, xcb_render_standard_pictforminfoa_4_t);
|
||||||
xcbinf->fmt1 = xcb_render_find_standard_pictforminfo(xcbinf->conn, xcb_render_standard_pictforminfoa_1_t);
|
xcbinf->fmt1 = xcb_render_find_standard_pictforminfo(xcbinf->conn, xcb_render_standard_pictforminfoa_1_t);
|
||||||
|
|
||||||
xcbinf->mul = _xr_render_surface_new(xcbinf, 1, 1, xcbinf->fmt32, 1);
|
xcbinf->mul = _xr_render_surface_new(xcbinf, 1, 1, xcbinf->fmt32, 1);
|
||||||
_xr_render_surface_repeat_set(xcbinf->mul, 1);
|
_xr_render_surface_repeat_set(xcbinf->mul, 1);
|
||||||
xcbinf->mul_r = xcbinf->mul_g = xcbinf->mul_b = xcbinf->mul_a = 0xff;
|
xcbinf->mul_r = xcbinf->mul_g = xcbinf->mul_b = xcbinf->mul_a = 0xff;
|
||||||
|
@ -303,39 +305,32 @@ _xr_image_info_get(xcb_connection_t *conn, xcb_drawable_t draw, xcb_visualid_t v
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xcb_shm_segment_info_t shm_info;
|
xcb_depth_iterator_t iter_depth;
|
||||||
xcb_image_t *xcbim;
|
xcb_shm_segment_info_t shm_info;
|
||||||
|
xcb_image_t *xcbim;
|
||||||
|
|
||||||
xcbinf->depth = 32;
|
iter_depth = xcb_screen_allowed_depths_iterator (xcbinf->screen);
|
||||||
{
|
for (; iter_depth.rem ; xcb_depth_next (&iter_depth))
|
||||||
xcb_setup_t *rep;
|
{
|
||||||
xcb_screen_iterator_t iter_screen;
|
xcb_visualtype_iterator_t iter_visual;
|
||||||
|
|
||||||
rep = (xcb_setup_t *)xcb_get_setup(xcbinf->conn);
|
iter_visual = xcb_depth_visuals_iterator (iter_depth.data);
|
||||||
iter_screen = xcb_setup_roots_iterator(rep);
|
for (; iter_visual.rem ; xcb_visualtype_next (&iter_visual))
|
||||||
for (; iter_screen.rem ; xcb_screen_next (&iter_screen)) {
|
{
|
||||||
xcb_depth_iterator_t iter_depth;
|
if (iter_visual.data->visual_id == visual->visual_id)
|
||||||
|
xcbinf->depth = iter_depth.data->depth;
|
||||||
iter_depth = xcb_screen_allowed_depths_iterator (iter_screen.data);
|
}
|
||||||
for (; iter_depth.rem ; xcb_depth_next (&iter_depth)) {
|
|
||||||
xcb_visualtype_iterator_t iter_visual;
|
|
||||||
|
|
||||||
iter_visual = xcb_depth_visuals_iterator (iter_depth.data);
|
|
||||||
for (; iter_visual.rem ; xcb_visualtype_next (&iter_visual)) {
|
|
||||||
if (iter_visual.data->visual_id == vis)
|
|
||||||
xcbinf->depth = iter_depth.data->depth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
xcbinf->can_do_shm = 0;
|
xcbinf->can_do_shm = 0;
|
||||||
|
|
||||||
|
|
||||||
shm_info.shmseg = xcb_generate_id(xcbinf->conn);
|
shm_info.shmseg = xcb_generate_id(xcbinf->conn);
|
||||||
xcbim = xcb_image_shm_create(xcbinf->conn, xcbinf->depth, XCB_IMAGE_FORMAT_Z_PIXMAP, NULL, 1, 1);
|
xcbim = xcb_image_create_native(xcbinf->conn, 1, 1,
|
||||||
|
XCB_IMAGE_FORMAT_Z_PIXMAP,
|
||||||
|
xcbinf->depth, NULL, ~0, NULL);
|
||||||
if (xcbim) {
|
if (xcbim) {
|
||||||
shm_info.shmid = shmget(IPC_PRIVATE, xcbim->bytes_per_line * xcbim->height, IPC_CREAT | 0777);
|
shm_info.shmid = shmget(IPC_PRIVATE, xcbim->size, IPC_CREAT | 0777);
|
||||||
if (shm_info.shmid >= 0) {
|
if (shm_info.shmid >= 0) {
|
||||||
shm_info.shmaddr = xcbim->data = shmat(shm_info.shmid, 0, 0);
|
shm_info.shmaddr = xcbim->data = shmat(shm_info.shmid, 0, 0);
|
||||||
if ((shm_info.shmaddr != NULL) && (shm_info.shmaddr != (void *) -1)) {
|
if ((shm_info.shmaddr != NULL) && (shm_info.shmaddr != (void *) -1)) {
|
||||||
|
@ -364,7 +359,7 @@ _xr_image_info_get(xcb_connection_t *conn, xcb_drawable_t draw, xcb_visualid_t v
|
||||||
}
|
}
|
||||||
shmctl(shm_info.shmid, IPC_RMID, 0);
|
shmctl(shm_info.shmid, IPC_RMID, 0);
|
||||||
}
|
}
|
||||||
xcb_image_shm_destroy(xcbim);
|
xcb_image_destroy(xcbim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_image_info_list = eina_list_prepend(_image_info_list, xcbinf);
|
_image_info_list = eina_list_prepend(_image_info_list, xcbinf);
|
||||||
|
@ -378,7 +373,7 @@ _xr_image_info_free(Xcb_Image_Info *xcbinf)
|
||||||
if (xcbinf->pool)
|
if (xcbinf->pool)
|
||||||
{
|
{
|
||||||
xcb_get_input_focus_reply_t *reply;
|
xcb_get_input_focus_reply_t *reply;
|
||||||
|
|
||||||
reply = xcb_get_input_focus_reply(xcbinf->conn,
|
reply = xcb_get_input_focus_reply(xcbinf->conn,
|
||||||
xcb_get_input_focus_unchecked(xcbinf->conn),
|
xcb_get_input_focus_unchecked(xcbinf->conn),
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -450,10 +445,10 @@ _xr_image_new(Xcb_Image_Info *xcbinf, int w, int h, int depth)
|
||||||
if (xcbim->shm_info)
|
if (xcbim->shm_info)
|
||||||
{
|
{
|
||||||
xcbim->shm_info->shmseg = xcb_generate_id(xcbinf->conn);
|
xcbim->shm_info->shmseg = xcb_generate_id(xcbinf->conn);
|
||||||
xcbim->xcbim = xcb_image_shm_create(xcbim->xcbinf->conn, xcbim->depth, XCB_IMAGE_FORMAT_Z_PIXMAP, NULL, xcbim->w, xcbim->h);
|
xcbim->xcbim = xcb_image_create_native(xcbim->xcbinf->conn, xcbim->w, xcbim->h, XCB_IMAGE_FORMAT_Z_PIXMAP, xcbim->depth, NULL, ~0, NULL);
|
||||||
if (xcbim->xcbim)
|
if (xcbim->xcbim)
|
||||||
{
|
{
|
||||||
xcbim->shm_info->shmid = shmget(IPC_PRIVATE, xcbim->xcbim->bytes_per_line * xcbim->xcbim->height, IPC_CREAT | 0777);
|
xcbim->shm_info->shmid = shmget(IPC_PRIVATE, xcbim->xcbim->size, IPC_CREAT | 0777);
|
||||||
if (xcbim->shm_info->shmid >= 0)
|
if (xcbim->shm_info->shmid >= 0)
|
||||||
{
|
{
|
||||||
xcbim->shm_info->shmaddr = xcbim->xcbim->data = shmat(xcbim->shm_info->shmid, 0, 0);
|
xcbim->shm_info->shmaddr = xcbim->xcbim->data = shmat(xcbim->shm_info->shmid, 0, 0);
|
||||||
|
@ -484,19 +479,19 @@ _xr_image_new(Xcb_Image_Info *xcbinf, int w, int h, int depth)
|
||||||
}
|
}
|
||||||
shmctl(xcbim->shm_info->shmid, IPC_RMID, 0);
|
shmctl(xcbim->shm_info->shmid, IPC_RMID, 0);
|
||||||
}
|
}
|
||||||
xcb_image_shm_destroy(xcbim->xcbim);
|
xcb_image_destroy(xcbim->xcbim);
|
||||||
}
|
}
|
||||||
free(xcbim->shm_info);
|
free(xcbim->shm_info);
|
||||||
xcbim->shm_info = NULL;
|
xcbim->shm_info = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xcbim->xcbim = xcb_image_create(xcbim->xcbinf->conn, xcbim->depth, XCB_IMAGE_FORMAT_Z_PIXMAP, 0, NULL, xcbim->w, xcbim->h, 32, 0);
|
xcbim->xcbim = xcb_image_create_native(xcbim->xcbinf->conn, xcbim->w, xcbim->h, XCB_IMAGE_FORMAT_Z_PIXMAP, xcbim->depth, NULL, ~0, NULL);
|
||||||
if (!xcbim->xcbim)
|
if (!xcbim->xcbim)
|
||||||
{
|
{
|
||||||
free(xcbim);
|
free(xcbim);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
xcbim->xcbim->data = malloc(xcbim->xcbim->bytes_per_line * xcbim->xcbim->height);
|
xcbim->xcbim->data = malloc(xcbim->xcbim->size);
|
||||||
if (!xcbim->xcbim->data)
|
if (!xcbim->xcbim->data)
|
||||||
{
|
{
|
||||||
xcb_image_destroy(xcbim->xcbim);
|
xcb_image_destroy(xcbim->xcbim);
|
||||||
|
@ -508,7 +503,7 @@ _xr_image_new(Xcb_Image_Info *xcbinf, int w, int h, int depth)
|
||||||
xcbim_ok:
|
xcbim_ok:
|
||||||
_xr_image_info_pool_flush(xcbinf, 32, (1600 * 1200 * 32 * 2));
|
_xr_image_info_pool_flush(xcbinf, 32, (1600 * 1200 * 32 * 2));
|
||||||
|
|
||||||
xcbim->line_bytes = xcbim->xcbim->bytes_per_line;
|
xcbim->line_bytes = xcbim->xcbim->stride;
|
||||||
xcbim->data = (void *)(xcbim->xcbim->data);
|
xcbim->data = (void *)(xcbim->xcbim->data);
|
||||||
xcbinf->pool_mem += (xcbim->w * xcbim->h * xcbim->depth);
|
xcbinf->pool_mem += (xcbim->w * xcbim->h * xcbim->depth);
|
||||||
xcbinf->pool = eina_list_append(xcbinf->pool, xcbim);
|
xcbinf->pool = eina_list_append(xcbinf->pool, xcbim);
|
||||||
|
@ -523,14 +518,14 @@ _xr_image_free(Xcb_Image_Image *xcbim)
|
||||||
if (!xcbim->available)
|
if (!xcbim->available)
|
||||||
{
|
{
|
||||||
xcb_get_input_focus_reply_t *reply;
|
xcb_get_input_focus_reply_t *reply;
|
||||||
|
|
||||||
reply = xcb_get_input_focus_reply(xcbim->xcbinf->conn,
|
reply = xcb_get_input_focus_reply(xcbim->xcbinf->conn,
|
||||||
xcb_get_input_focus_unchecked(xcbim->xcbinf->conn),
|
xcb_get_input_focus_unchecked(xcbim->xcbinf->conn),
|
||||||
NULL);
|
NULL);
|
||||||
free(reply);
|
free(reply);
|
||||||
}
|
}
|
||||||
xcb_shm_detach(xcbim->xcbinf->conn, xcbim->shm_info->shmseg);
|
xcb_shm_detach(xcbim->xcbinf->conn, xcbim->shm_info->shmseg);
|
||||||
xcb_image_shm_destroy(xcbim->xcbim);
|
xcb_image_destroy(xcbim->xcbim);
|
||||||
shmdt(xcbim->shm_info->shmaddr);
|
shmdt(xcbim->shm_info->shmaddr);
|
||||||
shmctl(xcbim->shm_info->shmid, IPC_RMID, 0);
|
shmctl(xcbim->shm_info->shmid, IPC_RMID, 0);
|
||||||
free(xcbim->shm_info);
|
free(xcbim->shm_info);
|
||||||
|
@ -572,7 +567,7 @@ _xr_image_put(Xcb_Image_Image *xcbim, xcb_drawable_t draw, int x, int y, int w,
|
||||||
free(reply);
|
free(reply);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
xcb_image_put(xcbim->xcbinf->conn, draw, gc, xcbim->xcbim, 0, 0, x, y, w, h);
|
xcb_image_put(xcbim->xcbinf->conn, draw, gc, xcbim->xcbim, x, y, 0);
|
||||||
xcbim->available = 1;
|
xcbim->available = 1;
|
||||||
xcb_free_gc(xcbim->xcbinf->conn, gc);
|
xcb_free_gc(xcbim->xcbinf->conn, gc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ set_filter(Xcb_Render_Surface *s, int smooth)
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_render_pictforminfo_t *
|
xcb_render_pictforminfo_t *
|
||||||
xcb_render_find_visual_format (xcb_connection_t *c, xcb_visualid_t visual)
|
xcb_render_find_visual_format (xcb_connection_t *c, xcb_visualtype_t *visual)
|
||||||
{
|
{
|
||||||
xcb_render_query_pict_formats_cookie_t cookie;
|
xcb_render_query_pict_formats_cookie_t cookie;
|
||||||
xcb_render_query_pict_formats_reply_t *rep;
|
xcb_render_query_pict_formats_reply_t *rep;
|
||||||
|
@ -50,29 +50,30 @@ xcb_render_find_visual_format (xcb_connection_t *c, xcb_visualid_t visual)
|
||||||
|
|
||||||
visual_iter = xcb_render_pictdepth_visuals_iterator (depth_iter.data);
|
visual_iter = xcb_render_pictdepth_visuals_iterator (depth_iter.data);
|
||||||
for (; visual_iter.rem; xcb_render_pictvisual_next (&visual_iter)) {
|
for (; visual_iter.rem; xcb_render_pictvisual_next (&visual_iter)) {
|
||||||
if (visual == visual_iter.data->visual) {
|
if (visual->visual_id == visual_iter.data->visual) {
|
||||||
format = visual_iter.data->format;
|
format = visual_iter.data->format;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (format != 0) {
|
|
||||||
xcb_render_pictforminfo_iterator_t forminfo_iter;
|
|
||||||
|
|
||||||
forminfo_iter = xcb_render_query_pict_formats_formats_iterator (rep);
|
if (format != 0)
|
||||||
for (; forminfo_iter.rem; xcb_render_pictforminfo_next (&forminfo_iter)) {
|
{
|
||||||
if (forminfo_iter.data->id == format) {
|
xcb_render_pictforminfo_iterator_t forminfo_iter;
|
||||||
xcb_render_pictforminfo_t *forminfo;
|
|
||||||
|
|
||||||
forminfo = (xcb_render_pictforminfo_t *)malloc (sizeof (xcb_render_pictforminfo_t));
|
forminfo_iter = xcb_render_query_pict_formats_formats_iterator (rep);
|
||||||
memcpy (forminfo, forminfo_iter.data, sizeof (xcb_render_pictforminfo_t));
|
for (; forminfo_iter.rem; xcb_render_pictforminfo_next (&forminfo_iter)) {
|
||||||
free (rep);
|
if (forminfo_iter.data->id == format) {
|
||||||
|
xcb_render_pictforminfo_t *forminfo;
|
||||||
|
|
||||||
return forminfo;
|
forminfo = (xcb_render_pictforminfo_t *)malloc (sizeof (xcb_render_pictforminfo_t));
|
||||||
}
|
memcpy (forminfo, forminfo_iter.data, sizeof (xcb_render_pictforminfo_t));
|
||||||
|
free (rep);
|
||||||
|
|
||||||
|
return forminfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
free (rep);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +104,7 @@ _xr_render_surface_new(Xcb_Image_Info *xcbinf, int w, int h, xcb_render_pictform
|
||||||
rs->allocated = 1;
|
rs->allocated = 1;
|
||||||
rs->draw = xcb_generate_id(xcbinf->conn);
|
rs->draw = xcb_generate_id(xcbinf->conn);
|
||||||
xcb_create_pixmap(xcbinf->conn, fmt->depth, rs->draw, xcbinf->root, w, h);
|
xcb_create_pixmap(xcbinf->conn, fmt->depth, rs->draw, xcbinf->root, w, h);
|
||||||
if (rs->draw == 0)
|
if (rs->draw == XCB_NONE)
|
||||||
{
|
{
|
||||||
free(rs->fmt);
|
free(rs->fmt);
|
||||||
free(rs);
|
free(rs);
|
||||||
|
@ -112,11 +113,11 @@ _xr_render_surface_new(Xcb_Image_Info *xcbinf, int w, int h, xcb_render_pictform
|
||||||
rs->xcbinf->references++;
|
rs->xcbinf->references++;
|
||||||
mask = XCB_RENDER_CP_REPEAT | XCB_RENDER_CP_DITHER | XCB_RENDER_CP_COMPONENT_ALPHA;
|
mask = XCB_RENDER_CP_REPEAT | XCB_RENDER_CP_DITHER | XCB_RENDER_CP_COMPONENT_ALPHA;
|
||||||
values[0] = 0;
|
values[0] = 0;
|
||||||
values[1] = 0;
|
values[1] = 1;
|
||||||
values[2] = 0;
|
values[2] = 0;
|
||||||
rs->pic = xcb_generate_id(xcbinf->conn);
|
rs->pic = xcb_generate_id(xcbinf->conn);
|
||||||
xcb_render_create_picture(xcbinf->conn, rs->pic, rs->draw, fmt->id, mask, values);
|
xcb_render_create_picture(xcbinf->conn, rs->pic, rs->draw, fmt->id, mask, values);
|
||||||
if (rs->pic == 0)
|
if (rs->pic == XCB_NONE)
|
||||||
{
|
{
|
||||||
xcb_free_pixmap(rs->xcbinf->conn, rs->draw);
|
xcb_free_pixmap(rs->xcbinf->conn, rs->draw);
|
||||||
rs->xcbinf->references--;
|
rs->xcbinf->references--;
|
||||||
|
@ -153,7 +154,7 @@ _xr_render_surface_adopt(Xcb_Image_Info *xcbinf, xcb_drawable_t draw, int w, int
|
||||||
/* rs->fmt = xcbinf->fmt1; */
|
/* rs->fmt = xcbinf->fmt1; */
|
||||||
/* free(fmt); */
|
/* free(fmt); */
|
||||||
|
|
||||||
rs->fmt = xcb_render_find_visual_format(xcbinf->conn, xcbinf->vis);
|
rs->fmt = xcb_render_find_visual_format(xcbinf->conn, xcbinf->visual);
|
||||||
if (!rs->fmt)
|
if (!rs->fmt)
|
||||||
{
|
{
|
||||||
free(rs);
|
free(rs);
|
||||||
|
@ -167,11 +168,11 @@ _xr_render_surface_adopt(Xcb_Image_Info *xcbinf, xcb_drawable_t draw, int w, int
|
||||||
rs->xcbinf->references++;
|
rs->xcbinf->references++;
|
||||||
mask = XCB_RENDER_CP_REPEAT | XCB_RENDER_CP_DITHER | XCB_RENDER_CP_COMPONENT_ALPHA;
|
mask = XCB_RENDER_CP_REPEAT | XCB_RENDER_CP_DITHER | XCB_RENDER_CP_COMPONENT_ALPHA;
|
||||||
values[0] = 0;
|
values[0] = 0;
|
||||||
values[1] = 0;
|
values[1] = 1;
|
||||||
values[2] = 0;
|
values[2] = 0;
|
||||||
rs->pic = xcb_generate_id(xcbinf->conn);
|
rs->pic = xcb_generate_id(xcbinf->conn);
|
||||||
xcb_render_create_picture(xcbinf->conn, rs->pic, rs->draw, rs->fmt->id, mask, values);
|
xcb_render_create_picture(xcbinf->conn, rs->pic, rs->draw, rs->fmt->id, mask, values);
|
||||||
if (rs->pic == 0)
|
if (rs->pic == XCB_NONE)
|
||||||
{
|
{
|
||||||
rs->xcbinf->references--;
|
rs->xcbinf->references--;
|
||||||
free(rs->fmt);
|
free(rs->fmt);
|
||||||
|
@ -189,7 +190,7 @@ _xr_render_surface_format_adopt(Xcb_Image_Info *xcbinf, xcb_drawable_t draw, int
|
||||||
uint32_t mask;
|
uint32_t mask;
|
||||||
uint32_t values[3];
|
uint32_t values[3];
|
||||||
|
|
||||||
if ((!xcbinf) || (!fmt) || (draw == 0) || (w < 1) || (h < 1)) return NULL;
|
if ((!xcbinf) || (!fmt) || (draw == XCB_NONE) || (w < 1) || (h < 1)) return NULL;
|
||||||
rs = calloc(1, sizeof(Xcb_Render_Surface));
|
rs = calloc(1, sizeof(Xcb_Render_Surface));
|
||||||
if (!rs) return NULL;
|
if (!rs) return NULL;
|
||||||
rs->xcbinf = xcbinf;
|
rs->xcbinf = xcbinf;
|
||||||
|
@ -205,11 +206,11 @@ _xr_render_surface_format_adopt(Xcb_Image_Info *xcbinf, xcb_drawable_t draw, int
|
||||||
rs->draw = draw;
|
rs->draw = draw;
|
||||||
mask = XCB_RENDER_CP_REPEAT | XCB_RENDER_CP_DITHER | XCB_RENDER_CP_COMPONENT_ALPHA;
|
mask = XCB_RENDER_CP_REPEAT | XCB_RENDER_CP_DITHER | XCB_RENDER_CP_COMPONENT_ALPHA;
|
||||||
values[0] = 0;
|
values[0] = 0;
|
||||||
values[1] = 0;
|
values[1] = 1;
|
||||||
values[2] = 0;
|
values[2] = 0;
|
||||||
rs->pic = xcb_generate_id(xcbinf->conn);
|
rs->pic = xcb_generate_id(xcbinf->conn);
|
||||||
xcb_render_create_picture(xcbinf->conn, rs->pic, rs->draw, fmt->id, mask, values);
|
xcb_render_create_picture(xcbinf->conn, rs->pic, rs->draw, fmt->id, mask, values);
|
||||||
if (rs->pic == 0)
|
if (rs->pic == XCB_NONE)
|
||||||
{
|
{
|
||||||
rs->xcbinf->references--;
|
rs->xcbinf->references--;
|
||||||
free(rs->fmt);
|
free(rs->fmt);
|
||||||
|
@ -226,9 +227,9 @@ _xr_render_surface_free(Xcb_Render_Surface *rs)
|
||||||
if (!rs) return;
|
if (!rs) return;
|
||||||
if (rs->xcbinf)
|
if (rs->xcbinf)
|
||||||
{
|
{
|
||||||
if ((rs->allocated) && (rs->draw != 0))
|
if ((rs->allocated) && (rs->draw != XCB_NONE))
|
||||||
xcb_free_pixmap(rs->xcbinf->conn, rs->draw);
|
xcb_free_pixmap(rs->xcbinf->conn, rs->draw);
|
||||||
if (rs->pic != 0)
|
if (rs->pic != XCB_NONE)
|
||||||
xcb_render_free_picture(rs->xcbinf->conn, rs->pic);
|
xcb_render_free_picture(rs->xcbinf->conn, rs->pic);
|
||||||
_xr_image_info_free(rs->xcbinf);
|
_xr_image_info_free(rs->xcbinf);
|
||||||
rs->xcbinf = NULL;
|
rs->xcbinf = NULL;
|
||||||
|
@ -253,12 +254,7 @@ _xr_render_surface_solid_rectangle_set(Xcb_Render_Surface *rs, int r, int g, int
|
||||||
{
|
{
|
||||||
xcb_render_color_t col;
|
xcb_render_color_t col;
|
||||||
xcb_rectangle_t rect;
|
xcb_rectangle_t rect;
|
||||||
int aa;
|
|
||||||
|
|
||||||
aa = a + 1;
|
|
||||||
r = (r * aa) >> 8;
|
|
||||||
g = (g * aa) >> 8;
|
|
||||||
b = (b * aa) >> 8;
|
|
||||||
col.red = (r << 8) | r;
|
col.red = (r << 8) | r;
|
||||||
col.green = (g << 8) | g;
|
col.green = (g << 8) | g;
|
||||||
col.blue = (b << 8) | b;
|
col.blue = (b << 8) | b;
|
||||||
|
@ -271,12 +267,11 @@ _xr_render_surface_solid_rectangle_set(Xcb_Render_Surface *rs, int r, int g, int
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_xr_render_surface_argb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void *pixels, int x, int y, int w, int h)
|
_xr_render_surface_argb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void *pixels, int x, int y, int w, int h, int ox, int oy)
|
||||||
{
|
{
|
||||||
Xcb_Image_Image *xcbim;
|
Xcb_Image_Image *xcbim;
|
||||||
unsigned int *p, *sp, *sple, *spe;
|
unsigned int *p, *sp, *sple, *spe;
|
||||||
unsigned int jump, sjump;
|
unsigned int jump, sjump;
|
||||||
unsigned int a, r, g, b, aa;
|
|
||||||
|
|
||||||
xcbim = _xr_image_new(rs->xcbinf, w, h, rs->depth);
|
xcbim = _xr_image_new(rs->xcbinf, w, h, rs->depth);
|
||||||
if (!xcbim) return;
|
if (!xcbim) return;
|
||||||
|
@ -287,9 +282,9 @@ _xr_render_surface_argb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void
|
||||||
spe = sp + ((h - 1) * sw) + w;
|
spe = sp + ((h - 1) * sw) + w;
|
||||||
if
|
if
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
(xcbim->xcbim->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST)
|
(xcbim->xcbim->byte_order == XCB_IMAGE_ORDER_LSB_FIRST)
|
||||||
#else
|
#else
|
||||||
(xcbim->xcbim->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
|
(xcbim->xcbim->byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
while (sp < spe)
|
while (sp < spe)
|
||||||
|
@ -297,23 +292,8 @@ _xr_render_surface_argb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void
|
||||||
sple = sp + w;
|
sple = sp + w;
|
||||||
while (sp < sple)
|
while (sp < sple)
|
||||||
{
|
{
|
||||||
switch (a = A_VAL(sp))
|
*p++ = (*sp << 24) + ((*sp << 8) & 0xff0000) + ((*sp >> 8) & 0xff00) + (*sp >> 24);
|
||||||
{
|
// *p++ = (B_VAL(sp) << 24) | (G_VAL(sp) << 16) | (R_VAL(sp) << 8) | A_VAL(sp);
|
||||||
case 0:
|
|
||||||
*p = 0;
|
|
||||||
break;
|
|
||||||
case 255:
|
|
||||||
*p = (B_VAL(sp) << 24) | (G_VAL(sp) << 16) | (R_VAL(sp) << 8) | 0xff;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
aa = a + 1;
|
|
||||||
r = ((R_VAL(sp)) * aa) >> 8;
|
|
||||||
g = ((G_VAL(sp)) * aa) >> 8;
|
|
||||||
b = ((B_VAL(sp)) * aa) >> 8;
|
|
||||||
*p = (b << 24) | (g << 16) | (r << 8) | a;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
sp++;
|
sp++;
|
||||||
}
|
}
|
||||||
p += jump;
|
p += jump;
|
||||||
|
@ -326,33 +306,16 @@ _xr_render_surface_argb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void
|
||||||
{
|
{
|
||||||
sple = sp + w;
|
sple = sp + w;
|
||||||
while (sp < sple)
|
while (sp < sple)
|
||||||
{
|
*p++ = *sp++;
|
||||||
switch (a = (*sp & 0xff000000))
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
*p = 0;
|
|
||||||
break;
|
|
||||||
case 0xff000000:
|
|
||||||
*p = *sp;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
aa = (a >> 24) + 1;
|
|
||||||
*p = a + (((((*sp) >> 8) & 0xff) * aa) & 0xff00) +
|
|
||||||
(((((*sp) & 0x00ff00ff) * aa) >> 8) & 0x00ff00ff);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
p++;
|
|
||||||
sp++;
|
|
||||||
}
|
|
||||||
p += jump;
|
p += jump;
|
||||||
sp += sjump;
|
sp += sjump;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_xr_image_put(xcbim, rs->draw, x, y, w, h);
|
_xr_image_put(xcbim, rs->draw, x + ox, y + oy, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_xr_render_surface_rgb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void *pixels, int x, int y, int w, int h)
|
_xr_render_surface_rgb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void *pixels, int x, int y, int w, int h, int ox, int oy)
|
||||||
{
|
{
|
||||||
Xcb_Image_Image *xcbim;
|
Xcb_Image_Image *xcbim;
|
||||||
unsigned int *p, *sp, *sple, *spe;
|
unsigned int *p, *sp, *sple, *spe;
|
||||||
|
@ -362,45 +325,66 @@ _xr_render_surface_rgb_pixels_fill(Xcb_Render_Surface *rs, int sw, int sh, void
|
||||||
if (!xcbim) return;
|
if (!xcbim) return;
|
||||||
p = (unsigned int *)xcbim->data;
|
p = (unsigned int *)xcbim->data;
|
||||||
sp = ((unsigned int *)pixels) + (y * sw) + x;
|
sp = ((unsigned int *)pixels) + (y * sw) + x;
|
||||||
jump = ((xcbim->line_bytes / 4) - w);
|
|
||||||
sjump = sw - w;
|
sjump = sw - w;
|
||||||
spe = sp + ((h - 1) * sw) + w;
|
spe = sp + ((h - 1) * sw) + w;
|
||||||
if
|
if (rs->depth == 16)
|
||||||
#ifdef WORDS_BIGENDIAN
|
|
||||||
(xcbim->xcbim->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST)
|
|
||||||
#else
|
|
||||||
(xcbim->xcbim->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
while (sp < spe)
|
/* FIXME: if rs->depth == 16 - convert */
|
||||||
{
|
Gfx_Func_Convert conv_func;
|
||||||
sple = sp + w;
|
int swap;
|
||||||
while (sp < sple)
|
|
||||||
{
|
jump = ((xcbim->line_bytes / 2) - w);
|
||||||
*p = ((B_VAL(sp)) << 24) | ((G_VAL(sp)) << 16) | ((R_VAL(sp)) << 8) | 0x000000ff;
|
|
||||||
p++;
|
#ifdef WORDS_BIGENDIAN
|
||||||
sp++;
|
swap = (int)(xcbim->xcbim->byte_order == XCB_IMAGE_ORDER_LSB_FIRST);
|
||||||
}
|
#else
|
||||||
p += jump;
|
swap = (int)(xcbim->xcbim->byte_order == XCB_IMAGE_ORDER_MSB_FIRST);
|
||||||
sp += sjump;
|
#endif
|
||||||
}
|
/* FIXME: swap not handled */
|
||||||
|
conv_func = evas_common_convert_func_get(sp, w, h, rs->depth,
|
||||||
|
rs->xcbinf->visual->red_mask,
|
||||||
|
rs->xcbinf->visual->green_mask,
|
||||||
|
rs->xcbinf->visual->blue_mask,
|
||||||
|
PAL_MODE_NONE, 0);
|
||||||
|
if (conv_func)
|
||||||
|
conv_func(sp, p, sjump, jump, w, h, x, y, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (sp < spe)
|
jump = ((xcbim->line_bytes / 4) - w);
|
||||||
|
if
|
||||||
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
(xcbim->xcbim->byte_order == XCB_IMAGE_ORDER_LSB_FIRST)
|
||||||
|
#else
|
||||||
|
(xcbim->xcbim->byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
while (sp < spe)
|
||||||
|
{
|
||||||
|
sple = sp + w;
|
||||||
|
while (sp < sple)
|
||||||
|
{
|
||||||
|
*p++ = (*sp << 24) + ((*sp << 8) & 0xff0000) + ((*sp >> 8) & 0xff00) + 0xff;
|
||||||
|
// *p++ = ((B_VAL(sp)) << 24) | ((G_VAL(sp)) << 16) | ((R_VAL(sp)) << 8) | 0x000000ff;
|
||||||
|
sp++;
|
||||||
|
}
|
||||||
|
p += jump;
|
||||||
|
sp += sjump;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
sple = sp + w;
|
while (sp < spe)
|
||||||
while (sp < sple)
|
|
||||||
{
|
{
|
||||||
*p = 0xff000000 | *sp;
|
sple = sp + w;
|
||||||
p++;
|
while (sp < sple)
|
||||||
sp++;
|
*p++ = 0xff000000 | *sp++;
|
||||||
|
p += jump;
|
||||||
|
sp += sjump;
|
||||||
}
|
}
|
||||||
p += jump;
|
|
||||||
sp += sjump;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_xr_image_put(xcbim, rs->draw, x, y, w, h);
|
_xr_image_put(xcbim, rs->draw, x + ox, y + oy, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -464,14 +448,18 @@ set_transform_scale(xcb_render_transform_t *t,
|
||||||
int sw,
|
int sw,
|
||||||
int sh,
|
int sh,
|
||||||
int w,
|
int w,
|
||||||
int h)
|
int h,
|
||||||
|
int tx,
|
||||||
|
int ty)
|
||||||
{
|
{
|
||||||
if ((sw > 1) && (w > 1))
|
/* if ((sw > 1) && (w > 1)) */
|
||||||
{ sw--; w--; }
|
/* { sw--; w--; } */
|
||||||
if ((sh > 1) && (h > 1))
|
/* if ((sh > 1) && (h > 1)) */
|
||||||
{ sh--; h--; }
|
/* { sh--; h--; } */
|
||||||
t->matrix11 = DOUBLE_TO_FIXED((double)sw / (double)w);
|
t->matrix11 = DOUBLE_TO_FIXED((double)sw / (double)w);
|
||||||
t->matrix22 = DOUBLE_TO_FIXED((double)sh / (double)h);
|
t->matrix22 = DOUBLE_TO_FIXED((double)sh / (double)h);
|
||||||
|
t->matrix31 = (tx * sw) / w;
|
||||||
|
t->matrix32 = (ty * sh) / h;
|
||||||
}
|
}
|
||||||
|
|
||||||
// when color multiplier is used want: instead
|
// when color multiplier is used want: instead
|
||||||
|
@ -498,7 +486,7 @@ _xr_render_surface_composite(Xcb_Render_Surface *srs,
|
||||||
int e, is_scaling;
|
int e, is_scaling;
|
||||||
xcb_render_pict_op_t op;
|
xcb_render_pict_op_t op;
|
||||||
|
|
||||||
if ((sw < 1) || (sh < 1) || (w < 1) || (h < 1)) return;
|
if ((sw <= 0) || (sh <= 0) || (w <= 0) || (h <= 0)) return;
|
||||||
|
|
||||||
is_scaling = e = (sw != w) || (sh != h);
|
is_scaling = e = (sw != w) || (sh != h);
|
||||||
|
|
||||||
|
@ -560,40 +548,35 @@ _xr_render_surface_composite(Xcb_Render_Surface *srs,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((srs->alpha) || (a != 0xff))
|
if ((srs->alpha) || (a != 0xff))
|
||||||
trs = _xr_render_surface_new(srs->xcbinf, sw + e, sh + e,
|
trs = _xr_render_surface_new(srs->xcbinf, sw + 2, sh + 2,
|
||||||
srs->xcbinf->fmt32, 1);
|
srs->xcbinf->fmt32, 1);
|
||||||
else
|
else
|
||||||
trs = _xr_render_surface_new(srs->xcbinf, sw + e, sh + e,
|
trs = _xr_render_surface_new(srs->xcbinf, sw + 2, sh + 2,
|
||||||
srs->fmt, srs->alpha);
|
srs->fmt, srs->alpha);
|
||||||
if (!trs) return;
|
if (!trs) return;
|
||||||
|
|
||||||
value_mask = XCB_RENDER_CP_COMPONENT_ALPHA;
|
value_mask = XCB_RENDER_CP_COMPONENT_ALPHA;
|
||||||
value_list[0] = 0;
|
value_list[0] = 1;
|
||||||
xcb_render_change_picture(srs->xcbinf->conn, mask, value_mask, value_list);
|
xcb_render_change_picture(srs->xcbinf->conn, mask, value_mask, value_list);
|
||||||
xcb_render_set_picture_transform(trs->xcbinf->conn, srs->pic, xf);
|
xcb_render_set_picture_transform(trs->xcbinf->conn, srs->pic, xf);
|
||||||
xcb_render_composite(srs->xcbinf->conn, XCB_RENDER_PICT_OP_SRC, srs->pic, mask, trs->pic,
|
xcb_render_composite(srs->xcbinf->conn, XCB_RENDER_PICT_OP_SRC, srs->pic, mask, trs->pic,
|
||||||
sx, sy, 0, 0, 0, 0, sw, sh);
|
sx, sy, sx, sy, 0, 0, sw + 2, sh + 2);
|
||||||
/* fill right and bottom pixel so interpolation works right */
|
|
||||||
if (e)
|
|
||||||
{
|
|
||||||
xcb_render_composite(srs->xcbinf->conn, XCB_RENDER_PICT_OP_SRC, srs->pic, mask, trs->pic,
|
|
||||||
sx + sw - 1, sy, 0, 0, sw, 0, 1, sh);
|
|
||||||
xcb_render_composite(srs->xcbinf->conn, XCB_RENDER_PICT_OP_SRC, srs->pic, mask, trs->pic,
|
|
||||||
sx, sy + sh - 1, 0, 0, 0, sh, sw, 1);
|
|
||||||
xcb_render_composite(srs->xcbinf->conn, XCB_RENDER_PICT_OP_SRC, srs->pic, mask, trs->pic,
|
|
||||||
sx + sw - 1, sy + sh - 1, 0, 0, sw, sh, 1, 1);
|
|
||||||
}
|
|
||||||
mask = XCB_NONE;
|
mask = XCB_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//#define HFW + (sw / 2)
|
||||||
|
//#define HFH + (sh / 2)
|
||||||
|
#define HFW
|
||||||
|
#define HFH
|
||||||
|
|
||||||
_xr_render_surface_clips_set(drs, dc, x, y, w, h);
|
_xr_render_surface_clips_set(drs, dc, x, y, w, h);
|
||||||
if (trs)
|
if (trs)
|
||||||
{
|
{
|
||||||
set_filter(trs, smooth);
|
set_filter(trs, smooth);
|
||||||
|
|
||||||
set_transform_scale(&xf, sw, sh, w, h);
|
set_transform_scale(&xf, sw, sh, w, h, -1, -1);
|
||||||
xcb_render_set_picture_transform(trs->xcbinf->conn, trs->pic, xf);
|
xcb_render_set_picture_transform(trs->xcbinf->conn, trs->pic, xf);
|
||||||
|
|
||||||
value_mask = XCB_RENDER_CP_COMPONENT_ALPHA;
|
value_mask = XCB_RENDER_CP_COMPONENT_ALPHA;
|
||||||
|
@ -603,14 +586,16 @@ _xr_render_surface_composite(Xcb_Render_Surface *srs,
|
||||||
xcb_render_change_picture(trs->xcbinf->conn, trs->pic, value_mask, value_list);
|
xcb_render_change_picture(trs->xcbinf->conn, trs->pic, value_mask, value_list);
|
||||||
|
|
||||||
xcb_render_composite(trs->xcbinf->conn, op, trs->pic, mask, drs->pic,
|
xcb_render_composite(trs->xcbinf->conn, op, trs->pic, mask, drs->pic,
|
||||||
0, 0, 0, 0, x, y, w, h);
|
(w HFW) / sw, (h HFH) / sh,
|
||||||
|
(w HFW) / sw, (h HFH) / sh,
|
||||||
|
x, y, w, h);
|
||||||
_xr_render_surface_free(trs);
|
_xr_render_surface_free(trs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (srs->bordered && is_scaling)
|
if (srs->bordered && is_scaling)
|
||||||
{
|
{
|
||||||
trs = _xr_render_surface_new(srs->xcbinf, sw + 1, sh + 1,
|
trs = _xr_render_surface_new(srs->xcbinf, sw + 2, sh + 2,
|
||||||
srs->fmt, srs->alpha);
|
srs->fmt, srs->alpha);
|
||||||
if (!trs) return;
|
if (!trs) return;
|
||||||
|
|
||||||
|
@ -619,18 +604,11 @@ _xr_render_surface_composite(Xcb_Render_Surface *srs,
|
||||||
xcb_render_change_picture(srs->xcbinf->conn, srs->pic, value_mask, value_list);
|
xcb_render_change_picture(srs->xcbinf->conn, srs->pic, value_mask, value_list);
|
||||||
xcb_render_set_picture_transform(srs->xcbinf->conn, srs->pic, xf);
|
xcb_render_set_picture_transform(srs->xcbinf->conn, srs->pic, xf);
|
||||||
xcb_render_composite(srs->xcbinf->conn, XCB_RENDER_PICT_OP_SRC, srs->pic, XCB_NONE, trs->pic,
|
xcb_render_composite(srs->xcbinf->conn, XCB_RENDER_PICT_OP_SRC, srs->pic, XCB_NONE, trs->pic,
|
||||||
sx, sy, 0, 0, 0, 0, sw, sh);
|
sx, sy, sx, sx, 0, 0, sw + 2, sh + 2);
|
||||||
|
|
||||||
xcb_render_composite(srs->xcbinf->conn, XCB_RENDER_PICT_OP_SRC, srs->pic, XCB_NONE, trs->pic,
|
|
||||||
sx + sw - 1, sy, 0, 0, sw, 0, 1, sh);
|
|
||||||
xcb_render_composite(srs->xcbinf->conn, XCB_RENDER_PICT_OP_SRC, srs->pic, XCB_NONE, trs->pic,
|
|
||||||
sx, sy + sh - 1, 0, 0, 0, sh, sw, 1);
|
|
||||||
xcb_render_composite(srs->xcbinf->conn, XCB_RENDER_PICT_OP_SRC, srs->pic, XCB_NONE, trs->pic,
|
|
||||||
sx + sw - 1, sy + sh - 1, 0, 0, sw, sh, 1, 1);
|
|
||||||
|
|
||||||
set_filter(trs, smooth);
|
set_filter(trs, smooth);
|
||||||
|
|
||||||
set_transform_scale(&xf, sw, sh, w, h);
|
set_transform_scale(&xf, sw, sh, w, h, -1, -1);
|
||||||
xcb_render_set_picture_transform(trs->xcbinf->conn, trs->pic, xf);
|
xcb_render_set_picture_transform(trs->xcbinf->conn, trs->pic, xf);
|
||||||
|
|
||||||
if (dc->render_op == _EVAS_RENDER_MUL)
|
if (dc->render_op == _EVAS_RENDER_MUL)
|
||||||
|
@ -641,14 +619,16 @@ _xr_render_surface_composite(Xcb_Render_Surface *srs,
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_render_composite(trs->xcbinf->conn, op, trs->pic, mask, drs->pic,
|
xcb_render_composite(trs->xcbinf->conn, op, trs->pic, mask, drs->pic,
|
||||||
0, 0, 0, 0, x, y, w, h);
|
(w HFW) / sw, (h HFH) / sh,
|
||||||
|
(w HFW) / sw, (h HFH) / sh,
|
||||||
|
x, y, w, h);
|
||||||
_xr_render_surface_free(trs);
|
_xr_render_surface_free(trs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_filter(srs, smooth);
|
set_filter(srs, smooth);
|
||||||
|
|
||||||
set_transform_scale(&xf, sw, sh, w, h);
|
set_transform_scale(&xf, sw, sh, w, h, 0, 0);
|
||||||
xcb_render_set_picture_transform(srs->xcbinf->conn, srs->pic, xf);
|
xcb_render_set_picture_transform(srs->xcbinf->conn, srs->pic, xf);
|
||||||
|
|
||||||
value_mask = XCB_RENDER_CP_COMPONENT_ALPHA;
|
value_mask = XCB_RENDER_CP_COMPONENT_ALPHA;
|
||||||
|
@ -658,9 +638,11 @@ _xr_render_surface_composite(Xcb_Render_Surface *srs,
|
||||||
xcb_render_change_picture(srs->xcbinf->conn, srs->pic, value_mask, value_list);
|
xcb_render_change_picture(srs->xcbinf->conn, srs->pic, value_mask, value_list);
|
||||||
|
|
||||||
xcb_render_composite(srs->xcbinf->conn, op, srs->pic, mask, drs->pic,
|
xcb_render_composite(srs->xcbinf->conn, op, srs->pic, mask, drs->pic,
|
||||||
((sx * w) + (sw / 2)) / sw,
|
((((sx + 1) * w) HFW) / sw),
|
||||||
((sy * h) + (sh / 2)) / sh,
|
((((sy + 1) * h) HFH) / sh),
|
||||||
0, 0, x, y, w, h);
|
((((sx + 1) * w) HFW) / sw),
|
||||||
|
((((sy + 1) * h) HFH) / sh),
|
||||||
|
x, y, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -672,7 +654,7 @@ _xr_render_surface_copy(Xcb_Render_Surface *srs, Xcb_Render_Surface *drs, int sx
|
||||||
uint32_t value_mask;
|
uint32_t value_mask;
|
||||||
uint32_t value_list[1];
|
uint32_t value_list[1];
|
||||||
|
|
||||||
if ((w < 1) || (h < 1) || (!srs) || (!drs)) return;
|
if ((w <= 0) || (h <= 0) || (!srs) || (!drs)) return;
|
||||||
|
|
||||||
init_transform(&xf);
|
init_transform(&xf);
|
||||||
#ifdef BROKEN_XORG_XRENDER
|
#ifdef BROKEN_XORG_XRENDER
|
||||||
|
@ -707,7 +689,7 @@ _xr_render_surface_rectangle_draw(Xcb_Render_Surface *rs, RGBA_Draw_Context *dc,
|
||||||
xcb_render_pict_op_t op;
|
xcb_render_pict_op_t op;
|
||||||
|
|
||||||
if ((!rs) || (!dc)) return;
|
if ((!rs) || (!dc)) return;
|
||||||
if ((w < 1) || (h < 1)) return;
|
if ((w <= 0) || (h <= 0)) return;
|
||||||
a = dc->col.col >> 24;
|
a = dc->col.col >> 24;
|
||||||
r = (dc->col.col >> 16) & 0xff;
|
r = (dc->col.col >> 16) & 0xff;
|
||||||
g = (dc->col.col >> 8 ) & 0xff;
|
g = (dc->col.col >> 8 ) & 0xff;
|
||||||
|
|
Loading…
Reference in New Issue