stubs for Xfree86 Render extension support. STUBS only now. will get filled in


			
			
				devs/devilhorns/wayland_egl
			
			
		
Carsten Haitzler 23 years ago
parent 9e610f2bc3
commit 8a740e5fa4
  1. 1
      legacy/evas/acconfig.h
  2. 2
      legacy/evas/src/Makefile.am
  3. 20
      legacy/evas/src/evas_gradient.c
  4. 9
      legacy/evas/src/evas_misc.c
  5. 32
      legacy/evas/src/evas_render.c
  6. 787
      legacy/evas/src/evas_render_routines.c
  7. 122
      legacy/evas/src/evas_render_routines.h
  8. 121
      legacy/evas/src/evas_text.c

@ -1,2 +1,3 @@
#undef HAVE_GL
#undef HAVE_GLU
#undef HAVE_RENDER

@ -52,6 +52,8 @@ evas_x11_routines.c \
evas_image_routines.h \
evas_imlib_routines.h \
evas_x11_routines.h \
evas_render_routines.c \
evas_render_routines.h \
Evas.h \
Evas_private.h

@ -8,6 +8,7 @@
#include "evas_imlib_routines.h"
#include "evas_image_routines.h"
#include "evas_x11_routines.h"
#include "evas_render_routines.h"
static void
_evas_free_gradient_box(Evas_Object o)
@ -41,6 +42,8 @@ _evas_free_gradient_box_renderer_data(Evas e, Evas_Object o)
__evas_gl_gradient_free(o->renderer_data.method[e->current.render_method]);
break;
case RENDER_METHOD_ALPHA_HARDWARE:
if (o->renderer_data.method[e->current.render_method])
__evas_render_gradient_free(o->renderer_data.method[e->current.render_method]);
break;
case RENDER_METHOD_IMAGE:
if (o->renderer_data.method[e->current.render_method])
@ -164,6 +167,23 @@ evas_set_gradient(Evas e, Evas_Object o, Evas_Gradient grad)
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
if (o->renderer_data.method[e->current.render_method])
__evas_render_gradient_free(o->renderer_data.method[e->current.render_method]);
{
Evas_Image_Graident *g;
Evas_List l;
g = __evas_render_gradient_new(e->current.display);
o->renderer_data.method[e->current.render_method] = g;
for (l = grad->color_points; l; l = l->next)
{
Evas_Color_Point col;
col= l->data;
__evas_render_gradient_color_add(g, col->r, col->g, col->b,
col->a, col->distance);
}
}
break;
case RENDER_METHOD_IMAGE:
if (o->renderer_data.method[e->current.render_method])

@ -8,6 +8,7 @@
#include "evas_imlib_routines.h"
#include "evas_image_routines.h"
#include "evas_x11_routines.h"
#include "evas_render_routines.h"
void _evas_layer_free(Evas e, Evas_Layer layer);
@ -328,6 +329,7 @@ evas_set_font_cache(Evas e, int size)
__evas_gl_text_cache_set_size(e->current.display, size);
break;
case RENDER_METHOD_ALPHA_HARDWARE:
__evas_render_text_cache_set_size(e->current.display, size);
break;
case RENDER_METHOD_IMAGE:
__evas_image_text_cache_set_size(e->current.display, size);
@ -354,6 +356,7 @@ evas_get_font_cache(Evas e)
return __evas_gl_text_cache_get_size(e->current.display);
break;
case RENDER_METHOD_ALPHA_HARDWARE:
return __evas_render_text_cache_get_size(e->current.display);
break;
case RENDER_METHOD_IMAGE:
return __evas_image_text_cache_get_size(e->current.display);
@ -381,6 +384,7 @@ evas_flush_font_cache(Evas e)
__evas_gl_text_cache_empty(e->current.display);
break;
case RENDER_METHOD_ALPHA_HARDWARE:
__evas_render_text_cache_empty(e->current.display);
break;
case RENDER_METHOD_IMAGE:
__evas_image_text_cache_empty(e->current.display);
@ -407,6 +411,7 @@ evas_set_image_cache(Evas e, int size)
__evas_gl_image_cache_set_size(e->current.display, size);
break;
case RENDER_METHOD_ALPHA_HARDWARE:
__evas_render_image_cache_set_size(e->current.display, size);
break;
case RENDER_METHOD_IMAGE:
__evas_image_image_cache_set_size(e->current.display, size);
@ -433,6 +438,7 @@ evas_get_image_cache(Evas e)
return __evas_gl_image_cache_get_size(e->current.display);
break;
case RENDER_METHOD_ALPHA_HARDWARE:
return __evas_render_image_cache_get_size(e->current.display);
break;
case RENDER_METHOD_IMAGE:
return __evas_image_image_cache_get_size(e->current.display);
@ -460,6 +466,7 @@ evas_flush_image_cache(Evas e)
__evas_gl_image_cache_empty(e->current.display);
break;
case RENDER_METHOD_ALPHA_HARDWARE:
__evas_render_image_cache_empty(e->current.display);
break;
case RENDER_METHOD_IMAGE:
__evas_image_image_cache_empty(e->current.display);
@ -488,6 +495,7 @@ evas_font_add_path(Evas e, char *path)
__evas_gl_text_font_add_path(path);
break;
case RENDER_METHOD_ALPHA_HARDWARE:
__evas_render_text_font_add_path(path);
break;
case RENDER_METHOD_IMAGE:
__evas_image_text_font_add_path(path);
@ -515,6 +523,7 @@ evas_font_del_path(Evas e, char *path)
__evas_gl_text_font_del_path(path);
break;
case RENDER_METHOD_ALPHA_HARDWARE:
__evas_render_text_font_del_path(path);
break;
case RENDER_METHOD_IMAGE:
__evas_image_text_font_del_path(path);

@ -8,6 +8,7 @@
#include "evas_imlib_routines.h"
#include "evas_image_routines.h"
#include "evas_x11_routines.h"
#include "evas_render_routines.h"
#ifndef SPANS_COMMON
#define SPANS_COMMON(x1, w1, x2, w2) \
@ -243,6 +244,22 @@ evas_render(Evas e)
func_poly_draw = __evas_gl_poly_draw;
break;
case RENDER_METHOD_ALPHA_HARDWARE:
func_draw_add_rect = __evas_render_draw_add_rect;
func_image_new_from_file = __evas_render_image_new_from_file;
func_image_set_borders = __evas_render_image_set_borders;
func_image_draw = __evas_render_image_draw;
func_image_free = __evas_render_image_free;
func_flush_draw = __evas_render_flush_draw;
func_init = __evas_render_init;
func_image_get_width = __evas_render_image_get_width;
func_image_get_height = __evas_render_image_get_height;
func_text_font_new = __evas_render_text_font_new;
func_text_font_free = __evas_render_text_font_free;
func_text_draw = __evas_render_text_draw;
func_rectangle_draw = __evas_render_rectangle_draw;
func_line_draw = __evas_render_line_draw;
func_gradient_draw = __evas_render_gradient_draw;
func_poly_draw = __evas_render_poly_draw;
break;
case RENDER_METHOD_IMAGE:
func_draw_add_rect = __evas_image_draw_add_rect;
@ -800,6 +817,13 @@ evas_get_optimal_visual(Evas e, Display *disp)
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
if (__evas_render_capable(disp))
return __evas_render_get_visual(disp, e->current.screen);
else
{
e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE;
return evas_get_optimal_visual(e, disp);
}
break;
case RENDER_METHOD_IMAGE:
if (__evas_image_capable(disp))
@ -846,6 +870,13 @@ evas_get_optimal_colormap(Evas e, Display *disp)
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
if (__evas_render_capable(disp))
return __evas_render_get_colormap(disp, e->current.screen);
else
{
e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE;
return evas_get_optimal_colormap(e, disp);
}
break;
case RENDER_METHOD_IMAGE:
if (__evas_image_capable(disp))
@ -966,6 +997,7 @@ evas_set_scale_smoothness(Evas e, int smooth)
__evas_gl_image_set_smooth_scaling(smooth);
break;
case RENDER_METHOD_ALPHA_HARDWARE:
__evas_render_image_set_smooth_scaling(smooth);
break;
case RENDER_METHOD_IMAGE:
__evas_image_image_set_smooth_scaling(smooth);

@ -0,0 +1,787 @@
#include "evas_render_routines.h"
#ifdef HAVE_RENDER
static void __evas_render_image_cache_flush(Display *disp);
static int __evas_anti_alias = 1;
static Evas_List drawable_list = NULL;
/*****************************************************************************/
/* image internals ***********************************************************/
/*****************************************************************************/
static void
__evas_render_image_cache_flush(Display *disp)
{
int size;
size = imlib_get_cache_size();
imlib_set_cache_size(0);
imlib_set_cache_size(size);
}
/*****************************************************************************/
/* image externals ***********************************************************/
/*****************************************************************************/
Evas_Render_Image *
__evas_render_image_new_from_file(Display *disp, char *file)
{
return NULL;
}
void
__evas_render_image_free(Evas_Render_Image *im)
{
}
void
__evas_render_image_cache_empty(Display *disp)
{
int size;
size = imlib_get_cache_size();
imlib_set_cache_size(0);
imlib_set_cache_size(size);
}
void
__evas_render_image_cache_set_size(Display *disp, int size)
{
imlib_set_cache_size(size);
}
int
__evas_render_image_cache_get_size(Display *disp)
{
return imlib_get_cache_size();
}
void
__evas_render_image_draw(Evas_Render_Image *im,
Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h,
int src_x, int src_y, int src_w, int src_h,
int dst_x, int dst_y, int dst_w, int dst_h,
int cr, int cg, int cb, int ca)
{
Evas_List l;
if (ca == 0) return;
for(l = drawable_list; l; l = l->next)
{
Evas_Render_Drawable *dr;
dr = l->data;
if ((dr->win == w) && (dr->disp == disp))
{
Evas_List ll;
for (ll = dr->tmp_images; ll; ll = ll->next)
{
Evas_Render_Update *up;
up = ll->data;
/* if image intersects image update - render */
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
dst_x, dst_y, dst_w, dst_h))
{
}
}
}
}
}
int
__evas_render_image_get_width(Evas_Render_Image *im)
{
return 0;
}
int
__evas_render_image_get_height(Evas_Render_Image *im)
{
return 0;
}
void
__evas_render_image_set_borders(Evas_Render_Image *im, int left, int right,
int top, int bottom)
{
}
void
__evas_render_image_set_smooth_scaling(int on)
{
__evas_anti_alias = on;
}
/*****************************************************************************/
/* font internals ************************************************************/
/*****************************************************************************/
/*****************************************************************************/
/* font externals ************************************************************/
/*****************************************************************************/
Evas_Render_Font *
__evas_render_text_font_new(Display *disp, char *font, int size)
{
return NULL;
}
void
__evas_render_text_font_free(Evas_Render_Font *fn)
{
}
int
__evas_render_text_font_get_ascent(Evas_Render_Font *fn)
{
return 0;
}
int
__evas_render_text_font_get_descent(Evas_Render_Font *fn)
{
return 0;
}
int
__evas_render_text_font_get_max_ascent(Evas_Render_Font *fn)
{
return 0;
}
int
__evas_render_text_font_get_max_descent(Evas_Render_Font *fn)
{
return 0;
}
void
__evas_render_text_font_get_advances(Evas_Render_Font *fn, char *text,
int *advance_horiz,
int *advance_vert)
{
}
int
__evas_render_text_font_get_first_inset(Evas_Render_Font *fn, char *text)
{
return 0;
}
void
__evas_render_text_font_add_path(char *path)
{
}
void
__evas_render_text_font_del_path(char *path)
{
}
char **
__evas_render_text_font_list_paths(int *count)
{
return NULL;
}
void
__evas_render_text_cache_empty(Display *disp)
{
}
void
__evas_render_text_cache_set_size(Display *disp, int size)
{
}
int
__evas_render_text_cache_get_size(Display *disp)
{
return 0;
}
void
__evas_render_text_draw(Evas_Render_Font *fn, Display *disp, Imlib_Image dstim, Window win,
int win_w, int win_h, int x, int y, char *text,
int r, int g, int b, int a)
{
Evas_List l;
int w, h;
if ((!fn) || (!text)) return;
for(l = drawable_list; l; l = l->next)
{
Evas_Render_Drawable *dr;
dr = l->data;
if ((dr->win == win) && (dr->disp == disp))
{
Evas_List ll;
for (ll = dr->tmp_images; ll; ll = ll->next)
{
Evas_Render_Update *up;
up = ll->data;
/* if image intersects image update - render */
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
x, y, w, h))
{
}
}
}
}
}
void
__evas_render_text_get_size(Evas_Render_Font *fn, char *text, int *w, int *h)
{
if ((!fn) || (!text))
{
*w = 0; *h = 0;
return;
}
}
int
__evas_render_text_get_character_at_pos(Evas_Render_Font *fn, char *text,
int x, int y,
int *cx, int *cy, int *cw, int *ch)
{
return -1;
}
void
__evas_render_text_get_character_number(Evas_Render_Font *fn, char *text,
int num,
int *cx, int *cy, int *cw, int *ch)
{
}
/*****************************************************************************/
/* rectangle externals *******************************************************/
/*****************************************************************************/
void __evas_render_rectangle_draw(Display *disp, Imlib_Image dstim, Window win,
int win_w, int win_h,
int x, int y, int w, int h,
int r, int g, int b, int a)
{
Evas_List l;
for(l = drawable_list; l; l = l->next)
{
Evas_Render_Drawable *dr;
dr = l->data;
if ((dr->win == win) && (dr->disp == disp))
{
Evas_List ll;
for (ll = dr->tmp_images; ll; ll = ll->next)
{
Evas_Render_Update *up;
up = ll->data;
/* if image intersects image update - render */
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
x, y, w, h))
{
}
}
}
}
}
/*****************************************************************************/
/* rectangle externals *******************************************************/
/*****************************************************************************/
void __evas_render_line_draw(Display *disp, Imlib_Image dstim, Window win,
int win_w, int win_h,
int x1, int y1, int x2, int y2,
int r, int g, int b, int a)
{
Evas_List l;
int x, y, w, h;
w = x2 - x1;
if (w < 0) w = -w;
h = y2 - y1;
if (h < 0) h = -h;
if (x1 < x2) x = x1;
else x = x2;
if (y1 < y2) y = y1;
else y = y2;
w++; h++;
for(l = drawable_list; l; l = l->next)
{
Evas_Render_Drawable *dr;
dr = l->data;
if ((dr->win == win) && (dr->disp == disp))
{
Evas_List ll;
for (ll = dr->tmp_images; ll; ll = ll->next)
{
Evas_Render_Update *up;
up = ll->data;
/* if image intersects image update - render */
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
x, y, w, h))
{
}
}
}
}
}
/****************************************************************************/
/* gradient externals ********************************************************/
/*****************************************************************************/
Evas_Render_Graident *
__evas_render_gradient_new(Display *disp)
{
return NULL;
}
void
__evas_render_gradient_free(Evas_Render_Graident *gr)
{
}
void
__evas_render_gradient_color_add(Evas_Render_Graident *gr, int r, int g, int b, int a, int dist)
{
}
void
__evas_render_gradient_draw(Evas_Render_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle)
{
Evas_List l;
for(l = drawable_list; l; l = l->next)
{
Evas_Render_Drawable *dr;
dr = l->data;
if ((dr->win == win) && (dr->disp == disp))
{
Evas_List ll;
for (ll = dr->tmp_images; ll; ll = ll->next)
{
Evas_Render_Update *up;
up = ll->data;
/* if image intersects image update - render */
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
x, y, w, h))
{
}
}
}
}
}
/************/
/* polygons */
/************/
void
__evas_render_poly_draw (Display *disp, Imlib_Image dstim, Window win,
int win_w, int win_h,
Evas_List points,
int r, int g, int b, int a)
{
Evas_List l, l2;
int x, y, w, h;
x = y = w = h = 0;
if (points)
{
Evas_Point p;
p = points->data;
x = p->x;
y = p->y;
w = 1;
h = 1;
}
for (l2 = points; l2; l2 = l2->next)
{
Evas_Point p;
p = l2->data;
if (p->x < x)
{
w += x - p->x;
x = p->x;
}
if (p->x > (x + w))
w = p->x - x;
if (p->y < y)
{
h += y - p->y;
y = p->y;
}
if (p->y > (y + h))
h = p->y - y;
}
for(l = drawable_list; l; l = l->next)
{
Evas_Render_Drawable *dr;
dr = l->data;
if ((dr->win == win) && (dr->disp == disp))
{
Evas_List ll;
for (ll = dr->tmp_images; ll; ll = ll->next)
{
Evas_Render_Update *up;
up = ll->data;
/* if image intersects image update - render */
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
x, y, w, h))
{
}
}
}
}
}
/*****************************************************************************/
/* general externals *********************************************************/
/*****************************************************************************/
static Visual *__evas_visual = NULL;
static Colormap __evas_cmap = 0;
void
__evas_render_sync(Display *disp)
{
XSync(disp, False);
}
void
__evas_render_flush_draw(Display *disp, Imlib_Image dstim, Window win)
{
Evas_List l;
for(l = drawable_list; l; l = l->next)
{
Evas_Render_Drawable *dr;
dr = l->data;
if ((dr->win == win) && (dr->disp == disp))
{
Evas_List ll;
for (ll = dr->tmp_images; ll; ll = ll->next)
{
Evas_Render_Update *up;
up = ll->data;
free(up);
}
if (dr->tmp_images)
dr->tmp_images = evas_list_free(dr->tmp_images);
}
free(dr);
}
if (drawable_list)
drawable_list = evas_list_free(drawable_list);
drawable_list = NULL;
}
int
__evas_render_capable(Display *disp)
{
return 1;
}
Visual *
__evas_render_get_visual(Display *disp, int screen)
{
int depth;
__evas_visual = imlib_get_best_visual(disp, screen, &depth);
return __evas_visual;
}
XVisualInfo *
__evas_render_get_visual_info(Display *disp, int screen)
{
static XVisualInfo *vi = NULL;
XVisualInfo vi_template;
int n;
if (vi) return vi;
vi_template.visualid = (__evas_render_get_visual(disp, screen))->visualid;
vi_template.screen = screen;
vi = XGetVisualInfo(disp, VisualIDMask | VisualScreenMask, &vi_template ,&n);
return vi;
}
Colormap
__evas_render_get_colormap(Display *disp, int screen)
{
Visual *v;
if (__evas_cmap) return __evas_cmap;
v = __evas_render_get_visual(disp, screen);
__evas_cmap = DefaultColormap(disp, screen);
return __evas_cmap;
__evas_cmap = XCreateColormap(disp, RootWindow(disp, screen), v, AllocNone);
return __evas_cmap;
}
void
__evas_render_init(Display *disp, int screen, int colors)
{
static int initted = 0;
if (!initted)
{
initted = 1;
}
}
void
__evas_render_draw_add_rect(Display *disp, Imlib_Image dstim, Window win,
int x, int y, int w, int h)
{
Evas_List l;
for(l = drawable_list; l; l = l->next)
{
Evas_Render_Drawable *dr;
dr = l->data;
if ((dr->win == win) && (dr->disp == disp))
{
Evas_Render_Update *up;
up = malloc(sizeof(Evas_Render_Update));
up->x = x;
up->y = y;
up->w = w;
up->h = h;
dr->tmp_images = evas_list_append(dr->tmp_images, up);
}
return;
}
{
Evas_Render_Drawable *dr;
Evas_Render_Update *up;
dr = malloc(sizeof(Evas_Render_Drawable));
dr->win = win;
dr->disp = disp;
dr->tmp_images = NULL;
up = malloc(sizeof(Evas_Render_Update));
up->x = x;
up->y = y;
up->w = w;
up->h = h;
drawable_list = evas_list_append(drawable_list, dr);
dr->tmp_images = evas_list_append(dr->tmp_images, up);
}
}
#else
/***************/
/* image stuff */
/***************/
Evas_Render_Image *__evas_render_image_new_from_file(Display *disp, char *file){return NULL;}
void __evas_render_image_free(Evas_Render_Image *im){}
void __evas_render_image_cache_empty(Display *disp){}
void __evas_render_image_cache_set_size(Display *disp, int size){}
int __evas_render_image_cache_get_size(Display *disp){return 0;}
int __evas_render_image_get_width(Evas_Render_Image *im){return 0;}
int __evas_render_image_get_height(Evas_Render_Image *im){return 0;}
void __evas_render_image_set_borders(Evas_Render_Image *im, int left, int right, int top, int bottom){}
void __evas_render_image_set_smooth_scaling(int on){}
void __evas_render_image_draw(Evas_Render_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca){}
/********/
/* text */
/********/
Evas_Render_Font *__evas_render_text_font_new(Display *disp, char *font, int size){return NULL;}
void __evas_render_text_font_free(Evas_Render_Font *fn){}
void __evas_render_text_font_add_path(char *path){}
int __evas_render_text_font_get_ascent(Evas_Render_Font *fn){return 0;}
int __evas_render_text_font_get_descent(Evas_Render_Font *fn){return 0;}
int __evas_render_text_font_get_max_ascent(Evas_Render_Font *fn){return 0;}
int __evas_render_text_font_get_max_descent(Evas_Render_Font *fn){return 0;}
void __evas_render_text_font_get_advances(Evas_Render_Font *fn, char *text, int *advance_horiz, int *advance_vert){}
int __evas_render_text_font_get_first_inset(Evas_Render_Font *fn, char *text){return 0;}
void __evas_render_text_font_del_path(char *path){}
char **__evas_render_text_font_list_paths(int *count){return NULL;}
void __evas_render_text_cache_empty(Display *disp){}
void __evas_render_text_cache_set_size(Display *disp, int size){}
int __evas_render_text_cache_get_size(Display *disp){return 0;}
void __evas_render_text_get_size(Evas_Render_Font *fn, char *text, int *w, int *h){}
int __evas_render_text_get_character_at_pos(Evas_Render_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch){return 0;}
void __evas_render_text_get_character_number(Evas_Render_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch){}
void __evas_render_text_draw(Evas_Render_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a){}
/**************/
/* rectangles */
/**************/
void __evas_render_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a){}
/*********/
/* lines */
/*********/
void __evas_render_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a){}
/*************/
/* gradients */
/*************/
Evas_Render_Graident *__evas_render_gradient_new(Display *disp){return NULL;}
void __evas_render_gradient_free(Evas_Render_Graident *gr){}
void __evas_render_gradient_color_add(Evas_Render_Graident *gr, int r, int g, int b, int a, int dist){}
void __evas_render_gradient_draw(Evas_Render_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle){}
/************/
/* polygons */
/************/
void __evas_render_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a) {}
/***********/
/* drawing */
/***********/
void __evas_render_init(Display *disp, int screen, int colors){}
int __evas_render_capable(Display *disp){return 0;}
void __evas_render_flush_draw(Display *disp, Imlib_Image dstim, Window win){}
void __evas_render_sync(Display *disp){}
Visual *__evas_render_get_visual(Display *disp, int screen){return NULL;}
XVisualInfo *__evas_render_get_visual_info(Display *disp, int screen){return NULL;}
Colormap __evas_render_get_colormap(Display *disp, int screen){return 0;}
void __evas_render_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h){}
#endif

@ -0,0 +1,122 @@
#include "config.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/time.h>
#include <unistd.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include "Evas_private.h"
#include "Evas.h"
#include <Imlib2.h>
#ifdef HAVE_RENDER
#else
#endif
#ifndef SPANS_COMMON
# define SPANS_COMMON(x1, w1, x2, w2) \
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
#define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \
((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
#endif
typedef void Evas_Render_Image;
typedef void Evas_Render_Font;
typedef void Evas_Render_Graident;
typedef struct _evas_render_drawable Evas_Render_Drawable;
typedef struct _evas_render_update Evas_Render_Update;
struct _evas_render_drawable
{
Display *disp;
Window win;
Evas_List tmp_images;
};
struct _evas_render_update
{
int x, y, w, h;
};
/***************/
/* image stuff */
/***************/
Evas_Render_Image *__evas_render_image_new_from_file(Display *disp, char *file);
void __evas_render_image_free(Evas_Render_Image *im);
void __evas_render_image_cache_empty(Display *disp);
void __evas_render_image_cache_set_size(Display *disp, int size);
int __evas_render_image_cache_get_size(Display *disp);
int __evas_render_image_get_width(Evas_Render_Image *im);
int __evas_render_image_get_height(Evas_Render_Image *im);
void __evas_render_image_set_borders(Evas_Render_Image *im, int left, int right, int top, int bottom);
void __evas_render_image_set_smooth_scaling(int on);
void __evas_render_image_draw(Evas_Render_Image *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca);
/********/
/* text */
/********/
Evas_Render_Font *__evas_render_text_font_new(Display *disp, char *font, int size);
void __evas_render_text_font_free(Evas_Render_Font *fn);
int __evas_render_text_font_get_ascent(Evas_Render_Font *fn);
int __evas_render_text_font_get_descent(Evas_Render_Font *fn);
int __evas_render_text_font_get_max_ascent(Evas_Render_Font *fn);
int __evas_render_text_font_get_max_descent(Evas_Render_Font *fn);
void __evas_render_text_font_get_advances(Evas_Render_Font *fn, char *text, int *advance_horiz, int *advance_vert);
int __evas_render_text_font_get_first_inset(Evas_Render_Font *fn, char *text);
void __evas_render_text_font_add_path(char *path);
void __evas_render_text_font_del_path(char *path);
char **__evas_render_text_font_list_paths(int *count);
void __evas_render_text_cache_empty(Display *disp);
void __evas_render_text_cache_set_size(Display *disp, int size);
int __evas_render_text_cache_get_size(Display *disp);
void __evas_render_text_get_size(Evas_Render_Font *fn, char *text, int *w, int *h);
int __evas_render_text_get_character_at_pos(Evas_Render_Font *fn, char *text, int x, int y, int *cx, int *cy, int *cw, int *ch);
void __evas_render_text_get_character_number(Evas_Render_Font *fn, char *text, int num, int *cx, int *cy, int *cw, int *ch);
void __evas_render_text_draw(Evas_Render_Font *fn, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, char *text, int r, int g, int b, int a);
/**************/
/* rectangles */
/**************/
void __evas_render_rectangle_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, int r, int g, int b, int a);
/*********/
/* lines */
/*********/
void __evas_render_line_draw(Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x1, int y1, int x2, int y2, int r, int g, int b, int a);
/*************/
/* gradients */
/*************/
Evas_Render_Graident *__evas_render_gradient_new(Display *disp);
void __evas_render_gradient_free(Evas_Render_Graident *gr);
void __evas_render_gradient_color_add(Evas_Render_Graident *gr, int r, int g, int b, int a, int dist);
void __evas_render_gradient_draw(Evas_Render_Graident *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle);
/************/
/* polygons */
/************/
void __evas_render_poly_draw (Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, Evas_List points, int r, int g, int b, int a);
/***********/
/* drawing */
/***********/
void __evas_render_init(Display *disp, int screen, int colors);
int __evas_render_capable(Display *disp);
void __evas_render_flush_draw(Display *disp, Imlib_Image dstim, Window win);
void __evas_render_sync(Display *disp);
Visual *__evas_render_get_visual(Display *disp, int screen);
XVisualInfo *__evas_render_get_visual_info(Display *disp, int screen);
Colormap __evas_render_get_colormap(Display *disp, int screen);
void __evas_render_draw_add_rect(Display *disp, Imlib_Image dstim, Window win, int x, int y, int w, int h);

@ -8,6 +8,7 @@
#include "evas_imlib_routines.h"
#include "evas_image_routines.h"
#include "evas_x11_routines.h"
#include "evas_render_routines.h"
static void
_evas_free_text(Evas_Object o)
@ -111,6 +112,20 @@ evas_add_text(Evas e, char *font, int size, char *text)
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
{
Evas_Render_Font *fn;
fn = __evas_render_text_font_new (e->current.display,
oo->current.font,
oo->current.size);
if (fn)
{
__evas_render_text_get_size(fn, oo->current.text,
&oo->current.string.w,
&oo->current.string.h);
__evas_render_text_font_free(fn);
}
}
break;
case RENDER_METHOD_IMAGE:
{
@ -259,6 +274,22 @@ evas_text_at_position(Evas e, Evas_Object o, double x, double y,
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
{
int ret;
Evas_Render_Font *fn;
fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size);
if (fn)
{
ret = __evas_render_text_get_character_at_pos(fn, oo->current.text,
(int)(x - o->current.x),
(int)(y - o->current.y),
char_x, char_y,
char_w, char_h);
__evas_gl_text_font_free(fn);
return ret;
}
}
break;
case RENDER_METHOD_IMAGE:
{
@ -342,6 +373,19 @@ evas_text_at(Evas e, Evas_Object o, int index,
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
{
Evas_Render_Font *fn;
fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size);
if (fn)
{
__evas_render_text_get_character_number(fn, oo->current.text,
index,
char_x, char_y,
char_w, char_h);
__evas_render_text_font_free(fn);
}
}
break;
case RENDER_METHOD_IMAGE:
{
@ -417,6 +461,17 @@ evas_text_get_ascent_descent(Evas e, Evas_Object o,
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
{
Evas_Render_Font *fn;
fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size);
if (fn)
{
a = __evas_render_text_font_get_ascent(fn);
d = __evas_render_text_font_get_descent(fn);
__evas_render_text_font_free(fn);
}
}
break;
case RENDER_METHOD_IMAGE:
{
@ -492,6 +547,17 @@ evas_text_get_max_ascent_descent(Evas e, Evas_Object o,
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
{
Evas_Render_Font *fn;
fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size);
if (fn)
{
a = __evas_render_text_font_get_max_ascent(fn);
d = __evas_render_text_font_get_max_descent(fn);
__evas_render_text_font_free(fn);
}
}
break;
case RENDER_METHOD_IMAGE:
{
@ -564,6 +630,16 @@ evas_text_get_advance(Evas e, Evas_Object o,
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
{
Evas_Render_Font *fn;
fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size);
if (fn)
{
__evas_render_text_font_get_advances(fn, oo->current.text, &a, &d);
__evas_render_text_font_free(fn);
}
}
break;
case RENDER_METHOD_IMAGE:
{
@ -636,6 +712,17 @@ evas_text_get_inset(Evas e, Evas_Object o)
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
{
Evas_Render_Font *fn;
fn = __evas_render_text_font_new(e->current.display, oo->current.font, oo->current.size);
if (fn)
{
inset = __evas_render_text_font_get_first_inset(fn, oo->current.text);
__evas_render_text_font_free(fn);
return (double)inset;
}
}
break;
case RENDER_METHOD_IMAGE:
{
@ -736,6 +823,23 @@ evas_set_text(Evas e, Evas_Object o, char *text)
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
{
Evas_Render_Font *fn;
fn = __evas_render_text_font_new (e->current.display,
oo->current.font,
oo->current.size);
if (fn)
{
__evas_render_text_get_size(fn, oo->current.text,
&oo->current.string.w,
&oo->current.string.h);
evas_resize(e, o,
(double)oo->current.string.w,
(double)oo->current.string.h);
__evas_render_text_font_free(fn);
}
}
break;
case RENDER_METHOD_IMAGE:
{
@ -852,6 +956,23 @@ evas_set_font(Evas e, Evas_Object o, char *font, int size)
}
break;
case RENDER_METHOD_ALPHA_HARDWARE:
{
Evas_Render_Font *fn;
fn = __evas_render_text_font_new (e->current.display,
oo->current.font,
oo->current.size);
if (fn)
{
__evas_render_text_get_size(fn, oo->current.text,
&oo->current.string.w,
&oo->current.string.h);
evas_resize(e, o,
(double)oo->current.string.w,
(double)oo->current.string.h);
__evas_render_text_font_free(fn);
}
}
break;
case RENDER_METHOD_IMAGE:
{

Loading…
Cancel
Save