* rewrote GL engine for evas - vast speed improvements and cleanliness
improvements - MUCH better * fixed imlib and x11 engines - much faster x11 engine. much better imlib engine * added clipping ability to evas (you can clip one object by another for now only rectangles are supported) * you will need to use cvs imlib2 - i fixed the clipping in it to apply to images, text and gradients too. * almost done with x11 engine - just fonts to go (mostly done) * clipping rects rgba color modifies what they clip * gl, imlib and x11 engines modified to do clipping * still need to add border scaling supporty to gl engine * maybe some other stuff i don't remember - i've been sick over christmas SVN revision: 4039
This commit is contained in:
parent
deb3a7cc06
commit
ce2f4fe9f1
|
@ -99,7 +99,13 @@ void evas_set_output_size(Evas e, int w, int h);
|
|||
void evas_set_output_viewport(Evas e, double x, double y, double w, double h);
|
||||
void evas_set_output_method(Evas e, Evas_Render_Method method);
|
||||
void evas_set_scale_smoothness(Evas e, int smooth);
|
||||
|
||||
|
||||
/* clipping - for now you can only use rectangles as clip objects */
|
||||
void evas_set_clip(Evas e, Evas_Object o, Evas_Object clip);
|
||||
void evas_unset_clip(Evas e, Evas_Object o);
|
||||
Evas_Object evas_get_clip_object(Evas e, Evas_Object o);
|
||||
Evas_List evas_get_clip_list(Evas e, Evas_Object o);
|
||||
|
||||
/* deleting objects */
|
||||
void evas_del_object(Evas e, Evas_Object o);
|
||||
|
||||
|
|
|
@ -34,6 +34,40 @@ typedef struct _Evas_Object_Poly * Evas_Object_Poly;
|
|||
|
||||
#define IF_OBJ(_o, _t) if (((Evas_Object)_o)->type != _t)
|
||||
|
||||
#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
|
||||
((x < (xx + ww)) && \
|
||||
(y < (yy + hh)) && \
|
||||
((x + w) > xx) && \
|
||||
((y + h) > yy))
|
||||
|
||||
#define CLIP_TO(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \
|
||||
{ \
|
||||
if (INTERSECTS(_x, _y, _w, _h, _cx, _cy, _cw, _ch)) \
|
||||
{ \
|
||||
if (_x < _cx) \
|
||||
{ \
|
||||
_w += _x - _cx; \
|
||||
_x = _cx; \
|
||||
if (_w < 0) _w = 0; \
|
||||
} \
|
||||
if ((_x + _w) > (_cx + _cw)) \
|
||||
_w = _cx + _cw - _x; \
|
||||
if (_y < _cy) \
|
||||
{ \
|
||||
_h += _y - _cy; \
|
||||
_y = _cy; \
|
||||
if (_h < 0) _h = 0; \
|
||||
} \
|
||||
if ((_y + _h) > (_cy + _ch)) \
|
||||
_h = _cy + _ch - _y; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
_w = 0; _h = 0; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#include "Evas.h"
|
||||
struct _Evas_Render_Data
|
||||
{
|
||||
|
@ -151,6 +185,12 @@ struct _Evas_Object_Any
|
|||
Evas_List callbacks;
|
||||
Evas_List data;
|
||||
|
||||
struct {
|
||||
Evas_List list;
|
||||
Evas_Object object;
|
||||
int changed;
|
||||
} clip;
|
||||
|
||||
Evas_Render_Data renderer_data;
|
||||
|
||||
char *name;
|
||||
|
|
|
@ -5,71 +5,24 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
_evas_point_in_object(Evas e, Evas_Object o, int x, int y)
|
||||
{
|
||||
int ox, oy, ow, oh;
|
||||
|
||||
if (o->delete_me) return 0;
|
||||
_evas_object_get_current_translated_coords(e, o, &ox, &oy, &ow, &oh);
|
||||
if ((x >= ox) && (x < (ox + ow)) && (y >= oy) && (y < (oy + oh)))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Evas_Object
|
||||
_evas_highest_object_at_point(Evas e, int x, int y)
|
||||
{
|
||||
Evas_List l, ll;
|
||||
Evas_Layer layer;
|
||||
Evas_Object o;
|
||||
double cx, cy;
|
||||
|
||||
o = NULL;
|
||||
for (l = e->layers; l ; l = l->next)
|
||||
{
|
||||
layer = l->data;
|
||||
|
||||
for (ll = layer->objects; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
|
||||
{
|
||||
if (_evas_point_in_object(e, ob, x, y))
|
||||
{
|
||||
o = ob;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return o;
|
||||
cx = evas_screen_x_to_world(e, x);
|
||||
cy = evas_screen_x_to_world(e, y);
|
||||
return evas_object_at_position(e, cx, cy);
|
||||
}
|
||||
|
||||
Evas_List
|
||||
_evas_objects_at_point(Evas e, int x, int y)
|
||||
{
|
||||
Evas_List l, ll, objs;
|
||||
Evas_Layer layer;
|
||||
double cx, cy;
|
||||
|
||||
objs = NULL;
|
||||
for (l = e->layers; l ; l = l->next)
|
||||
{
|
||||
layer = l->data;
|
||||
|
||||
for (ll = layer->objects; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
|
||||
{
|
||||
if (_evas_point_in_object(e, ll->data, x, y))
|
||||
objs = evas_list_prepend(objs, ll->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return objs;
|
||||
cx = evas_screen_x_to_world(e, x);
|
||||
cy = evas_screen_x_to_world(e, y);
|
||||
return evas_objects_at_position(e, cx, cy);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,112 +32,166 @@ typedef int GLuint;
|
|||
#include "Evas_private.h"
|
||||
#include "Evas.h"
|
||||
|
||||
typedef struct _evas_gl_image Evas_GL_Image;
|
||||
typedef struct _evas_gl_font Evas_GL_Font;
|
||||
typedef struct _evas_gl_glyph_info Evas_GL_Glyph_Info;
|
||||
typedef struct _evas_gl_gradient Evas_GL_Graident;
|
||||
typedef struct _evas_gl_gradient_color Evas_GL_Graident_Color;
|
||||
typedef enum _evas_gl_image_state Evas_GL_Image_State;
|
||||
typedef struct _evas_gl_image Evas_GL_Image;
|
||||
typedef struct _evas_gl_font Evas_GL_Font;
|
||||
typedef struct _evas_gl_gradient Evas_GL_Graident;
|
||||
|
||||
enum _evas_gl_image_state
|
||||
typedef struct _evas_gl_font_texture Evas_GL_Font_Texture;
|
||||
typedef struct _evas_gl_glpyh_texture Evas_GL_Glyph_Texture;
|
||||
typedef struct _evas_gl_glyph Evas_GL_Glyph;
|
||||
typedef struct _evas_gl_gradient_texture Evas_GL_Graident_Texture;
|
||||
typedef struct _evas_gl_window Evas_GL_Window;
|
||||
typedef struct _evas_gl_context Evas_GL_Context;
|
||||
typedef struct _evas_gl_rect Evas_GL_Rect;
|
||||
typedef struct _evas_gl_texture Evas_GL_Texture;
|
||||
typedef struct _evas_gl_texmesh Evas_GL_Texmesh;
|
||||
|
||||
struct _evas_gl_window
|
||||
{
|
||||
EVAS_STATE_DATA,
|
||||
EVAS_STATE_TEXTURE
|
||||
Display *disp;
|
||||
Window win;
|
||||
Window root;
|
||||
int screen;
|
||||
Evas_GL_Context *context;
|
||||
Evas_List updates;
|
||||
int w, h;
|
||||
};
|
||||
|
||||
struct _evas_gl_context
|
||||
{
|
||||
Display *disp;
|
||||
int screen;
|
||||
GLXContext context;
|
||||
Window win;
|
||||
Window root;
|
||||
XVisualInfo *visualinfo;
|
||||
Visual *visual;
|
||||
Colormap colormap;
|
||||
int dither;
|
||||
int blend;
|
||||
int texture;
|
||||
DATA32 color;
|
||||
struct {
|
||||
int active;
|
||||
int x, y, w, h;
|
||||
} clip;
|
||||
GLenum read_buf;
|
||||
GLenum write_buf;
|
||||
Evas_GL_Texture *bound_texture;
|
||||
|
||||
int max_texture_depth;
|
||||
int max_texture_size;
|
||||
};
|
||||
|
||||
struct _evas_gl_rect
|
||||
{
|
||||
int x, y, w, h;
|
||||
};
|
||||
|
||||
struct _evas_gl_texture
|
||||
{
|
||||
int w, h;
|
||||
GLuint texture;
|
||||
int smooth;
|
||||
};
|
||||
|
||||
struct _evas_gl_texmesh
|
||||
{
|
||||
struct {
|
||||
int x, y;
|
||||
int x_edge, y_edge;
|
||||
int x_left, y_left;
|
||||
} tiles;
|
||||
Evas_GL_Texture **textures;
|
||||
Evas_GL_Window *window;
|
||||
Evas_GL_Context *context;
|
||||
};
|
||||
|
||||
struct _evas_gl_image
|
||||
{
|
||||
Evas_GL_Image_State state;
|
||||
int w, h;
|
||||
int direct;
|
||||
int bl, br, bt, bb;
|
||||
int alpha;
|
||||
char *file;
|
||||
/* data specific params */
|
||||
DATA32 *data;
|
||||
/* common GL params */
|
||||
GLXContext context;
|
||||
/* texture state specific params */
|
||||
struct
|
||||
{
|
||||
int max_size;
|
||||
int w, h;
|
||||
int edge_w, edge_h;
|
||||
GLuint *textures;
|
||||
} texture;
|
||||
/* buffer specific params */
|
||||
struct
|
||||
{
|
||||
Display *display;
|
||||
XVisualInfo *visual_info;
|
||||
Colormap colormap;
|
||||
Window window, dest;
|
||||
int dest_w, dest_h;
|
||||
} buffer;
|
||||
Imlib_Image im;
|
||||
int w, h;
|
||||
struct {
|
||||
int l, r, t, b;
|
||||
} border;
|
||||
int has_alpha;
|
||||
Evas_List textures;
|
||||
int references;
|
||||
};
|
||||
|
||||
struct _evas_gl_font
|
||||
struct _evas_gl_gradient_texture
|
||||
{
|
||||
char *file;
|
||||
int size;
|
||||
|
||||
TT_Engine engine;
|
||||
TT_Face face;
|
||||
TT_Instance instance;
|
||||
TT_Face_Properties properties;
|
||||
int num_glyph;
|
||||
TT_Glyph *glyphs;
|
||||
Evas_GL_Glyph_Info *glyphinfo;
|
||||
int max_descent;
|
||||
int max_ascent;
|
||||
int descent;
|
||||
int ascent;
|
||||
int mem_use;
|
||||
|
||||
GLXContext context;
|
||||
int max_texture_size;
|
||||
int num_textures;
|
||||
GLuint *textures;
|
||||
struct
|
||||
{
|
||||
Display *display;
|
||||
XVisualInfo *visual_info;
|
||||
Colormap colormap;
|
||||
Window window, dest;
|
||||
int dest_w, dest_h;
|
||||
} buffer;
|
||||
int references;
|
||||
};
|
||||
|
||||
struct _evas_gl_glyph_info
|
||||
{
|
||||
GLuint texture;
|
||||
int px, py, pw, ph;
|
||||
double x1, y1, x2, y2;
|
||||
};
|
||||
|
||||
struct _evas_gl_gradient_color
|
||||
{
|
||||
int r, g, b, a;
|
||||
int dist;
|
||||
Evas_GL_Window *window;
|
||||
Evas_GL_Context *context;
|
||||
Evas_GL_Texture *texture;
|
||||
};
|
||||
|
||||
struct _evas_gl_gradient
|
||||
{
|
||||
Evas_List colors;
|
||||
GLXContext context;
|
||||
int max_texture_size;
|
||||
int texture_w, texture_h;
|
||||
GLuint texture;
|
||||
struct
|
||||
{
|
||||
Display *display;
|
||||
XVisualInfo *visual_info;
|
||||
Colormap colormap;
|
||||
Window window, dest;
|
||||
int dest_w, dest_h;
|
||||
} buffer;
|
||||
Imlib_Color_Range col_range;
|
||||
Evas_List textures;
|
||||
};
|
||||
|
||||
struct _evas_gl_glpyh_texture
|
||||
{
|
||||
struct {
|
||||
double x1, x2, y1, y2;
|
||||
} tex;
|
||||
Evas_GL_Window *window;
|
||||
Evas_GL_Context *context;
|
||||
Evas_GL_Texture *texture;
|
||||
};
|
||||
|
||||
struct _evas_gl_glyph
|
||||
{
|
||||
int glyph_id;
|
||||
TT_Glyph glyph;
|
||||
|
||||
TT_Glyph_Metrics metrics;
|
||||
|
||||
Evas_GL_Glyph_Texture *texture;
|
||||
|
||||
struct {
|
||||
double x1, x2, y1, y2;
|
||||
} tex;
|
||||
|
||||
Evas_List textures;
|
||||
};
|
||||
|
||||
struct _evas_gl_font_texture
|
||||
{
|
||||
struct {
|
||||
int x, y;
|
||||
int row_h;
|
||||
} cursor;
|
||||
Evas_GL_Window *window;
|
||||
Evas_GL_Context *context;
|
||||
Evas_GL_Texture *texture;
|
||||
};
|
||||
|
||||
struct _evas_gl_font
|
||||
{
|
||||
char *font;
|
||||
int size;
|
||||
|
||||
TT_Engine engine;
|
||||
TT_Face face;
|
||||
TT_Instance instance;
|
||||
TT_Face_Properties properties;
|
||||
TT_CharMap char_map;
|
||||
TT_Instance_Metrics metrics;
|
||||
|
||||
Evas_List glyphs[256];
|
||||
|
||||
Evas_List textures;
|
||||
|
||||
int ascent;
|
||||
int descent;
|
||||
int max_descent;
|
||||
int max_ascent;
|
||||
|
||||
int references;
|
||||
};
|
||||
|
||||
/***************/
|
||||
|
@ -202,6 +256,7 @@ void __evas_gl_poly_draw (Display *disp, Imlib_Image dstim, Window
|
|||
/***********/
|
||||
/* drawing */
|
||||
/***********/
|
||||
void __evas_gl_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
void __evas_gl_init(Display *disp, int screen, int colors);
|
||||
int __evas_gl_capable(Display *disp);
|
||||
void __evas_gl_flush_draw(Display *disp, Imlib_Image dstim, Window win);
|
||||
|
|
|
@ -4,6 +4,17 @@ static void __evas_image_image_cache_flush(Display *disp);
|
|||
static int __evas_anti_alias = 1;
|
||||
static Evas_List drawable_list = NULL;
|
||||
|
||||
/* the current clip region and color */
|
||||
static int __evas_clip = 0;
|
||||
static int __evas_clip_x = 0;
|
||||
static int __evas_clip_y = 0;
|
||||
static int __evas_clip_w = 0;
|
||||
static int __evas_clip_h = 0;
|
||||
static int __evas_clip_r = 0;
|
||||
static int __evas_clip_g = 0;
|
||||
static int __evas_clip_b = 0;
|
||||
static int __evas_clip_a = 0;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* image internals ***********************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -806,6 +817,20 @@ __evas_image_poly_draw (Display *disp, Imlib_Image dstim, Window win,
|
|||
static Visual *__evas_visual = NULL;
|
||||
static Colormap __evas_cmap = 0;
|
||||
|
||||
void
|
||||
__evas_image_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a)
|
||||
{
|
||||
__evas_clip = on;
|
||||
__evas_clip_x = x;
|
||||
__evas_clip_y = y;
|
||||
__evas_clip_w = w;
|
||||
__evas_clip_h = h;
|
||||
__evas_clip_r = r;
|
||||
__evas_clip_g = g;
|
||||
__evas_clip_b = b;
|
||||
__evas_clip_a = a;
|
||||
}
|
||||
|
||||
void
|
||||
__evas_image_sync(Display *disp)
|
||||
{
|
||||
|
|
|
@ -108,6 +108,7 @@ void __evas_image_poly_draw (Display *disp, Imlib_Image dstim, W
|
|||
/***********/
|
||||
/* drawing */
|
||||
/***********/
|
||||
void __evas_image_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
void __evas_image_init(Display *disp, int screen, int colors);
|
||||
int __evas_image_capable(Display *disp);
|
||||
void __evas_image_flush_draw(Display *disp, Imlib_Image dstim, Window win);
|
||||
|
|
|
@ -5,6 +5,17 @@ static void __evas_imlib_image_cache_flush(Display *disp);
|
|||
static int __evas_anti_alias = 1;
|
||||
static Evas_List drawable_list = NULL;
|
||||
|
||||
/* the current clip region and color */
|
||||
static int __evas_clip = 0;
|
||||
static int __evas_clip_x = 0;
|
||||
static int __evas_clip_y = 0;
|
||||
static int __evas_clip_w = 0;
|
||||
static int __evas_clip_h = 0;
|
||||
static int __evas_clip_r = 0;
|
||||
static int __evas_clip_g = 0;
|
||||
static int __evas_clip_b = 0;
|
||||
static int __evas_clip_a = 0;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* image internals ***********************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -68,7 +79,14 @@ __evas_imlib_image_draw(Evas_Imlib_Image *im,
|
|||
Evas_List l;
|
||||
Imlib_Color_Modifier cm = NULL;
|
||||
|
||||
if (ca == 0) return;
|
||||
if (__evas_clip)
|
||||
{
|
||||
cr = (cr * __evas_clip_r) / 255;
|
||||
cg = (cg * __evas_clip_g) / 255;
|
||||
cb = (cb * __evas_clip_b) / 255;
|
||||
ca = (ca * __evas_clip_a) / 255;
|
||||
}
|
||||
if (ca == 0) return;
|
||||
if ((cr != 255) || (cg != 255) || (cb != 255) || (ca != 255))
|
||||
{
|
||||
DATA8 r[256], g[256], b[256], a[256];
|
||||
|
@ -113,6 +131,13 @@ __evas_imlib_image_draw(Evas_Imlib_Image *im,
|
|||
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
|
||||
dst_x, dst_y, dst_w, dst_h))
|
||||
{
|
||||
if (__evas_clip)
|
||||
imlib_context_set_cliprect(__evas_clip_x - up->x,
|
||||
__evas_clip_y - up->y,
|
||||
__evas_clip_w,
|
||||
__evas_clip_h);
|
||||
else imlib_context_set_cliprect(0, 0, 0, 0);
|
||||
|
||||
if (!up->image)
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
imlib_context_set_image(up->image);
|
||||
|
@ -301,13 +326,21 @@ __evas_imlib_text_cache_get_size(Display *disp)
|
|||
void
|
||||
__evas_imlib_text_draw(Evas_Imlib_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)
|
||||
int cr, int cg, int cb, int ca)
|
||||
{
|
||||
Evas_List l;
|
||||
int w, h;
|
||||
|
||||
if (__evas_clip)
|
||||
{
|
||||
cr = (cr * __evas_clip_r) / 255;
|
||||
cg = (cg * __evas_clip_g) / 255;
|
||||
cb = (cb * __evas_clip_b) / 255;
|
||||
ca = (ca * __evas_clip_a) / 255;
|
||||
}
|
||||
if ((!fn) || (!text)) return;
|
||||
imlib_context_set_color(r, g, b, a);
|
||||
if (ca == 0) return;
|
||||
imlib_context_set_color(cr, cg, cb, ca);
|
||||
imlib_context_set_font((Imlib_Font)fn);
|
||||
imlib_context_set_angle(0.0);
|
||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||
|
@ -336,6 +369,12 @@ __evas_imlib_text_draw(Evas_Imlib_Font *fn, Display *disp, Imlib_Image dstim, Wi
|
|||
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
|
||||
x, y, w, h))
|
||||
{
|
||||
if (__evas_clip)
|
||||
imlib_context_set_cliprect(__evas_clip_x - up->x,
|
||||
__evas_clip_y - up->y,
|
||||
__evas_clip_w,
|
||||
__evas_clip_h);
|
||||
else imlib_context_set_cliprect(0, 0, 0, 0);
|
||||
if (!up->image)
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
imlib_context_set_image(up->image);
|
||||
|
@ -407,11 +446,19 @@ __evas_imlib_text_get_character_number(Evas_Imlib_Font *fn, char *text,
|
|||
void __evas_imlib_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)
|
||||
int cr, int cg, int cb, int ca)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
imlib_context_set_color(r, g, b, a);
|
||||
if (__evas_clip)
|
||||
{
|
||||
cr = (cr * __evas_clip_r) / 255;
|
||||
cg = (cg * __evas_clip_g) / 255;
|
||||
cb = (cb * __evas_clip_b) / 255;
|
||||
ca = (ca * __evas_clip_a) / 255;
|
||||
}
|
||||
if (ca == 0) return;
|
||||
imlib_context_set_color(cr, cg, cb, ca);
|
||||
imlib_context_set_angle(0.0);
|
||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
|
@ -438,6 +485,8 @@ void __evas_imlib_rectangle_draw(Display *disp, Imlib_Image dstim,
|
|||
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
|
||||
x, y, w, h))
|
||||
{
|
||||
if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h);
|
||||
else imlib_context_set_cliprect(0, 0, 0, 0);
|
||||
if (!up->image)
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
imlib_context_set_image(up->image);
|
||||
|
@ -471,12 +520,20 @@ void __evas_imlib_rectangle_draw(Display *disp, Imlib_Image dstim,
|
|||
void __evas_imlib_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)
|
||||
int cr, int cg, int cb, int ca)
|
||||
{
|
||||
Evas_List l;
|
||||
int x, y, w, h;
|
||||
|
||||
imlib_context_set_color(r, g, b, a);
|
||||
if (__evas_clip)
|
||||
{
|
||||
cr = (cr * __evas_clip_r) / 255;
|
||||
cg = (cg * __evas_clip_g) / 255;
|
||||
cb = (cb * __evas_clip_b) / 255;
|
||||
ca = (ca * __evas_clip_a) / 255;
|
||||
}
|
||||
if (ca == 0) return;
|
||||
imlib_context_set_color(cr, cg, cb, ca);
|
||||
imlib_context_set_angle(0.0);
|
||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
|
@ -512,6 +569,8 @@ void __evas_imlib_line_draw(Display *disp, Imlib_Image dstim, Windo
|
|||
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
|
||||
x, y, w, h))
|
||||
{
|
||||
if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h);
|
||||
else imlib_context_set_cliprect(0, 0, 0, 0);
|
||||
if (!up->image)
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
imlib_context_set_image(up->image);
|
||||
|
@ -546,36 +605,75 @@ void __evas_imlib_line_draw(Display *disp, Imlib_Image dstim, Windo
|
|||
Evas_Imlib_Graident *
|
||||
__evas_imlib_gradient_new(Display *disp)
|
||||
{
|
||||
return (Evas_Imlib_Graident *)imlib_create_color_range();
|
||||
Evas_Imlib_Graident *gr;
|
||||
|
||||
gr = malloc(sizeof(Evas_Imlib_Graident));
|
||||
gr->colors = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
__evas_imlib_gradient_free(Evas_Imlib_Graident *gr)
|
||||
{
|
||||
imlib_context_set_color_range((Imlib_Color_Range)gr);
|
||||
imlib_free_color_range();
|
||||
Evas_List l;
|
||||
|
||||
if (gr->colors)
|
||||
{
|
||||
for (l = gr->colors; l; l = l->next)
|
||||
{
|
||||
free(l->data);
|
||||
}
|
||||
evas_list_free(gr->colors);
|
||||
}
|
||||
free(gr);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_imlib_gradient_color_add(Evas_Imlib_Graident *gr, int r, int g, int b, int a, int dist)
|
||||
{
|
||||
imlib_context_set_color_range((Imlib_Color_Range)gr);
|
||||
imlib_context_set_color(r, g, b, a);
|
||||
imlib_add_color_to_color_range(dist);
|
||||
Evas_Imlib_Color *cl;
|
||||
|
||||
cl = malloc(sizeof(Evas_Imlib_Color));
|
||||
cl->r = r;
|
||||
cl->g = g;
|
||||
cl->b = b;
|
||||
cl->a = a;
|
||||
cl->dist = dist;
|
||||
gr->colors = evas_list_append(gr->colors, cl);
|
||||
}
|
||||
|
||||
void
|
||||
__evas_imlib_gradient_draw(Evas_Imlib_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;
|
||||
|
||||
Imlib_Color_Range cr;
|
||||
|
||||
if ((__evas_clip) && (__evas_clip_a == 0)) return;
|
||||
imlib_context_set_angle(angle);
|
||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||
imlib_context_set_color_range((Imlib_Color_Range)gr);
|
||||
imlib_context_set_anti_alias(1);
|
||||
imlib_context_set_blend(1);
|
||||
cr = imlib_create_color_range();
|
||||
imlib_context_set_color_range(cr);
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
for (l = gr->colors; l; l = l->next)
|
||||
{
|
||||
Evas_Imlib_Color *cl;
|
||||
|
||||
cl = l->data;
|
||||
if (__evas_clip)
|
||||
imlib_context_set_color((cl->r * __evas_clip_r) / 255,
|
||||
(cl->g * __evas_clip_g) / 255,
|
||||
(cl->b * __evas_clip_b) / 255,
|
||||
(cl->a * __evas_clip_a) / 255);
|
||||
else
|
||||
imlib_context_set_color(cl->r, cl->g, cl->b, cl->a);
|
||||
imlib_add_color_to_color_range(cl->dist);
|
||||
}
|
||||
}
|
||||
for(l = drawable_list; l; l = l->next)
|
||||
{
|
||||
Evas_Imlib_Drawable *dr;
|
||||
|
@ -596,6 +694,8 @@ __evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Imlib_Image d
|
|||
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
|
||||
x, y, w, h))
|
||||
{
|
||||
if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h);
|
||||
else imlib_context_set_cliprect(0, 0, 0, 0);
|
||||
if (!up->image)
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
imlib_context_set_image(up->image);
|
||||
|
@ -604,6 +704,7 @@ __evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display *disp, Imlib_Image d
|
|||
}
|
||||
}
|
||||
}
|
||||
imlib_free_color_range();
|
||||
}
|
||||
|
||||
|
||||
|
@ -616,12 +717,20 @@ void
|
|||
__evas_imlib_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)
|
||||
int cr, int cg, int cb, int ca)
|
||||
{
|
||||
Evas_List l, l2;
|
||||
int x, y, w, h;
|
||||
|
||||
imlib_context_set_color(r, g, b, a);
|
||||
if (__evas_clip)
|
||||
{
|
||||
cr = (cr * __evas_clip_r) / 255;
|
||||
cg = (cg * __evas_clip_g) / 255;
|
||||
cb = (cb * __evas_clip_b) / 255;
|
||||
ca = (ca * __evas_clip_a) / 255;
|
||||
}
|
||||
if (ca == 0) return;
|
||||
imlib_context_set_color(cr, cg, cb, ca);
|
||||
imlib_context_set_angle(0.0);
|
||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||
imlib_context_set_color_modifier(NULL);
|
||||
|
@ -682,6 +791,9 @@ __evas_imlib_poly_draw (Display *disp, Imlib_Image dstim, Window win,
|
|||
{
|
||||
ImlibPolygon pol;
|
||||
|
||||
if (__evas_clip) imlib_context_set_cliprect(__evas_clip_x - up->x, __evas_clip_y - up->y, __evas_clip_w, __evas_clip_h);
|
||||
else imlib_context_set_cliprect(0, 0, 0, 0);
|
||||
|
||||
if (!up->image)
|
||||
up->image = imlib_create_image(up->w, up->h);
|
||||
imlib_context_set_image(up->image);
|
||||
|
@ -720,6 +832,20 @@ __evas_imlib_poly_draw (Display *disp, Imlib_Image dstim, Window win,
|
|||
static Visual *__evas_visual = NULL;
|
||||
static Colormap __evas_cmap = 0;
|
||||
|
||||
void
|
||||
__evas_imlib_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a)
|
||||
{
|
||||
__evas_clip = on;
|
||||
__evas_clip_x = x;
|
||||
__evas_clip_y = y;
|
||||
__evas_clip_w = w;
|
||||
__evas_clip_h = h;
|
||||
__evas_clip_r = r;
|
||||
__evas_clip_g = g;
|
||||
__evas_clip_b = b;
|
||||
__evas_clip_a = a;
|
||||
}
|
||||
|
||||
void
|
||||
__evas_imlib_sync(Display *disp)
|
||||
{
|
||||
|
|
|
@ -26,10 +26,11 @@
|
|||
|
||||
typedef void Evas_Imlib_Image;
|
||||
typedef void Evas_Imlib_Font;
|
||||
typedef void Evas_Imlib_Graident;
|
||||
|
||||
typedef struct _evas_imlib_drawable Evas_Imlib_Drawable;
|
||||
typedef struct _evas_imlib_update Evas_Imlib_Update;
|
||||
typedef struct _evas_imlib_color Evas_Imlib_Color;
|
||||
typedef struct _evas_imlib_gradient Evas_Imlib_Graident;
|
||||
|
||||
struct _evas_imlib_drawable
|
||||
{
|
||||
|
@ -44,6 +45,17 @@ struct _evas_imlib_update
|
|||
int x, y, w, h;
|
||||
};
|
||||
|
||||
struct _evas_imlib_color
|
||||
{
|
||||
int r, g, b, a;
|
||||
int dist;
|
||||
};
|
||||
|
||||
struct _evas_imlib_gradient
|
||||
{
|
||||
Evas_List colors;
|
||||
};
|
||||
|
||||
/***************/
|
||||
/* image stuff */
|
||||
/***************/
|
||||
|
@ -108,6 +120,7 @@ void __evas_imlib_poly_draw (Display *disp, Imlib_Image dstim, W
|
|||
/***********/
|
||||
/* drawing */
|
||||
/***********/
|
||||
void __evas_imlib_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
void __evas_imlib_init(Display *disp, int screen, int colors);
|
||||
int __evas_imlib_capable(Display *disp);
|
||||
void __evas_imlib_flush_draw(Display *disp, Imlib_Image dstim, Window win);
|
||||
|
|
|
@ -114,12 +114,139 @@ _evas_layer_free(Evas e, Evas_Layer layer)
|
|||
free(layer);
|
||||
}
|
||||
|
||||
void
|
||||
_evas_cleanup_clip(Evas e, Evas_Object o)
|
||||
{
|
||||
if (o->clip.list)
|
||||
{
|
||||
Evas_List l;
|
||||
|
||||
for (l = o->clip.list; l; l = l->next)
|
||||
{
|
||||
Evas_Object o2;
|
||||
|
||||
o2 = l->data;
|
||||
o2->clip.object = NULL;
|
||||
o2->clip.changed = 1;
|
||||
o2->changed = 1;
|
||||
e->changed = 1;
|
||||
}
|
||||
evas_list_free(o->clip.list);
|
||||
}
|
||||
if (o->clip.object)
|
||||
o->clip.object->clip.list = evas_list_remove(o->clip.object->clip.list, o);
|
||||
}
|
||||
|
||||
void
|
||||
_evas_get_current_clipped_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h)
|
||||
{
|
||||
if (!o->current.visible)
|
||||
{
|
||||
*x = 0.0;
|
||||
*y = 0.0;
|
||||
*w = 0.0;
|
||||
*h = 0.0;
|
||||
return;
|
||||
}
|
||||
if (o->clip.object)
|
||||
_evas_get_current_clipped_geometry(e, o->clip.object, x, y, w, h);
|
||||
CLIP_TO(*x, *y, *w, *h,
|
||||
o->current.x, o->current.y, o->current.w, o->current.h);
|
||||
}
|
||||
|
||||
void
|
||||
_evas_get_previous_clipped_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h)
|
||||
{
|
||||
if (!o->previous.visible)
|
||||
{
|
||||
*x = 0.0;
|
||||
*y = 0.0;
|
||||
*w = 0.0;
|
||||
*h = 0.0;
|
||||
return;
|
||||
}
|
||||
if (o->clip.object)
|
||||
_evas_get_current_clipped_geometry(e, o->clip.object, x, y, w, h);
|
||||
CLIP_TO(*x, *y, *w, *h,
|
||||
o->previous.x, o->previous.y, o->previous.w, o->previous.h);
|
||||
}
|
||||
|
||||
int
|
||||
_evas_point_in_object(Evas e, Evas_Object o, int x, int y)
|
||||
{
|
||||
double cx, cy;
|
||||
double ox, oy, ow, oh;
|
||||
|
||||
if (o->delete_me) return 0;
|
||||
cx = evas_screen_x_to_world(e, x);
|
||||
cy = evas_screen_x_to_world(e, y);
|
||||
ox = o->current.x; oy = o->current.y;
|
||||
ow = o->current.w; oh = o->current.h;
|
||||
_evas_get_current_clipped_geometry(e, o, &ox, &oy, &ow, &oh);
|
||||
if ((cx >= ox) && (cx < (ox + ow)) && (cy >= oy) && (cy < (oy + oh)))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
evas_set_clip(Evas e, Evas_Object o, Evas_Object clip)
|
||||
{
|
||||
if (!e) return;
|
||||
if (!o) return;
|
||||
if (!clip) return;
|
||||
|
||||
if (o->clip.object == clip) return;
|
||||
e->changed = 1;
|
||||
o->changed = 1;
|
||||
o->clip.changed = 1;
|
||||
if (o->clip.object)
|
||||
o->clip.object->clip.list = evas_list_remove(o->clip.object->clip.list, o);
|
||||
o->clip.object = clip;
|
||||
clip->clip.list = evas_list_prepend(clip->clip.list, o);
|
||||
}
|
||||
|
||||
void
|
||||
evas_unset_clip(Evas e, Evas_Object o)
|
||||
{
|
||||
if (!e) return;
|
||||
if (!o) return;
|
||||
|
||||
if (o->clip.object)
|
||||
{
|
||||
e->changed = 1;
|
||||
o->changed = 1;
|
||||
o->clip.changed = 1;
|
||||
o->clip.object->clip.list = evas_list_remove(o->clip.object->clip.list, o);
|
||||
o->clip.object = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Evas_Object
|
||||
evas_get_clip_object(Evas e, Evas_Object o)
|
||||
{
|
||||
if (!e) return NULL;
|
||||
if (!o) return NULL;
|
||||
|
||||
return o->clip.object;
|
||||
}
|
||||
|
||||
Evas_List
|
||||
evas_get_clip_list(Evas e, Evas_Object o)
|
||||
{
|
||||
if (!e) return NULL;
|
||||
if (!o) return NULL;
|
||||
|
||||
return o->clip.list;
|
||||
}
|
||||
|
||||
/* deleting objects */
|
||||
void
|
||||
evas_del_object(Evas e, Evas_Object o)
|
||||
{
|
||||
if (!e) return;
|
||||
if (!o) return;
|
||||
_evas_cleanup_clip(e, o);
|
||||
e->changed = 1;
|
||||
evas_hide(e, o);
|
||||
o->delete_me = 1;
|
||||
}
|
||||
|
@ -228,11 +355,14 @@ evas_objects_in_rect(Evas e, double x, double y, double w, double h)
|
|||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
|
||||
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me) && (!ob->clip.list))
|
||||
{
|
||||
if (RECTS_INTERSECT(x, y, w, h,
|
||||
ob->current.x, ob->current.y,
|
||||
ob->current.w, ob->current.h))
|
||||
double ox, oy, ow, oh;
|
||||
|
||||
ox = ob->current.x; oy = ob->current.y;
|
||||
ow = ob->current.w; oh = ob->current.h;
|
||||
_evas_get_current_clipped_geometry(e, ob, &ox, &oy, &ow, &oh);
|
||||
if (RECTS_INTERSECT(x, y, w, h, ox, oy, ow, oh))
|
||||
objs = evas_list_prepend(objs, ll->data);
|
||||
}
|
||||
}
|
||||
|
@ -257,11 +387,14 @@ evas_objects_at_position(Evas e, double x, double y)
|
|||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
|
||||
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me) && (!ob->clip.list))
|
||||
{
|
||||
if (RECTS_INTERSECT(x, y, 1, 1,
|
||||
ob->current.x, ob->current.y,
|
||||
ob->current.w, ob->current.h))
|
||||
double ox, oy, ow, oh;
|
||||
|
||||
ox = ob->current.x; oy = ob->current.y;
|
||||
ow = ob->current.w; oh = ob->current.h;
|
||||
_evas_get_current_clipped_geometry(e, ob, &ox, &oy, &ow, &oh);
|
||||
if (RECTS_INTERSECT(x, y, 1, 1, ox, oy, ow, oh))
|
||||
objs = evas_list_prepend(objs, ll->data);
|
||||
}
|
||||
}
|
||||
|
@ -287,11 +420,14 @@ evas_object_in_rect(Evas e, double x, double y, double w, double h)
|
|||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
|
||||
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me) && (!ob->clip.list))
|
||||
{
|
||||
if (RECTS_INTERSECT(x, y, w, h,
|
||||
ob->current.x, ob->current.y,
|
||||
ob->current.w, ob->current.h))
|
||||
double ox, oy, ow, oh;
|
||||
|
||||
ox = ob->current.x; oy = ob->current.y;
|
||||
ow = ob->current.w; oh = ob->current.h;
|
||||
_evas_get_current_clipped_geometry(e, ob, &ox, &oy, &ow, &oh);
|
||||
if (RECTS_INTERSECT(x, y, w, h, ox, oy, ow, oh))
|
||||
o = ob;
|
||||
}
|
||||
}
|
||||
|
@ -317,11 +453,14 @@ evas_object_at_position(Evas e, double x, double y)
|
|||
Evas_Object ob;
|
||||
|
||||
ob = ll->data;
|
||||
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me))
|
||||
if ((ob->current.visible) && (!ob->pass_events) && (!ob->delete_me) && (!ob->clip.list))
|
||||
{
|
||||
if (RECTS_INTERSECT(x, y, 1, 1,
|
||||
ob->current.x, ob->current.y,
|
||||
ob->current.w, ob->current.h))
|
||||
double ox, oy, ow, oh;
|
||||
|
||||
ox = ob->current.x; oy = ob->current.y;
|
||||
ow = ob->current.w; oh = ob->current.h;
|
||||
_evas_get_current_clipped_geometry(e, ob, &ox, &oy, &ow, &oh);
|
||||
if (RECTS_INTERSECT(x, y, 1.0, 1.0, ox, oy, ow, oh))
|
||||
o = ob;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,43 +17,58 @@
|
|||
((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
|
||||
#endif
|
||||
|
||||
void _evas_get_current_clipped_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h);
|
||||
void _evas_get_previous_clipped_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h);
|
||||
|
||||
void
|
||||
_evas_object_get_current_translated_coords(Evas e, Evas_Object o,
|
||||
int *x, int *y, int *w, int *h)
|
||||
int *x, int *y, int *w, int *h, int clip)
|
||||
{
|
||||
double ox, oy, ow, oh;
|
||||
|
||||
ox = o->current.x; oy = o->current.y;
|
||||
ow = o->current.w; oh = o->current.h;
|
||||
if (clip)
|
||||
_evas_get_current_clipped_geometry(e, o, &ox, &oy, &ow, &oh);
|
||||
*x = (int)
|
||||
(((o->current.x - e->current.viewport.x) *
|
||||
(((ox - e->current.viewport.x) *
|
||||
(double)e->current.drawable_width) /
|
||||
e->current.viewport.w);
|
||||
*y = (int)
|
||||
(((o->current.y - e->current.viewport.y) *
|
||||
(((oy - e->current.viewport.y) *
|
||||
(double)e->current.drawable_height) /
|
||||
e->current.viewport.h);
|
||||
*w = (int)
|
||||
((o->current.w * (double)e->current.drawable_width) /
|
||||
((ow * (double)e->current.drawable_width) /
|
||||
e->current.viewport.w);
|
||||
*h = (int)
|
||||
((o->current.h * (double)e->current.drawable_height) /
|
||||
((oh * (double)e->current.drawable_height) /
|
||||
e->current.viewport.h);
|
||||
}
|
||||
|
||||
void
|
||||
_evas_object_get_previous_translated_coords(Evas e, Evas_Object o,
|
||||
int *x, int *y, int *w, int *h)
|
||||
int *x, int *y, int *w, int *h, int clip)
|
||||
{
|
||||
double ox, oy, ow, oh;
|
||||
|
||||
ox = o->previous.x; oy = o->previous.y;
|
||||
ow = o->previous.w; oh = o->previous.h;
|
||||
if (clip)
|
||||
_evas_get_previous_clipped_geometry(e, o, &ox, &oy, &ow, &oh);
|
||||
*x = (int)
|
||||
(((o->previous.x - e->previous.viewport.x) *
|
||||
(((ox - e->previous.viewport.x) *
|
||||
(double)e->previous.drawable_width) /
|
||||
e->previous.viewport.w);
|
||||
*y = (int)
|
||||
(((o->previous.y - e->previous.viewport.y) *
|
||||
(((oy - e->previous.viewport.y) *
|
||||
(double)e->previous.drawable_height) /
|
||||
e->previous.viewport.h);
|
||||
*w = (int)
|
||||
((o->previous.w * (double)e->previous.drawable_width) /
|
||||
((ow * (double)e->previous.drawable_width) /
|
||||
e->previous.viewport.w);
|
||||
*h = (int)
|
||||
((o->previous.h * (double)e->previous.drawable_height) /
|
||||
((oh * (double)e->previous.drawable_height) /
|
||||
e->previous.viewport.h);
|
||||
}
|
||||
|
||||
|
@ -178,6 +193,7 @@ evas_render_updates(Evas e)
|
|||
void (*func_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);
|
||||
void (*func_gradient_draw) (void *gr, Display *disp, Imlib_Image dstim, Window win, int win_w, int win_h, int x, int y, int w, int h, double angle);
|
||||
void (*func_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);
|
||||
void (*func_set_clip_rect) (int on, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
|
||||
if (!e) return NULL;
|
||||
if ((e->current.render_method == RENDER_METHOD_IMAGE) &&
|
||||
|
@ -215,6 +231,7 @@ evas_render_updates(Evas e)
|
|||
func_line_draw = __evas_imlib_line_draw;
|
||||
func_gradient_draw = __evas_imlib_gradient_draw;
|
||||
func_poly_draw = __evas_imlib_poly_draw;
|
||||
func_set_clip_rect = __evas_imlib_set_clip_rect;
|
||||
break;
|
||||
case RENDER_METHOD_BASIC_HARDWARE:
|
||||
func_draw_add_rect = __evas_x11_draw_add_rect;
|
||||
|
@ -233,6 +250,7 @@ evas_render_updates(Evas e)
|
|||
func_line_draw = __evas_x11_line_draw;
|
||||
func_gradient_draw = __evas_x11_gradient_draw;
|
||||
func_poly_draw = __evas_x11_poly_draw;
|
||||
func_set_clip_rect = __evas_x11_set_clip_rect;
|
||||
break;
|
||||
case RENDER_METHOD_3D_HARDWARE:
|
||||
func_draw_add_rect = __evas_gl_draw_add_rect;
|
||||
|
@ -251,6 +269,7 @@ evas_render_updates(Evas e)
|
|||
func_line_draw = __evas_gl_line_draw;
|
||||
func_gradient_draw = __evas_gl_gradient_draw;
|
||||
func_poly_draw = __evas_gl_poly_draw;
|
||||
func_set_clip_rect = __evas_gl_set_clip_rect;
|
||||
break;
|
||||
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||
func_draw_add_rect = __evas_render_draw_add_rect;
|
||||
|
@ -269,6 +288,7 @@ evas_render_updates(Evas e)
|
|||
func_line_draw = __evas_render_line_draw;
|
||||
func_gradient_draw = __evas_render_gradient_draw;
|
||||
func_poly_draw = __evas_render_poly_draw;
|
||||
func_set_clip_rect = __evas_render_set_clip_rect;
|
||||
break;
|
||||
case RENDER_METHOD_IMAGE:
|
||||
func_draw_add_rect = __evas_image_draw_add_rect;
|
||||
|
@ -287,6 +307,7 @@ evas_render_updates(Evas e)
|
|||
func_line_draw = __evas_image_line_draw;
|
||||
func_gradient_draw = __evas_image_gradient_draw;
|
||||
func_poly_draw = __evas_image_poly_draw;
|
||||
func_set_clip_rect = __evas_image_set_clip_rect;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -311,10 +332,11 @@ evas_render_updates(Evas e)
|
|||
for (ll = layer->objects; ll; ll = ll->next)
|
||||
{
|
||||
Evas_Object_Any o;
|
||||
int real_change, prop_change;
|
||||
int real_change, prop_change, clip_change;
|
||||
|
||||
real_change = 0;
|
||||
prop_change = 0;
|
||||
clip_change = 0;
|
||||
o = ll->data;
|
||||
|
||||
if (o->delete_me)
|
||||
|
@ -330,7 +352,8 @@ evas_render_updates(Evas e)
|
|||
(o->current.h != o->previous.h) ||
|
||||
(o->current.zoomscale != o->previous.zoomscale) ||
|
||||
(o->current.layer != o->previous.layer) ||
|
||||
(o->current.stacking)))
|
||||
(o->current.stacking) ||
|
||||
(o->clip.changed)))
|
||||
)
|
||||
{
|
||||
if (((o->current.visible != o->previous.visible) ||
|
||||
|
@ -353,8 +376,8 @@ evas_render_updates(Evas e)
|
|||
prop_change = 1;
|
||||
}
|
||||
real_change = 1;
|
||||
}
|
||||
|
||||
clip_change = o->clip.changed;
|
||||
}
|
||||
|
||||
o->current.stacking = 0;
|
||||
if ((!real_change) && (o->current.visible))
|
||||
|
@ -490,10 +513,12 @@ evas_render_updates(Evas e)
|
|||
|
||||
_evas_object_get_previous_translated_coords(e, o,
|
||||
&x, &y,
|
||||
&w, &h);
|
||||
&w, &h,
|
||||
1 - clip_change);
|
||||
_evas_object_get_current_translated_coords(e, o,
|
||||
&xx, &yy,
|
||||
&ww, &hh);
|
||||
&ww, &hh,
|
||||
1 - clip_change);
|
||||
rl = NULL;
|
||||
if (x < xx)
|
||||
{
|
||||
|
@ -576,11 +601,13 @@ evas_render_updates(Evas e)
|
|||
{
|
||||
_evas_object_get_previous_translated_coords(e, o,
|
||||
&x, &y,
|
||||
&w, &h);
|
||||
&w, &h,
|
||||
1 - clip_change);
|
||||
evas_update_rect(e, x, y, w, h);
|
||||
_evas_object_get_current_translated_coords(e, o,
|
||||
&x, &y,
|
||||
&w, &h);
|
||||
&w, &h,
|
||||
1 - clip_change);
|
||||
evas_update_rect(e, x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
@ -637,12 +664,50 @@ evas_render_updates(Evas e)
|
|||
|
||||
_evas_object_get_current_translated_coords(e, o,
|
||||
&x, &y,
|
||||
&w, &h);
|
||||
&w, &h,
|
||||
1 - o->clip.changed);
|
||||
o->clip.changed = 0;
|
||||
if (RECTS_INTERSECT(0, 0,
|
||||
e->current.drawable_width,
|
||||
e->current.drawable_height,
|
||||
x, y, w, h))
|
||||
x, y, w, h) &&
|
||||
(!o->clip.list))
|
||||
{
|
||||
if (!o->clip.changed)
|
||||
_evas_object_get_current_translated_coords(e, o,
|
||||
&x, &y,
|
||||
&w, &h,
|
||||
0);
|
||||
if (o->clip.object)
|
||||
{
|
||||
Evas_Object_Rectangle oo;
|
||||
int clr, clg, clb, cla;
|
||||
int clx, cly, clw, clh;
|
||||
|
||||
clr = 255;
|
||||
clg = 255;
|
||||
clb = 255;
|
||||
cla = 255;
|
||||
if (o->clip.object->type == OBJECT_RECTANGLE)
|
||||
{
|
||||
oo = o->clip.object;
|
||||
|
||||
clr = oo->current.r;
|
||||
clg = oo->current.g;
|
||||
clb = oo->current.b;
|
||||
cla = oo->current.a;
|
||||
}
|
||||
_evas_object_get_current_translated_coords(e, o,
|
||||
&clx, &cly,
|
||||
&clw, &clh,
|
||||
1);
|
||||
if ((clw > 1) && (clh > 1))
|
||||
func_set_clip_rect(1, clx, cly, clw, clh, clr, clg, clb, cla);
|
||||
else
|
||||
func_set_clip_rect(1, e->current.drawable_width + 1, e->current.drawable_height + 1, 1, 1, 255, 255, 255, 255);
|
||||
}
|
||||
else
|
||||
func_set_clip_rect(0, 0, 0, 0, 0, 255, 255, 255, 255);
|
||||
switch (o->type)
|
||||
{
|
||||
case OBJECT_IMAGE:
|
||||
|
|
|
@ -7,6 +7,17 @@ static void __evas_render_image_cache_flush(Display *disp);
|
|||
static int __evas_anti_alias = 1;
|
||||
static Evas_List drawable_list = NULL;
|
||||
|
||||
/* the current clip region and color */
|
||||
static int __evas_clip = 0;
|
||||
static int __evas_clip_x = 0;
|
||||
static int __evas_clip_y = 0;
|
||||
static int __evas_clip_w = 0;
|
||||
static int __evas_clip_h = 0;
|
||||
static int __evas_clip_r = 0;
|
||||
static int __evas_clip_g = 0;
|
||||
static int __evas_clip_b = 0;
|
||||
static int __evas_clip_a = 0;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* image internals ***********************************************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -611,6 +622,20 @@ __evas_render_poly_draw (Display *disp, Imlib_Image dstim, Window win,
|
|||
static Visual *__evas_visual = NULL;
|
||||
static Colormap __evas_cmap = 0;
|
||||
|
||||
void
|
||||
__evas_render_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a)
|
||||
{
|
||||
__evas_clip = on;
|
||||
__evas_clip_x = x;
|
||||
__evas_clip_y = y;
|
||||
__evas_clip_w = w;
|
||||
__evas_clip_h = h;
|
||||
__evas_clip_r = r;
|
||||
__evas_clip_g = g;
|
||||
__evas_clip_b = b;
|
||||
__evas_clip_a = a;
|
||||
}
|
||||
|
||||
void
|
||||
__evas_render_sync(Display *disp)
|
||||
{
|
||||
|
@ -811,6 +836,7 @@ void __evas_render_poly_draw (Display *disp, Imlib_Image dstim, Win
|
|||
/***********/
|
||||
/* drawing */
|
||||
/***********/
|
||||
void __evas_render_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a) {}
|
||||
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){}
|
||||
|
|
|
@ -131,6 +131,7 @@ void __evas_render_poly_draw (Display *disp, Imlib_Image dstim,
|
|||
/***********/
|
||||
/* drawing */
|
||||
/***********/
|
||||
void __evas_render_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
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);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -12,6 +12,12 @@
|
|||
#include <X11/Xatom.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#ifdef HAVE_FREETYPE_FREETYPE_H
|
||||
#include <freetype/freetype.h>
|
||||
#else
|
||||
#include <freetype.h>
|
||||
#endif
|
||||
|
||||
#include "Evas_private.h"
|
||||
#include "Evas.h"
|
||||
|
||||
|
@ -24,12 +30,14 @@
|
|||
((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
|
||||
#endif
|
||||
|
||||
typedef void Evas_X11_Image;
|
||||
typedef void Evas_X11_Font;
|
||||
typedef void Evas_X11_Graident;
|
||||
typedef struct _evas_x11_image Evas_X11_Image;
|
||||
typedef struct _evas_x11_font Evas_X11_Font;
|
||||
typedef struct _evas_x11_gradient Evas_X11_Graident;
|
||||
typedef struct _evas_x11_color Evas_X11_Color;
|
||||
typedef struct _evas_x11_glyph Evas_X11_Glyph;
|
||||
|
||||
typedef struct _evas_x11_drawable Evas_X11_Drawable;
|
||||
typedef struct _evas_x11_update Evas_X11_Update;
|
||||
typedef struct _evas_x11_update Evas_X11_Update;
|
||||
|
||||
struct _evas_x11_drawable
|
||||
{
|
||||
|
@ -46,6 +54,67 @@ struct _evas_x11_update
|
|||
int x, y, w, h;
|
||||
};
|
||||
|
||||
struct _evas_x11_image
|
||||
{
|
||||
GC gc;
|
||||
Display *disp;
|
||||
Window win;
|
||||
int pw, ph, pr, pg, pb, pa;
|
||||
Pixmap pmap;
|
||||
Pixmap mask;
|
||||
int w, h;
|
||||
int has_alpha;
|
||||
char *file;
|
||||
Imlib_Image image;
|
||||
int references;
|
||||
};
|
||||
|
||||
struct _evas_x11_glyph
|
||||
{
|
||||
int glyph_id;
|
||||
TT_Glyph glyph;
|
||||
|
||||
TT_Glyph_Metrics metrics;
|
||||
|
||||
int pw, ph;
|
||||
Pixmap pmap;
|
||||
};
|
||||
|
||||
struct _evas_x11_font
|
||||
{
|
||||
char *font;
|
||||
int size;
|
||||
|
||||
Display *disp;
|
||||
|
||||
TT_Engine engine;
|
||||
TT_Face face;
|
||||
TT_Instance instance;
|
||||
TT_Face_Properties properties;
|
||||
TT_CharMap char_map;
|
||||
TT_Instance_Metrics metrics;
|
||||
|
||||
Evas_List glyphs[256];
|
||||
|
||||
int ascent;
|
||||
int descent;
|
||||
int max_descent;
|
||||
int max_ascent;
|
||||
|
||||
int references;
|
||||
};
|
||||
|
||||
struct _evas_x11_gradient
|
||||
{
|
||||
Evas_List colors;
|
||||
};
|
||||
|
||||
struct _evas_x11_color
|
||||
{
|
||||
int r, g, b, a;
|
||||
int dist;
|
||||
};
|
||||
|
||||
/***************/
|
||||
/* image stuff */
|
||||
/***************/
|
||||
|
@ -110,6 +179,7 @@ void __evas_x11_poly_draw (Display *disp, Imlib_Image dstim, Wi
|
|||
/***********/
|
||||
/* drawing */
|
||||
/***********/
|
||||
void __evas_x11_set_clip_rect(int on, int x, int y, int w, int h, int r, int g, int b, int a);
|
||||
void __evas_x11_init(Display *disp, int screen, int colors);
|
||||
int __evas_x11_capable(Display *disp);
|
||||
void __evas_x11_flush_draw(Display *disp, Imlib_Image dstim, Window win);
|
||||
|
|
|
@ -1147,6 +1147,7 @@ animate(double val)
|
|||
|
||||
fps = (double)framecount / (val - last_time);
|
||||
sprintf(buf, "FPS: %3.2f", fps);
|
||||
printf("%s\n", buf);
|
||||
evas_set_text(evas_view, o_fps, buf);
|
||||
framecount = -1;
|
||||
last_time = val;
|
||||
|
|
|
@ -212,6 +212,25 @@ main(int argc, char **argv)
|
|||
h /= 2;
|
||||
evas_show(e, o[1]);
|
||||
|
||||
o_rect = evas_add_rectangle(e);
|
||||
evas_show(e, o_rect);
|
||||
evas_move(e, o_rect, 100, 80);
|
||||
evas_resize(e, o_rect, 120, 120);
|
||||
evas_set_color(e, o_rect, rand()&0xff, rand()&0xff, rand()&0xff, 200);
|
||||
evas_set_layer(e, o_rect, 180);
|
||||
evas_callback_add(e, o_rect, CALLBACK_MOUSE_DOWN, mouse_down, NULL);
|
||||
evas_callback_add(e, o_rect, CALLBACK_MOUSE_UP, mouse_up, NULL);
|
||||
evas_callback_add(e, o_rect, CALLBACK_MOUSE_MOVE, mouse_move, NULL);
|
||||
evas_callback_add(e, o_rect, CALLBACK_MOUSE_IN, mouse_in, NULL);
|
||||
evas_callback_add(e, o_rect, CALLBACK_MOUSE_OUT, mouse_out, NULL);
|
||||
|
||||
o_rect = evas_add_rectangle(e);
|
||||
evas_show(e, o_rect);
|
||||
evas_move(e, o_rect, 200, 100);
|
||||
evas_resize(e, o_rect, 300, 200);
|
||||
evas_set_color(e, o_rect, rand()&0xff, rand()&0xff, rand()&0xff, 200);
|
||||
evas_set_layer(e, o_rect, 150);
|
||||
|
||||
for (i = 2 ; i < 120; i++)
|
||||
{
|
||||
o[i] = evas_add_image_from_file(e, IMGDIR"mush.png");
|
||||
|
@ -222,6 +241,7 @@ main(int argc, char **argv)
|
|||
evas_callback_add(e, o[i], CALLBACK_MOUSE_MOVE, mouse_move, NULL);
|
||||
evas_callback_add(e, o[i], CALLBACK_MOUSE_IN, mouse_in, NULL);
|
||||
evas_callback_add(e, o[i], CALLBACK_MOUSE_OUT, mouse_out, NULL);
|
||||
evas_set_clip(e, o[i], o_rect);
|
||||
}
|
||||
for (i = 120; i < 128; i++)
|
||||
{
|
||||
|
@ -235,17 +255,6 @@ main(int argc, char **argv)
|
|||
evas_callback_add(e, o[i], CALLBACK_MOUSE_IN, mouse_in, NULL);
|
||||
evas_callback_add(e, o[i], CALLBACK_MOUSE_OUT, mouse_out, NULL);
|
||||
}
|
||||
o_rect = evas_add_rectangle(e);
|
||||
evas_show(e, o_rect);
|
||||
evas_move(e, o_rect, 100, 100);
|
||||
evas_resize(e, o_rect, 200, 100);
|
||||
evas_set_color(e, o_rect, rand()&0xff, rand()&0xff, rand()&0xff, 120);
|
||||
evas_set_layer(e, o_rect, 150);
|
||||
evas_callback_add(e, o_rect, CALLBACK_MOUSE_DOWN, mouse_down, NULL);
|
||||
evas_callback_add(e, o_rect, CALLBACK_MOUSE_UP, mouse_up, NULL);
|
||||
evas_callback_add(e, o_rect, CALLBACK_MOUSE_MOVE, mouse_move, NULL);
|
||||
evas_callback_add(e, o_rect, CALLBACK_MOUSE_IN, mouse_in, NULL);
|
||||
evas_callback_add(e, o_rect, CALLBACK_MOUSE_OUT, mouse_out, NULL);
|
||||
|
||||
o_poly = evas_add_poly(e);
|
||||
evas_show(e, o_poly);
|
||||
|
@ -267,7 +276,7 @@ main(int argc, char **argv)
|
|||
o_line = evas_add_line(e);
|
||||
evas_show(e, o_line);
|
||||
evas_set_line_xy(e, o_line, 10, 20, 100, 50);
|
||||
evas_set_color(e, o_line, rand()&0xff, rand()&0xff, rand()&0xff, 120);
|
||||
evas_set_color(e, o_line, rand()&0xff, rand()&0xff, rand()&0xff, 140);
|
||||
evas_set_layer(e, o_rect, 150);
|
||||
evas_callback_add(e, o_line, CALLBACK_MOUSE_DOWN, mouse_down, NULL);
|
||||
evas_callback_add(e, o_line, CALLBACK_MOUSE_UP, mouse_up, NULL);
|
||||
|
@ -278,7 +287,7 @@ main(int argc, char **argv)
|
|||
o_grad = evas_add_gradient_box(e);
|
||||
evas_show(e, o_grad);
|
||||
evas_move(e, o_grad, 300, 50);
|
||||
evas_resize(e, o_grad, 200, 200);
|
||||
evas_resize(e, o_grad, 300, 300);
|
||||
evas_set_layer(e, o_grad, 150);
|
||||
grad = evas_gradient_new();
|
||||
evas_gradient_add_color(grad, 255, 255, 255, 255, 8);
|
||||
|
@ -291,6 +300,7 @@ main(int argc, char **argv)
|
|||
evas_callback_add(e, o_grad, CALLBACK_MOUSE_MOVE, mouse_move, NULL);
|
||||
evas_callback_add(e, o_grad, CALLBACK_MOUSE_IN, mouse_in, NULL);
|
||||
evas_callback_add(e, o_grad, CALLBACK_MOUSE_OUT, mouse_out, NULL);
|
||||
/* evas_set_clip(e, o_grad, o_rect);*/
|
||||
|
||||
o_text = evas_add_text(e, "grunge", 14, "Click and Drag Objects...");
|
||||
evas_set_color(e, o_text, 0, 0, 0, 160);
|
||||
|
@ -304,7 +314,7 @@ main(int argc, char **argv)
|
|||
evas_callback_add(e, o_text, CALLBACK_MOUSE_OUT, mouse_out, NULL);
|
||||
|
||||
o_fps = evas_add_text(e, "morpheus", 16, "FPS...");
|
||||
evas_set_color(e, o_fps, 255, 255, 255, 120);
|
||||
evas_set_color(e, o_fps, 255, 255, 255, 140);
|
||||
evas_move(e, o_fps, win_w, win_h);
|
||||
evas_show(e, o_fps);
|
||||
evas_set_layer(e, o_fps, 500);
|
||||
|
@ -388,9 +398,9 @@ main(int argc, char **argv)
|
|||
if (i < 100)
|
||||
evas_set_image_file(e, o[i], imgs[(i) & 0x7]);
|
||||
evas_move(e, o[i], x, y);
|
||||
ww = ((1.2 + cos((double)(a + j + m) * 2 * 3.141592654 / 1000)) * 48);
|
||||
hh = ww;
|
||||
/*
|
||||
ww = ((1.2 + cos((double)(a + j + m) * 2 * 3.141592654 / 1000)) * 24);
|
||||
hh = ww;
|
||||
evas_resize(e, o[i], ww, hh);
|
||||
evas_set_image_fill(e, o[i], 0, 0, ww, hh);
|
||||
evas_set_color(e, o[i], 255, 255, 255,
|
||||
|
|
Loading…
Reference in New Issue