forked from enlightenment/efl
wooooo!
core bits of evas api actually do stuff now.. evas test it beginning to use them if you want to have ann ide how easy it is to use evas as a rendeirng engine just look at evas_test.. notice the evas setup is just a few calls (create, set the output drawable, the output size of the window and the viewport into the evas's virtual world - the its a mater of creating a few objects and notice the main loo ONLy does 2 things - move the objects then call render - evas will optimize to only render the bits that changed all for you. there's a lot fo thank;less nasty state chekcing code just for this. i'm going to have to write a lot fo it - image obejcts only done sofar. you cant do anytign except move and resize them and add them and show and hide them. freeing them wont work. layers dont work. no api to set performance cache or to access it. fill modes for images dont work either nor is there an api to set an images border scaling) SVN revision: 3090
This commit is contained in:
parent
c72ef1301d
commit
73de169494
|
@ -11,7 +11,7 @@ typedef struct _Evas_Object_Any * Evas_Object_Any;
|
||||||
typedef int Evas_Callback_Type;
|
typedef int Evas_Callback_Type;
|
||||||
typedef int Evas_Image_Format;
|
typedef int Evas_Image_Format;
|
||||||
typedef int Evas_Render_Method;
|
typedef int Evas_Render_Method;
|
||||||
typedef struct _Evas_Render_Data * Evas_Render_Data;
|
typedef struct _Evas_Render_Data Evas_Render_Data;
|
||||||
typedef struct _Evas_List * Evas_List;
|
typedef struct _Evas_List * Evas_List;
|
||||||
typedef struct _Evas_Layer * Evas_Layer;
|
typedef struct _Evas_Layer * Evas_Layer;
|
||||||
typedef struct _Evas_Color_Point * Evas_Color_Point;
|
typedef struct _Evas_Color_Point * Evas_Color_Point;
|
||||||
|
@ -40,12 +40,18 @@ typedef struct _Evas_Object_Bits * Evas_Object_Bits;
|
||||||
#define IMAGE_FORMAT_RGB 2
|
#define IMAGE_FORMAT_RGB 2
|
||||||
#define IMAGE_FORMAT_GRAY 3
|
#define IMAGE_FORMAT_GRAY 3
|
||||||
|
|
||||||
#define OBJECT_IMAGE 0
|
#define OBJECT_IMAGE 1230
|
||||||
#define OBJECT_TEXT 1
|
#define OBJECT_TEXT 1231
|
||||||
#define OBJECT_RECTANGLE 2
|
#define OBJECT_RECTANGLE 1232
|
||||||
#define OBJECT_LINE 3
|
#define OBJECT_LINE 1233
|
||||||
#define OBJECT_GRADIENT_BOX 4
|
#define OBJECT_GRADIENT_BOX 1234
|
||||||
#define OBJECT_BITS 5
|
#define OBJECT_BITS 1235
|
||||||
|
|
||||||
|
|
||||||
|
struct _Evas_Render_Data
|
||||||
|
{
|
||||||
|
int *method[RENDER_METHOD_COUNT];
|
||||||
|
};
|
||||||
|
|
||||||
struct _Evas
|
struct _Evas
|
||||||
{
|
{
|
||||||
|
@ -54,6 +60,9 @@ struct _Evas
|
||||||
Drawable drawable;
|
Drawable drawable;
|
||||||
Visual *visual;
|
Visual *visual;
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
|
int screen;
|
||||||
|
|
||||||
|
int drawable_width, drawable_height;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
double x, y, w, h;
|
double x, y, w, h;
|
||||||
|
@ -65,18 +74,12 @@ struct _Evas
|
||||||
|
|
||||||
} current, previous;
|
} current, previous;
|
||||||
|
|
||||||
void (*object_renderer_data_free) (Evas _e, Evas_Object _o);
|
|
||||||
void (*evas_renderer_data_free) (Evas _e);
|
void (*evas_renderer_data_free) (Evas _e);
|
||||||
|
|
||||||
int changed;
|
int changed;
|
||||||
|
|
||||||
Evas_List layers;
|
Evas_List layers;
|
||||||
Evas_List updates;
|
Imlib_Updates updates;
|
||||||
};
|
|
||||||
|
|
||||||
struct _Evas_Render_Data
|
|
||||||
{
|
|
||||||
void *method[RENDER_METHOD_COUNT];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evas_Color_Point
|
struct _Evas_Color_Point
|
||||||
|
@ -127,26 +130,33 @@ struct _Evas_Object_Any
|
||||||
double x, y, w, h;
|
double x, y, w, h;
|
||||||
int zoomscale;
|
int zoomscale;
|
||||||
int layer;
|
int layer;
|
||||||
|
int visible;
|
||||||
} current, previous;
|
} current, previous;
|
||||||
|
|
||||||
int changed;
|
int changed;
|
||||||
|
|
||||||
|
int delete_me;
|
||||||
|
|
||||||
void (*object_free) (Evas_Object _o);
|
void (*object_free) (Evas_Object _o);
|
||||||
|
void (*object_renderer_data_free) (Evas _e, Evas_Object _o);
|
||||||
|
|
||||||
Evas_List callbacks;
|
Evas_List callbacks;
|
||||||
|
|
||||||
void *renderer_data;
|
Evas_Render_Data renderer_data;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evas_Object_Image
|
struct _Evas_Object_Image
|
||||||
{
|
{
|
||||||
Evas_Object_Any object;
|
struct _Evas_Object_Any object;
|
||||||
struct {
|
struct {
|
||||||
char *file;
|
char *file;
|
||||||
int new_data;
|
int new_data;
|
||||||
int scale;
|
int scale;
|
||||||
struct _fill {
|
struct {
|
||||||
|
int w, h;
|
||||||
|
} image;
|
||||||
|
struct {
|
||||||
double x, y, w, h;
|
double x, y, w, h;
|
||||||
} fill;
|
} fill;
|
||||||
} current, previous;
|
} current, previous;
|
||||||
|
@ -154,7 +164,7 @@ struct _Evas_Object_Image
|
||||||
|
|
||||||
struct _Evas_Object_Text
|
struct _Evas_Object_Text
|
||||||
{
|
{
|
||||||
Evas_Object_Any object;
|
struct _Evas_Object_Any object;
|
||||||
struct {
|
struct {
|
||||||
char *text;
|
char *text;
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
|
@ -163,7 +173,7 @@ struct _Evas_Object_Text
|
||||||
|
|
||||||
struct _Evas_Object_Rectangle
|
struct _Evas_Object_Rectangle
|
||||||
{
|
{
|
||||||
Evas_Object_Any object;
|
struct _Evas_Object_Any object;
|
||||||
struct {
|
struct {
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
} current, previous;
|
} current, previous;
|
||||||
|
@ -171,7 +181,7 @@ struct _Evas_Object_Rectangle
|
||||||
|
|
||||||
struct _Evas_Object_Line
|
struct _Evas_Object_Line
|
||||||
{
|
{
|
||||||
Evas_Object_Any object;
|
struct _Evas_Object_Any object;
|
||||||
struct {
|
struct {
|
||||||
double x1, y1, x2, y2;
|
double x1, y1, x2, y2;
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
|
@ -180,7 +190,7 @@ struct _Evas_Object_Line
|
||||||
|
|
||||||
struct _Evas_Object_Gradient_Box
|
struct _Evas_Object_Gradient_Box
|
||||||
{
|
{
|
||||||
Evas_Object_Any object;
|
struct _Evas_Object_Any object;
|
||||||
struct {
|
struct {
|
||||||
Evas_Gradient gradient;
|
Evas_Gradient gradient;
|
||||||
double angle;
|
double angle;
|
||||||
|
@ -189,7 +199,7 @@ struct _Evas_Object_Gradient_Box
|
||||||
|
|
||||||
struct _Evas_Object_Bits
|
struct _Evas_Object_Bits
|
||||||
{
|
{
|
||||||
Evas_Object_Any object;
|
struct _Evas_Object_Any object;
|
||||||
struct {
|
struct {
|
||||||
char *file;
|
char *file;
|
||||||
} current, previous;
|
} current, previous;
|
||||||
|
@ -215,6 +225,7 @@ Colormap evas_get_optimal_colormap(Evas e, Display *disp);
|
||||||
|
|
||||||
/* the output settings */
|
/* the output settings */
|
||||||
void evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c);
|
void evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c);
|
||||||
|
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_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_output_method(Evas e, Evas_Render_Method method);
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ static void __evas_gl_image_move_state_data_to_texture(Evas_GL_Image *
|
||||||
static void __evas_gl_image_calc_tex_and_poly(Evas_GL_Image *im, int x, double *x1, double *x2, int *tx, int *txx, double *dtx, double *dtxx, int tw, int w, int edge);
|
static void __evas_gl_image_calc_tex_and_poly(Evas_GL_Image *im, int x, double *x1, double *x2, int *tx, int *txx, double *dtx, double *dtxx, int tw, int w, int edge);
|
||||||
static Evas_GL_Image *__evas_gl_create_image(void);
|
static Evas_GL_Image *__evas_gl_create_image(void);
|
||||||
static Evas_GL_Image *__evas_gl_image_create_from_file(Display *disp, char *file);
|
static Evas_GL_Image *__evas_gl_image_create_from_file(Display *disp, char *file);
|
||||||
|
static void __evas_gl_image_free_textures(Evas_GL_Image *im);
|
||||||
static void __evas_gl_image_destroy(Evas_GL_Image *im);
|
static void __evas_gl_image_destroy(Evas_GL_Image *im);
|
||||||
static void __evas_gl_image_cache_flush(Display *disp);
|
static void __evas_gl_image_cache_flush(Display *disp);
|
||||||
|
|
||||||
|
@ -252,7 +253,6 @@ __evas_gl_image_move_state_data_to_texture(Evas_GL_Image *im)
|
||||||
|
|
||||||
__evas_gl_image_copy_image_rect_to_texture(im, xx, yy, ww, hh, tw, th,
|
__evas_gl_image_copy_image_rect_to_texture(im, xx, yy, ww, hh, tw, th,
|
||||||
im->texture.textures[i]);
|
im->texture.textures[i]);
|
||||||
__evas_image_cache_used += (tw * th * 4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* done - set the actual image state to textured */
|
/* done - set the actual image state to textured */
|
||||||
|
@ -365,16 +365,37 @@ __evas_gl_image_create_from_file(Display *disp, char *file)
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
__evas_gl_image_free_textures(Evas_GL_Image *im)
|
||||||
|
{
|
||||||
|
if ((__evas_current_win != im->buffer.dest) ||
|
||||||
|
(__evas_current_disp != im->buffer.display))
|
||||||
|
{
|
||||||
|
glXMakeCurrent(im->buffer.display, im->buffer.dest, im->context);
|
||||||
|
__evas_current_disp = im->buffer.display;
|
||||||
|
__evas_current_win = im->buffer.dest;
|
||||||
|
}
|
||||||
|
if (im->texture.textures)
|
||||||
|
{
|
||||||
|
__evas_image_cache_used -=
|
||||||
|
((((im->texture.w - 1) * im->texture.max_size) *
|
||||||
|
((im->texture.h - 1) * im->texture.max_size)) +
|
||||||
|
((im->texture.w - 1) * im->texture.edge_h) +
|
||||||
|
((im->texture.h - 1) * im->texture.edge_w) +
|
||||||
|
(im->texture.edge_w * im->texture.edge_h)) * 4;
|
||||||
|
glDeleteTextures(im->texture.w * im->texture.h, im->texture.textures);
|
||||||
|
free(im->texture.textures);
|
||||||
|
im->texture.textures = NULL;
|
||||||
|
}
|
||||||
|
im->state = EVAS_STATE_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
__evas_gl_image_destroy(Evas_GL_Image *im)
|
__evas_gl_image_destroy(Evas_GL_Image *im)
|
||||||
{
|
{
|
||||||
if (im->file) free(im->file);
|
if (im->file) free(im->file);
|
||||||
if (im->data) free(im->data);
|
if (im->data) free(im->data);
|
||||||
if (im->texture.textures)
|
__evas_gl_image_free_textures(im);
|
||||||
{
|
|
||||||
glDeleteTextures(im->texture.w * im->texture.h, im->texture.textures);
|
|
||||||
free(im->texture.textures);
|
|
||||||
}
|
|
||||||
free(im);
|
free(im);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,13 +591,21 @@ __evas_gl_image_new_from_file(Display *disp, char *file)
|
||||||
__evas_images = evas_list_remove(__evas_images, im);
|
__evas_images = evas_list_remove(__evas_images, im);
|
||||||
__evas_images = evas_list_prepend(__evas_images, im);
|
__evas_images = evas_list_prepend(__evas_images, im);
|
||||||
}
|
}
|
||||||
|
if (im->references == 0)
|
||||||
|
__evas_image_cache_used -=
|
||||||
|
((((im->texture.w - 1) * im->texture.max_size) *
|
||||||
|
((im->texture.h - 1) * im->texture.max_size)) +
|
||||||
|
((im->texture.w - 1) * im->texture.edge_h) +
|
||||||
|
((im->texture.h - 1) * im->texture.edge_w) +
|
||||||
|
(im->texture.edge_w * im->texture.edge_h)) * 4;
|
||||||
im->references++;
|
im->references++;
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
im = __evas_gl_image_create_from_file(disp, file);
|
im = __evas_gl_image_create_from_file(disp, file);
|
||||||
__evas_images = evas_list_prepend(__evas_images, im);
|
if (im)
|
||||||
|
__evas_images = evas_list_prepend(__evas_images, im);
|
||||||
|
|
||||||
return im;
|
return im;
|
||||||
}
|
}
|
||||||
|
@ -585,6 +614,15 @@ void
|
||||||
__evas_gl_image_free(Evas_GL_Image *im)
|
__evas_gl_image_free(Evas_GL_Image *im)
|
||||||
{
|
{
|
||||||
im->references--;
|
im->references--;
|
||||||
|
if (im->references == 0)
|
||||||
|
{
|
||||||
|
__evas_image_cache_used +=
|
||||||
|
((((im->texture.w - 1) * im->texture.max_size) *
|
||||||
|
((im->texture.h - 1) * im->texture.max_size)) +
|
||||||
|
((im->texture.w - 1) * im->texture.edge_h) +
|
||||||
|
((im->texture.h - 1) * im->texture.edge_w) +
|
||||||
|
(im->texture.edge_w * im->texture.edge_h)) * 4;
|
||||||
|
}
|
||||||
if (im->references <= 0)
|
if (im->references <= 0)
|
||||||
__evas_gl_image_cache_flush(im->buffer.display);
|
__evas_gl_image_cache_flush(im->buffer.display);
|
||||||
}
|
}
|
||||||
|
@ -594,8 +632,9 @@ __evas_gl_image_cache_empty(Display *disp)
|
||||||
{
|
{
|
||||||
Evas_GL_Image *im = NULL, *im_last;
|
Evas_GL_Image *im = NULL, *im_last;
|
||||||
Evas_List l;
|
Evas_List l;
|
||||||
im_last = (Evas_GL_Image *)1;
|
int size;
|
||||||
|
|
||||||
|
im_last = (Evas_GL_Image *)1;
|
||||||
while (im_last)
|
while (im_last)
|
||||||
{
|
{
|
||||||
im_last = NULL;
|
im_last = NULL;
|
||||||
|
@ -603,6 +642,7 @@ __evas_gl_image_cache_empty(Display *disp)
|
||||||
{
|
{
|
||||||
im = l->data;
|
im = l->data;
|
||||||
|
|
||||||
|
__evas_gl_image_free_textures(im);
|
||||||
if (im->references <= 0)
|
if (im->references <= 0)
|
||||||
im_last = im;
|
im_last = im;
|
||||||
}
|
}
|
||||||
|
@ -612,6 +652,9 @@ __evas_gl_image_cache_empty(Display *disp)
|
||||||
__evas_gl_image_destroy(im_last);
|
__evas_gl_image_destroy(im_last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
size = imlib_get_cache_size();
|
||||||
|
imlib_set_cache_size(0);
|
||||||
|
imlib_set_cache_size(size);
|
||||||
disp = NULL;
|
disp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,6 +707,8 @@ __evas_gl_image_set_borders(Evas_GL_Image *im, int left, int right,
|
||||||
void
|
void
|
||||||
__evas_gl_image_set_smooth_scaling(int on)
|
__evas_gl_image_set_smooth_scaling(int on)
|
||||||
{
|
{
|
||||||
|
if (on != __evas_anti_alias)
|
||||||
|
__evas_gl_image_cache_empty(__evas_current_disp);
|
||||||
__evas_anti_alias = on;
|
__evas_anti_alias = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1232,7 +1277,7 @@ __evas_gl_text_font_destroy(Evas_GL_Font *font)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
__evas_font_cache_used += 256 * 128 * font->num_textures;
|
__evas_font_cache_used -= 256 * 128 * font->num_textures;
|
||||||
/* free freetype instance stuff */
|
/* free freetype instance stuff */
|
||||||
TT_Done_Instance(font->instance);
|
TT_Done_Instance(font->instance);
|
||||||
TT_Close_Face(font->face);
|
TT_Close_Face(font->face);
|
||||||
|
@ -1297,6 +1342,8 @@ __evas_gl_text_font_new(Display *disp, char *font, int size)
|
||||||
if ((f->buffer.display == disp) && (!strcmp(font, f->file)) &&
|
if ((f->buffer.display == disp) && (!strcmp(font, f->file)) &&
|
||||||
(f->size == size))
|
(f->size == size))
|
||||||
{
|
{
|
||||||
|
if (f->references == 0)
|
||||||
|
__evas_font_cache_used -= 256 * 128 * f->num_textures;
|
||||||
f->references++;
|
f->references++;
|
||||||
if (l != __evas_fonts)
|
if (l != __evas_fonts)
|
||||||
{
|
{
|
||||||
|
@ -1352,6 +1399,7 @@ __evas_gl_text_font_free(Evas_GL_Font *fn)
|
||||||
fn->references--;
|
fn->references--;
|
||||||
if (fn->references == 0)
|
if (fn->references == 0)
|
||||||
__evas_font_cache_used += 256 * 128 * fn->num_textures;
|
__evas_font_cache_used += 256 * 128 * fn->num_textures;
|
||||||
|
if (fn->references >= 0)
|
||||||
__evas_gl_text_cache_flush();
|
__evas_gl_text_cache_flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2013,6 +2061,12 @@ __evas_gl_sync(Display *disp)
|
||||||
void
|
void
|
||||||
__evas_gl_flush_draw(Display *disp, Window win)
|
__evas_gl_flush_draw(Display *disp, Window win)
|
||||||
{
|
{
|
||||||
|
if ((__evas_current_win != win) || (__evas_current_disp != disp))
|
||||||
|
{
|
||||||
|
glXMakeCurrent(disp, win, __evas_gl_cx);
|
||||||
|
__evas_current_disp = disp;
|
||||||
|
__evas_current_win = win;
|
||||||
|
}
|
||||||
glXSwapBuffers(disp, win);
|
glXSwapBuffers(disp, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,65 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
_evas_free_image(Evas_Object o)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_evas_free_image_renderer_data(Evas e, Evas_Object o)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/* adding objects */
|
/* adding objects */
|
||||||
Evas_Object
|
Evas_Object
|
||||||
evas_add_image_from_file(Evas e, char *file)
|
evas_add_image_from_file(Evas e, char *file)
|
||||||
{
|
{
|
||||||
|
Evas_Object_Image oo;
|
||||||
|
Evas_Object_Any o;
|
||||||
|
Evas_List l;
|
||||||
|
Evas_Layer layer;
|
||||||
|
|
||||||
|
o = oo = malloc(sizeof(struct _Evas_Object_Image));
|
||||||
|
memset(o, 0, sizeof(struct _Evas_Object_Image));
|
||||||
|
o->type = OBJECT_IMAGE;
|
||||||
|
o->object_free = _evas_free_image;
|
||||||
|
o->object_renderer_data_free = _evas_free_image_renderer_data;
|
||||||
|
|
||||||
|
oo->current.file = strdup(file);
|
||||||
|
{
|
||||||
|
Imlib_Image im;
|
||||||
|
|
||||||
|
im = imlib_load_image(file);
|
||||||
|
if (im)
|
||||||
|
{
|
||||||
|
imlib_context_set_image(im);
|
||||||
|
oo->current.image.w = imlib_image_get_width();
|
||||||
|
oo->current.image.h = imlib_image_get_height();
|
||||||
|
o->current.x = 0;
|
||||||
|
o->current.y = 0;
|
||||||
|
o->current.w = (double)oo->current.image.w;
|
||||||
|
o->current.h = (double)oo->current.image.h;
|
||||||
|
imlib_free_image();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (l = e->layers; l; l = l->next)
|
||||||
|
{
|
||||||
|
layer = l->data;
|
||||||
|
if (layer->layer == o->current.layer)
|
||||||
|
{
|
||||||
|
layer->objects = evas_list_append(layer->objects, o);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
layer = malloc(sizeof(struct _Evas_Layer));
|
||||||
|
memset(layer, 0, sizeof(struct _Evas_Layer));
|
||||||
|
e->layers = evas_list_append(e->layers, layer);
|
||||||
|
layer->objects = evas_list_append(layer->objects, o);
|
||||||
|
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
Evas_Object
|
Evas_Object
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
|
((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
|
||||||
|
|
||||||
static void __evas_imlib_image_cache_flush(Display *disp);
|
static void __evas_imlib_image_cache_flush(Display *disp);
|
||||||
|
static int __evas_anti_alias = 1;
|
||||||
static Evas_List drawable_list = NULL;
|
static Evas_List drawable_list = NULL;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -73,7 +74,7 @@ __evas_imlib_image_draw(Evas_Imlib_Image *im,
|
||||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||||
imlib_context_set_color_modifier(NULL);
|
imlib_context_set_color_modifier(NULL);
|
||||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||||
imlib_context_set_anti_alias(1);
|
imlib_context_set_anti_alias(__evas_anti_alias);
|
||||||
for(l = drawable_list; l; l = l->next)
|
for(l = drawable_list; l; l = l->next)
|
||||||
{
|
{
|
||||||
Evas_Imlib_Drawable *dr;
|
Evas_Imlib_Drawable *dr;
|
||||||
|
@ -137,7 +138,7 @@ __evas_imlib_image_set_borders(Evas_Imlib_Image *im, int left, int right,
|
||||||
void
|
void
|
||||||
__evas_imlib_image_set_smooth_scaling(int on)
|
__evas_imlib_image_set_smooth_scaling(int on)
|
||||||
{
|
{
|
||||||
imlib_context_set_anti_alias((char)on);
|
__evas_anti_alias = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -347,7 +348,7 @@ void __evas_imlib_rectangle_draw(Display *disp, Window win,
|
||||||
imlib_context_set_operation(IMLIB_OP_COPY);
|
imlib_context_set_operation(IMLIB_OP_COPY);
|
||||||
imlib_context_set_color_modifier(NULL);
|
imlib_context_set_color_modifier(NULL);
|
||||||
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
|
||||||
imlib_context_set_anti_alias(1);
|
imlib_context_set_anti_alias(__evas_anti_alias);
|
||||||
for(l = drawable_list; l; l = l->next)
|
for(l = drawable_list; l; l = l->next)
|
||||||
{
|
{
|
||||||
Evas_Imlib_Drawable *dr;
|
Evas_Imlib_Drawable *dr;
|
||||||
|
|
|
@ -113,7 +113,7 @@ evas_list_remove(Evas_List list, void *data)
|
||||||
if (l->prev)
|
if (l->prev)
|
||||||
{
|
{
|
||||||
l->prev->next = l->next;
|
l->prev->next = l->next;
|
||||||
return_l = l->prev;
|
return_l = list;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return_l = l->next;
|
return_l = l->next;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* create and destroy */
|
|
||||||
Evas
|
Evas
|
||||||
evas_new(void)
|
evas_new(void)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +15,7 @@ evas_new(void)
|
||||||
e->current.viewport.y = 0.0;
|
e->current.viewport.y = 0.0;
|
||||||
e->current.viewport.w = 0.0;
|
e->current.viewport.w = 0.0;
|
||||||
e->current.viewport.h = 0.0;
|
e->current.viewport.h = 0.0;
|
||||||
e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE;
|
e->current.render_method = RENDER_METHOD_3D_HARDWARE;
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* deleting objects */
|
|
||||||
void
|
void
|
||||||
evas_del_object(Evas e, Evas_Object o)
|
_evas_real_del_object(Evas e, Evas_Object o)
|
||||||
{
|
{
|
||||||
Evas_List l;
|
Evas_List l;
|
||||||
|
|
||||||
|
@ -18,75 +17,101 @@ evas_del_object(Evas e, Evas_Object o)
|
||||||
if (layer->layer == o->current.layer)
|
if (layer->layer == o->current.layer)
|
||||||
{
|
{
|
||||||
layer->objects = evas_list_remove(layer->objects, o);
|
layer->objects = evas_list_remove(layer->objects, o);
|
||||||
e->object_renderer_data_free(e, o);
|
o->object_renderer_data_free(e, o);
|
||||||
o->object_free(o);
|
o->object_free(o);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* adding objects */
|
/* deleting objects */
|
||||||
|
void
|
||||||
Evas_Object
|
evas_del_object(Evas e, Evas_Object o)
|
||||||
evas_add_evas(Evas e, Evas evas)
|
|
||||||
{
|
{
|
||||||
|
o->delete_me = 1;
|
||||||
|
evas_hide(e, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* layer stacking for object */
|
/* layer stacking for object */
|
||||||
void
|
void
|
||||||
evas_set_layer(Evas e, Evas_Object o, int l)
|
evas_set_layer(Evas e, Evas_Object o, int l)
|
||||||
{
|
{
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_set_layer_store(Evas e, int l, int store)
|
evas_set_layer_store(Evas e, int l, int store)
|
||||||
{
|
{
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stacking within a layer */
|
/* stacking within a layer */
|
||||||
void
|
void
|
||||||
evas_raise(Evas e, Evas_Object o)
|
evas_raise(Evas e, Evas_Object o)
|
||||||
{
|
{
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_lower(Evas e, Evas_Object o)
|
evas_lower(Evas e, Evas_Object o)
|
||||||
{
|
{
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_stack_above(Evas e, Evas_Object o, int above)
|
evas_stack_above(Evas e, Evas_Object o, int above)
|
||||||
{
|
{
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_stack_below(Evas e, Evas_Object o, int above)
|
evas_stack_below(Evas e, Evas_Object o, int above)
|
||||||
{
|
{
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* object geoemtry */
|
/* object geoemtry */
|
||||||
void
|
void
|
||||||
evas_move(Evas e, Evas_Object o, double x, double y)
|
evas_move(Evas e, Evas_Object o, double x, double y)
|
||||||
{
|
{
|
||||||
|
o->current.x = x;
|
||||||
|
o->current.y = y;
|
||||||
|
o->changed = 1;
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_resize(Evas e, Evas_Object o, double w, double h)
|
evas_resize(Evas e, Evas_Object o, double w, double h)
|
||||||
{
|
{
|
||||||
|
o->current.w = w;
|
||||||
|
o->current.h = h;
|
||||||
|
o->changed = 1;
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_get_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h)
|
evas_get_geometry(Evas e, Evas_Object o, double *x, double *y, double *w, double *h)
|
||||||
{
|
{
|
||||||
|
if (x) *x = o->current.x;
|
||||||
|
if (y) *y = o->current.y;
|
||||||
|
if (w) *w = o->current.w;
|
||||||
|
if (h) *h = o->current.h;
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* object visibility */
|
/* object visibility */
|
||||||
void
|
void
|
||||||
evas_show(Evas e, Evas_Object o)
|
evas_show(Evas e, Evas_Object o)
|
||||||
{
|
{
|
||||||
|
o->current.visible = 1;
|
||||||
|
o->changed = 1;
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_hide(Evas e, Evas_Object o)
|
evas_hide(Evas e, Evas_Object o)
|
||||||
{
|
{
|
||||||
|
o->current.visible = 0;
|
||||||
|
o->changed = 1;
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +1,509 @@
|
||||||
#include "Evas.h"
|
#include "Evas.h"
|
||||||
|
#include "evas_gl_routines.h"
|
||||||
|
#include "evas_imlib_routines.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
_evas_object_get_current_translated_coords(Evas e, Evas_Object o,
|
||||||
|
int *x, int *y, int *w, int *h)
|
||||||
|
{
|
||||||
|
*x = (int)
|
||||||
|
(((o->current.x - e->current.viewport.x) *
|
||||||
|
(double)e->current.drawable_width) /
|
||||||
|
e->current.viewport.w);
|
||||||
|
*y = (int)
|
||||||
|
(((o->current.y - e->current.viewport.y) *
|
||||||
|
(double)e->current.drawable_height) /
|
||||||
|
e->current.viewport.h);
|
||||||
|
*w = (int)
|
||||||
|
((o->current.w * (double)e->current.drawable_width) /
|
||||||
|
e->current.viewport.w);
|
||||||
|
*h = (int)
|
||||||
|
((o->current.h * (double)e->current.drawable_height) /
|
||||||
|
e->current.viewport.h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_evas_object_get_previous_translated_coords(Evas e, Evas_Object o,
|
||||||
|
int *x, int *y, int *w, int *h)
|
||||||
|
{
|
||||||
|
*x = (int)
|
||||||
|
(((o->previous.x - e->previous.viewport.x) *
|
||||||
|
(double)e->previous.drawable_width) /
|
||||||
|
e->previous.viewport.w);
|
||||||
|
*y = (int)
|
||||||
|
(((o->previous.y - e->previous.viewport.y) *
|
||||||
|
(double)e->previous.drawable_height) /
|
||||||
|
e->previous.viewport.h);
|
||||||
|
*w = (int)
|
||||||
|
((o->previous.w * (double)e->previous.drawable_width) /
|
||||||
|
e->previous.viewport.w);
|
||||||
|
*h = (int)
|
||||||
|
((o->previous.h * (double)e->previous.drawable_height) /
|
||||||
|
e->previous.viewport.h);
|
||||||
|
}
|
||||||
|
|
||||||
/* for exposes or forced redraws (relative to output drawable) */
|
/* for exposes or forced redraws (relative to output drawable) */
|
||||||
void
|
void
|
||||||
evas_update_rect(Evas e, int x, int y, int w, int h)
|
evas_update_rect(Evas e, int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
Evas_Rectangle r;
|
e->updates = imlib_update_append_rect(e->updates, x, y, w, h);
|
||||||
|
|
||||||
r = malloc(sizeof(struct _Evas_Rectangle));
|
|
||||||
r->x = x;
|
|
||||||
r->y = y;
|
|
||||||
r->w = w;
|
|
||||||
r->h = h;
|
|
||||||
e->updates = evas_list_prepend(e->updates, r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
switch (e->current.render_method)
|
||||||
|
{
|
||||||
|
case RENDER_METHOD_ALPHA_SOFTWARE:
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_BASIC_HARDWARE:
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_3D_HARDWARE:
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* drawing */
|
/* drawing */
|
||||||
void
|
void
|
||||||
evas_render(Evas e)
|
evas_render(Evas e)
|
||||||
{
|
{
|
||||||
|
Evas_List delete_objects;
|
||||||
|
Evas_List l, ll;
|
||||||
|
|
||||||
|
if ((!e->changed) || (!e->current.display) || (!e->current.drawable))
|
||||||
|
return;
|
||||||
|
e->changed = 0;
|
||||||
|
if ((e->current.viewport.x != e->previous.viewport.x) ||
|
||||||
|
(e->current.viewport.y != e->previous.viewport.y) ||
|
||||||
|
(e->current.viewport.w != e->previous.viewport.w) ||
|
||||||
|
(e->current.viewport.h != e->previous.viewport.h))
|
||||||
|
evas_update_rect(e,
|
||||||
|
0, 0,
|
||||||
|
e->current.drawable_width,
|
||||||
|
e->current.drawable_height);
|
||||||
|
|
||||||
|
delete_objects = 0;
|
||||||
|
/* go thru layers & objects and add updates */
|
||||||
|
for (l = e->layers; l; l = l->next)
|
||||||
|
{
|
||||||
|
Evas_Layer layer;
|
||||||
|
|
||||||
|
layer = l->data;
|
||||||
|
for (ll = layer->objects; ll; ll = ll->next)
|
||||||
|
{
|
||||||
|
Evas_Object_Any o;
|
||||||
|
int real_change;
|
||||||
|
|
||||||
|
real_change = 0;
|
||||||
|
o = ll->data;
|
||||||
|
if (o->delete_me)
|
||||||
|
delete_objects = evas_list_append(delete_objects, o);
|
||||||
|
if (o->changed)
|
||||||
|
{
|
||||||
|
o->changed = 0;
|
||||||
|
if ((o->current.visible != o->previous.visible) ||
|
||||||
|
((o->current.visible) &&
|
||||||
|
((o->current.x != o->previous.x) ||
|
||||||
|
(o->current.y != o->previous.y) ||
|
||||||
|
(o->current.w != o->previous.w) ||
|
||||||
|
(o->current.h != o->previous.h) ||
|
||||||
|
(o->current.zoomscale != o->previous.zoomscale) ||
|
||||||
|
(o->current.layer != o->previous.layer)))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
o->previous = o->current;
|
||||||
|
real_change = 1;
|
||||||
|
}
|
||||||
|
if (o->current.visible)
|
||||||
|
{
|
||||||
|
switch (o->type)
|
||||||
|
{
|
||||||
|
case OBJECT_IMAGE:
|
||||||
|
{
|
||||||
|
Evas_Object_Image oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
if (((oo->current.file) && (!oo->previous.file)) ||
|
||||||
|
((!oo->current.file) && (oo->previous.file)) ||
|
||||||
|
(oo->current.new_data) ||
|
||||||
|
(oo->current.scale != oo->previous.scale) ||
|
||||||
|
(oo->current.fill.x != oo->previous.fill.x) ||
|
||||||
|
(oo->current.fill.y != oo->previous.fill.y) ||
|
||||||
|
(oo->current.fill.w != oo->previous.fill.w) ||
|
||||||
|
(oo->current.fill.h != oo->previous.fill.h)
|
||||||
|
)
|
||||||
|
real_change = 1;
|
||||||
|
oo->previous = oo->current;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_TEXT:
|
||||||
|
{
|
||||||
|
Evas_Object_Text oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
if (1)
|
||||||
|
real_change = 1;
|
||||||
|
oo->previous = oo->current;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_RECTANGLE:
|
||||||
|
{
|
||||||
|
Evas_Object_Rectangle oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
if (1)
|
||||||
|
real_change = 1;
|
||||||
|
oo->previous = oo->current;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_LINE:
|
||||||
|
{
|
||||||
|
Evas_Object_Line oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
if (1)
|
||||||
|
real_change = 1;
|
||||||
|
oo->previous = oo->current;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_GRADIENT_BOX:
|
||||||
|
{
|
||||||
|
Evas_Object_Gradient_Box oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
if (1)
|
||||||
|
real_change = 1;
|
||||||
|
oo->previous = oo->current;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_BITS:
|
||||||
|
{
|
||||||
|
Evas_Object_Bits oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
if (1)
|
||||||
|
real_change = 1;
|
||||||
|
oo->previous = oo->current;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (real_change)
|
||||||
|
{
|
||||||
|
int x, y, w, h;
|
||||||
|
|
||||||
|
_evas_object_get_previous_translated_coords(e, o,
|
||||||
|
&x, &y,
|
||||||
|
&w, &h);
|
||||||
|
evas_update_rect(e, x, y, w, h);
|
||||||
|
_evas_object_get_current_translated_coords(e, o,
|
||||||
|
&x, &y,
|
||||||
|
&w, &h);
|
||||||
|
evas_update_rect(e, x, y, w, h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (delete_objects)
|
||||||
|
{
|
||||||
|
for (l = delete_objects; l; l = l->next)
|
||||||
|
_evas_real_del_object(e, l->data);
|
||||||
|
evas_list_free(delete_objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* take all the update rects we've produced and render them */
|
||||||
|
switch (e->current.render_method)
|
||||||
|
{
|
||||||
|
case RENDER_METHOD_ALPHA_SOFTWARE:
|
||||||
|
{
|
||||||
|
Imlib_Updates up;
|
||||||
|
|
||||||
|
__evas_imlib_init(e->current.display, e->current.screen);
|
||||||
|
if (e->updates)
|
||||||
|
{
|
||||||
|
up = imlib_updates_merge_for_rendering(e->updates,
|
||||||
|
e->current.drawable_width,
|
||||||
|
e->current.drawable_height);
|
||||||
|
e->updates = NULL;
|
||||||
|
if (up)
|
||||||
|
{
|
||||||
|
Imlib_Updates u;
|
||||||
|
|
||||||
|
u = up;
|
||||||
|
while (u)
|
||||||
|
{
|
||||||
|
int x, y, w, h;
|
||||||
|
|
||||||
|
imlib_updates_get_coordinates(u, &x, &y, &w, &h);
|
||||||
|
__evas_imlib_draw_add_rect(e->current.display,
|
||||||
|
e->current.drawable,
|
||||||
|
x, y, w, h);
|
||||||
|
u = imlib_updates_get_next(u);
|
||||||
|
}
|
||||||
|
imlib_updates_free(up);
|
||||||
|
/* draw all objects now */
|
||||||
|
for (l = e->layers; l; l = l->next)
|
||||||
|
{
|
||||||
|
Evas_Layer layer;
|
||||||
|
|
||||||
|
layer = l->data;
|
||||||
|
for (ll = layer->objects; ll; ll = ll->next)
|
||||||
|
{
|
||||||
|
Evas_Object_Any o;
|
||||||
|
|
||||||
|
o = ll->data;
|
||||||
|
if (o->current.visible)
|
||||||
|
{
|
||||||
|
int x, y, w, h;
|
||||||
|
_evas_object_get_current_translated_coords(e, o,
|
||||||
|
&x, &y,
|
||||||
|
&w, &h);
|
||||||
|
switch (o->type)
|
||||||
|
{
|
||||||
|
case OBJECT_IMAGE:
|
||||||
|
{
|
||||||
|
Evas_Object_Image oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
{
|
||||||
|
Evas_Imlib_Image *im;
|
||||||
|
|
||||||
|
im = __evas_imlib_image_new_from_file(e->current.display, oo->current.file);
|
||||||
|
if (im)
|
||||||
|
{
|
||||||
|
__evas_imlib_image_draw(im,
|
||||||
|
e->current.display,
|
||||||
|
e->current.drawable,
|
||||||
|
e->current.drawable_width,
|
||||||
|
e->current.drawable_height,
|
||||||
|
0, 0,
|
||||||
|
__evas_gl_image_get_width(im),
|
||||||
|
__evas_gl_image_get_height(im),
|
||||||
|
x, y, w, h);
|
||||||
|
__evas_imlib_image_free(im);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_TEXT:
|
||||||
|
{
|
||||||
|
Evas_Object_Text oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_RECTANGLE:
|
||||||
|
{
|
||||||
|
Evas_Object_Rectangle oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_LINE:
|
||||||
|
{
|
||||||
|
Evas_Object_Line oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_GRADIENT_BOX:
|
||||||
|
{
|
||||||
|
Evas_Object_Gradient_Box oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_BITS:
|
||||||
|
{
|
||||||
|
Evas_Object_Bits oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
__evas_imlib_flush_draw(e->current.display,
|
||||||
|
e->current.drawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_BASIC_HARDWARE:
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_3D_HARDWARE:
|
||||||
|
{
|
||||||
|
Imlib_Updates up;
|
||||||
|
|
||||||
|
__evas_gl_init(e->current.display, e->current.screen);
|
||||||
|
if (e->updates)
|
||||||
|
{
|
||||||
|
up = imlib_updates_merge_for_rendering(e->updates,
|
||||||
|
e->current.drawable_width,
|
||||||
|
e->current.drawable_height);
|
||||||
|
e->updates = NULL;
|
||||||
|
if (up)
|
||||||
|
{
|
||||||
|
Imlib_Updates u;
|
||||||
|
|
||||||
|
u = up;
|
||||||
|
while (u)
|
||||||
|
{
|
||||||
|
int x, y, w, h;
|
||||||
|
|
||||||
|
imlib_updates_get_coordinates(u, &x, &y, &w, &h);
|
||||||
|
__evas_gl_draw_add_rect(e->current.display,
|
||||||
|
e->current.drawable,
|
||||||
|
x, y, w, h);
|
||||||
|
u = imlib_updates_get_next(u);
|
||||||
|
}
|
||||||
|
imlib_updates_free(up);
|
||||||
|
/* draw all objects now */
|
||||||
|
for (l = e->layers; l; l = l->next)
|
||||||
|
{
|
||||||
|
Evas_Layer layer;
|
||||||
|
|
||||||
|
layer = l->data;
|
||||||
|
for (ll = layer->objects; ll; ll = ll->next)
|
||||||
|
{
|
||||||
|
Evas_Object_Any o;
|
||||||
|
|
||||||
|
o = ll->data;
|
||||||
|
if (o->current.visible)
|
||||||
|
{
|
||||||
|
int x, y, w, h;
|
||||||
|
_evas_object_get_current_translated_coords(e, o,
|
||||||
|
&x, &y,
|
||||||
|
&w, &h);
|
||||||
|
switch (o->type)
|
||||||
|
{
|
||||||
|
case OBJECT_IMAGE:
|
||||||
|
{
|
||||||
|
Evas_Object_Image oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
{
|
||||||
|
Evas_GL_Image *im;
|
||||||
|
|
||||||
|
im = __evas_gl_image_new_from_file(e->current.display, oo->current.file);
|
||||||
|
if (im)
|
||||||
|
{
|
||||||
|
__evas_gl_image_draw(im,
|
||||||
|
e->current.display,
|
||||||
|
e->current.drawable,
|
||||||
|
e->current.drawable_width,
|
||||||
|
e->current.drawable_height,
|
||||||
|
0, 0,
|
||||||
|
__evas_gl_image_get_width(im),
|
||||||
|
__evas_gl_image_get_height(im),
|
||||||
|
x, y, w, h);
|
||||||
|
__evas_gl_image_free(im);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_TEXT:
|
||||||
|
{
|
||||||
|
Evas_Object_Text oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_RECTANGLE:
|
||||||
|
{
|
||||||
|
Evas_Object_Rectangle oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_LINE:
|
||||||
|
{
|
||||||
|
Evas_Object_Line oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_GRADIENT_BOX:
|
||||||
|
{
|
||||||
|
Evas_Object_Gradient_Box oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case OBJECT_BITS:
|
||||||
|
{
|
||||||
|
Evas_Object_Bits oo;
|
||||||
|
|
||||||
|
oo = o;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
__evas_gl_flush_draw(e->current.display,
|
||||||
|
e->current.drawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
e->previous = e->current;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* query for settings to use */
|
/* query for settings to use */
|
||||||
Visual *
|
Visual *
|
||||||
evas_get_optimal_visual(Evas e, Display *disp)
|
evas_get_optimal_visual(Evas e, Display *disp)
|
||||||
{
|
{
|
||||||
|
switch (e->current.render_method)
|
||||||
|
{
|
||||||
|
case RENDER_METHOD_ALPHA_SOFTWARE:
|
||||||
|
return __evas_imlib_get_visual(disp, e->current.screen);
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_BASIC_HARDWARE:
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_3D_HARDWARE:
|
||||||
|
return __evas_gl_get_visual(disp, e->current.screen);
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Colormap
|
Colormap
|
||||||
evas_get_optimal_colormap(Evas e, Display *disp)
|
evas_get_optimal_colormap(Evas e, Display *disp)
|
||||||
{
|
{
|
||||||
|
switch (e->current.render_method)
|
||||||
|
{
|
||||||
|
case RENDER_METHOD_ALPHA_SOFTWARE:
|
||||||
|
return __evas_imlib_get_colormap(disp, e->current.screen);
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_BASIC_HARDWARE:
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_3D_HARDWARE:
|
||||||
|
return __evas_gl_get_colormap(disp, e->current.screen);
|
||||||
|
break;
|
||||||
|
case RENDER_METHOD_ALPHA_HARDWARE:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the output settings */
|
/* the output settings */
|
||||||
|
@ -43,6 +514,15 @@ evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c)
|
||||||
e->current.drawable = d;
|
e->current.drawable = d;
|
||||||
e->current.visual = v;
|
e->current.visual = v;
|
||||||
e->current.colormap = c;
|
e->current.colormap = c;
|
||||||
|
e->changed = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evas_set_output_size(Evas e, int w, int h)
|
||||||
|
{
|
||||||
|
e->current.drawable_width = w;
|
||||||
|
e->current.drawable_height = h;
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -52,10 +532,12 @@ evas_set_output_viewport(Evas e, double x, double y, double w, double h)
|
||||||
e->current.viewport.y = y;
|
e->current.viewport.y = y;
|
||||||
e->current.viewport.w = w;
|
e->current.viewport.w = w;
|
||||||
e->current.viewport.h = h;
|
e->current.viewport.h = h;
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_set_output_method(Evas e, Evas_Render_Method method)
|
evas_set_output_method(Evas e, Evas_Render_Method method)
|
||||||
{
|
{
|
||||||
e->current.render_method = method;
|
e->current.render_method = method;
|
||||||
|
e->changed = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,203 @@
|
||||||
#include <Evas.h>
|
#include <Evas.h>
|
||||||
#include "../src/evas_gl_routines.h"
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
Display *d;
|
||||||
|
Visual *vis;
|
||||||
|
Colormap cmap;
|
||||||
|
Window win;
|
||||||
|
int win_w, win_h;
|
||||||
|
int i, a;
|
||||||
|
Evas e;
|
||||||
|
Evas_Object o[32];
|
||||||
|
|
||||||
|
win_w = 640; win_h = 480;
|
||||||
|
if (argc == 4)
|
||||||
|
{
|
||||||
|
win_w = atoi(argv[1]);
|
||||||
|
win_h = atoi(argv[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
e = evas_new();
|
||||||
|
if (!strcmp(argv[3], "software"))
|
||||||
|
evas_set_output_method(e, RENDER_METHOD_ALPHA_SOFTWARE);
|
||||||
|
else
|
||||||
|
evas_set_output_method(e, RENDER_METHOD_3D_HARDWARE);
|
||||||
|
|
||||||
|
d = XOpenDisplay(NULL);
|
||||||
|
vis = evas_get_optimal_visual(e, d);
|
||||||
|
cmap = evas_get_optimal_colormap(e, d);
|
||||||
|
|
||||||
|
{
|
||||||
|
XSetWindowAttributes att;
|
||||||
|
|
||||||
|
att.colormap = cmap;
|
||||||
|
att.border_pixel = 0;
|
||||||
|
att.event_mask = 0;
|
||||||
|
|
||||||
|
win = XCreateWindow(d,
|
||||||
|
RootWindow(d, DefaultScreen(d)),
|
||||||
|
0, 0, win_w, win_h, 0,
|
||||||
|
imlib_get_visual_depth(d, vis),
|
||||||
|
InputOutput,
|
||||||
|
vis,
|
||||||
|
CWColormap | CWBorderPixel | CWEventMask,
|
||||||
|
&att);
|
||||||
|
XMapWindow(d, win);
|
||||||
|
XSync(d, False);
|
||||||
|
}
|
||||||
|
evas_set_output(e, d, win, vis, cmap);
|
||||||
|
evas_set_output_size(e, win_w, win_h);
|
||||||
|
evas_set_output_viewport(e, 0, 0, win_w, win_h);
|
||||||
|
|
||||||
|
o[0] = evas_add_image_from_file(e, "img/sky001.png");
|
||||||
|
evas_show(e, o[0]);
|
||||||
|
for (i = 1 ; i < 32; i++)
|
||||||
|
{
|
||||||
|
o[i] = evas_add_image_from_file(e, "img/mush.png");
|
||||||
|
evas_show(e, o[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
evas_move(e, o[0], 0, 0);
|
||||||
|
evas_resize(e, o[0], win_w, win_h);
|
||||||
|
a = 0;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
double x, y;
|
||||||
|
|
||||||
|
for (i = 1; i < 32; i++)
|
||||||
|
{
|
||||||
|
int j, k;
|
||||||
|
|
||||||
|
j = (i * 50) + i;
|
||||||
|
k = (i * -60) - (i * 2);
|
||||||
|
x = (win_w + (cos((double)(a + j) * 2 * 3.141592654 / 1000) * (win_h - 100))) / 2;
|
||||||
|
y = (win_h + (sin((double)(a + k) * 2 * 3.141592654 / 1000) * (win_h - 100))) / 2;
|
||||||
|
evas_move(e, o[i], x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
evas_render(e);
|
||||||
|
a++;
|
||||||
|
if (a > 1000) a = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#include "../src/evas_gl_routines.h"
|
||||||
|
|
||||||
double get_time(void);
|
double get_time(void);
|
||||||
|
|
||||||
double
|
double
|
||||||
|
@ -52,7 +248,7 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
if (__evas_gl_capable(d))
|
if (__evas_gl_capable(d))
|
||||||
{
|
{
|
||||||
int a = 0;
|
int a = 0, aa = 0;
|
||||||
double t1, t2;
|
double t1, t2;
|
||||||
Evas_GL_Image *i[4], *bg, *l, *sel, *ic, *tm;
|
Evas_GL_Image *i[4], *bg, *l, *sel, *ic, *tm;
|
||||||
Evas_GL_Font *fn[4];
|
Evas_GL_Font *fn[4];
|
||||||
|
@ -213,6 +409,8 @@ main(int argc, char **argv)
|
||||||
pixels = (((((double)k + 1) * (double)win_w * (double)win_h) + ((double)__evas_gl_image_get_width(l) * (double)__evas_gl_image_get_height(l))) * (double)a);
|
pixels = (((((double)k + 1) * (double)win_w * (double)win_h) + ((double)__evas_gl_image_get_width(l) * (double)__evas_gl_image_get_height(l))) * (double)a);
|
||||||
printf("%3.0f pixels in %3.3f seconds\n", pixels, tim);
|
printf("%3.0f pixels in %3.3f seconds\n", pixels, tim);
|
||||||
printf("..... %4.1f Mpixels/second\n", pixels / (tim * 1000000));
|
printf("..... %4.1f Mpixels/second\n", pixels / (tim * 1000000));
|
||||||
|
__evas_gl_image_set_smooth_scaling(aa & 0x1);
|
||||||
|
aa++;
|
||||||
a = 0;
|
a = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,3 +423,5 @@ main(int argc, char **argv)
|
||||||
argc = 0;
|
argc = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue