ok - thats a litle better perfromance

SVN revision: 3506
This commit is contained in:
Carsten Haitzler 2000-09-17 18:16:53 +00:00
parent 240dc97f4c
commit 8641c36e33
2 changed files with 38 additions and 35 deletions

View File

@ -1,6 +1,6 @@
#include "evas_x11_routines.h" #include "evas_x11_routines.h"
static void __evas_imlib_image_cache_flush(Display *disp); static void __evas_x11_image_cache_flush(Display *disp);
static int __evas_anti_alias = 1; static int __evas_anti_alias = 1;
static Evas_List drawable_list = NULL; static Evas_List drawable_list = NULL;
@ -69,9 +69,10 @@ __evas_x11_image_draw(Evas_X11_Image *im,
{ {
Evas_List l; Evas_List l;
Imlib_Color_Modifier cm = NULL; Imlib_Color_Modifier cm = NULL;
Pixmap pmap = 0, mask = 0;
if (ca == 0) return; if (ca == 0) return;
/*
if ((cr != 255) || (cg != 255) || (cb != 255) || (ca != 255)) if ((cr != 255) || (cg != 255) || (cb != 255) || (ca != 255))
{ {
DATA8 r[256], g[256], b[256], a[256]; DATA8 r[256], g[256], b[256], a[256];
@ -90,23 +91,26 @@ __evas_x11_image_draw(Evas_X11_Image *im,
} }
else else
imlib_context_set_color_modifier(NULL); imlib_context_set_color_modifier(NULL);
*/
imlib_context_set_display(disp); imlib_context_set_display(disp);
imlib_context_set_visual(__evas_visual); imlib_context_set_visual(__evas_visual);
imlib_context_set_colormap(__evas_cmap); imlib_context_set_colormap(__evas_cmap);
imlib_context_set_drawable(w); imlib_context_set_drawable(w);
imlib_context_set_dither(1); imlib_context_set_dither_mask(__evas_anti_alias);
imlib_context_set_anti_alias(__evas_anti_alias);
imlib_context_set_blend(0); imlib_context_set_blend(0);
imlib_context_set_angle(0.0); imlib_context_set_angle(0.0);
imlib_context_set_operation(IMLIB_OP_COPY); imlib_context_set_operation(IMLIB_OP_COPY);
imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT); imlib_context_set_direction(IMLIB_TEXT_TO_RIGHT);
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_X11_Drawable *dr; Evas_X11_Drawable *dr;
dr = l->data; dr = l->data;
if (dr->depth <= 8)
imlib_context_set_dither(1);
else
imlib_context_set_dither(0);
if ((dr->win == w) && (dr->disp == disp)) if ((dr->win == w) && (dr->disp == disp))
{ {
Evas_List ll; Evas_List ll;
@ -121,34 +125,29 @@ __evas_x11_image_draw(Evas_X11_Image *im,
if (RECTS_INTERSECT(up->x, up->y, up->w, up->h, if (RECTS_INTERSECT(up->x, up->y, up->w, up->h,
dst_x, dst_y, dst_w, dst_h)) dst_x, dst_y, dst_w, dst_h))
{ {
Pixmap pmap = 0, mask = 0, s_pmap = 0, s_mask = 0; Imlib_Border bd;
int xx, yy, ww, hh, iw, ih;
if (!up->p) if (!up->p)
up->p = XCreatePixmap(disp, w, up->w, up->h, dr->depth); up->p = XCreatePixmap(disp, w, up->w, up->h, dr->depth);
imlib_context_set_image(im); imlib_context_set_image(im);
imlib_render_pixmaps_for_whole_image(&pmap, &mask); imlib_image_get_border(&bd);
/* if we need to scale...... */ /* if we haven't created a pixmap for thew image yet this */
/* /* round of updates */
if ((src_w != dst_w) || (src_h) != (dst_h))
{
if (mask)
{
}
if (s_pmap) XFreePixmap(disp, s_pmap); iw = imlib_image_get_width();
if (s_mask) XFreePixmap(disp, s_mask); ih = imlib_image_get_height();
} ww = (iw * dst_w) / src_w;
else hh = (ih * dst_h) / src_h;
*/ xx = (src_x * src_w) / dst_w;
{ yy = (src_y * src_h) / dst_h;
imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask,
ww, hh);
if (mask) if (mask)
{ {
/*
XSetStipple(disp, dr->gc, mask);
XSetTSOrigin(disp, dr->gc, dst_x - up->x, dst_y - up->y);
*/
XSetClipMask(disp, dr->gc, mask); XSetClipMask(disp, dr->gc, mask);
XSetClipOrigin(disp, dr->gc, dst_x - up->x, dst_y - up->y); XSetClipOrigin(disp, dr->gc, dst_x - up->x - src_x, dst_y - up->y - src_y);
} }
else else
{ {
@ -156,13 +155,14 @@ __evas_x11_image_draw(Evas_X11_Image *im,
} }
if (pmap) if (pmap)
XCopyArea(disp, pmap, up->p, dr->gc, XCopyArea(disp, pmap, up->p, dr->gc,
src_x, src_y, src_w, src_h, dst_x - up->x, dst_y - up->y); xx, yy,
dst_w, dst_h,
dst_x - up->x, dst_y - up->y);
}
}
}
} }
if (pmap) imlib_free_pixmap_and_mask(pmap); if (pmap) imlib_free_pixmap_and_mask(pmap);
}
}
}
}
if (cm) if (cm)
{ {
imlib_free_color_modifier(); imlib_free_color_modifier();
@ -620,6 +620,7 @@ __evas_x11_flush_draw(Display *disp, Imlib_Image dstim, Window win)
dr = l->data; dr = l->data;
XSetClipMask(disp, dr->gc, None);
if ((dr->win == win) && (dr->disp == disp)) if ((dr->win == win) && (dr->disp == disp))
{ {
Evas_List ll; Evas_List ll;

View File

@ -324,8 +324,10 @@ main(int argc, char **argv)
hh = ww; hh = ww;
evas_resize(e, o[i], ww, hh); evas_resize(e, o[i], ww, hh);
evas_set_image_fill(e, o[i], 0, 0, ww, hh); evas_set_image_fill(e, o[i], 0, 0, ww, hh);
/*
evas_set_color(e, o[i], 255, 255, 255, evas_set_color(e, o[i], 255, 255, 255,
(((1.0 + cos((double)(a + j) * 2 * 3 * 3.141592654 / 1000)) / 2) * 255)); (((1.0 + cos((double)(a + j) * 2 * 3 * 3.141592654 / 1000)) / 2) * 255));
*/
} }
} }
evas_set_angle(e, o_grad, (double)a * 360 / 1000); evas_set_angle(e, o_grad, (double)a * 360 / 1000);