From ff01c864a473126f9885b9911f36e141ae112b09 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 15 Sep 2000 15:04:48 +0000 Subject: [PATCH] allow color allocation policy to be set in evas SVN revision: 3473 --- legacy/evas/src/Evas.h | 2 ++ legacy/evas/src/evas_gl_routines.c | 4 ++-- legacy/evas/src/evas_gl_routines.h | 2 +- legacy/evas/src/evas_image_routines.c | 4 ++-- legacy/evas/src/evas_image_routines.h | 2 +- legacy/evas/src/evas_imlib_routines.c | 4 ++-- legacy/evas/src/evas_imlib_routines.h | 2 +- legacy/evas/src/evas_misc.c | 3 ++- legacy/evas/src/evas_render.c | 11 +++++++++-- 9 files changed, 22 insertions(+), 12 deletions(-) diff --git a/legacy/evas/src/Evas.h b/legacy/evas/src/Evas.h index e320acda77..5e0f3be060 100644 --- a/legacy/evas/src/Evas.h +++ b/legacy/evas/src/Evas.h @@ -62,6 +62,7 @@ struct _Evas Visual *visual; Colormap colormap; int screen; + int colors; Imlib_Image image; int drawable_width, drawable_height; @@ -252,6 +253,7 @@ void evas_get_viewport(Evas e, double *x, double *y, double *w, double *h); /* the output settings */ void evas_set_output(Evas e, Display *disp, Drawable d, Visual *v, Colormap c); void evas_set_output_image(Evas e, Imlib_Image image); +void evas_set_output_colors(Evas e, int colors); 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); diff --git a/legacy/evas/src/evas_gl_routines.c b/legacy/evas/src/evas_gl_routines.c index 4bf4c0a349..453941fcf6 100644 --- a/legacy/evas/src/evas_gl_routines.c +++ b/legacy/evas/src/evas_gl_routines.c @@ -2176,7 +2176,7 @@ __evas_gl_capable(Display *disp) if (__evas_gl_cx) return 1; if (glXQueryExtension(disp, &eb, &evb)) { - __evas_gl_init(disp, 0); + __evas_gl_init(disp, 0, 256); if (__evas_gl_cx) return 1; return 0; } @@ -2219,7 +2219,7 @@ __evas_gl_get_colormap(Display *disp, int screen) } void -__evas_gl_init(Display *disp, int screen) +__evas_gl_init(Display *disp, int screen, int colors) { if (__evas_gl_cx) return; diff --git a/legacy/evas/src/evas_gl_routines.h b/legacy/evas/src/evas_gl_routines.h index 621408cec7..4b40e31fc3 100644 --- a/legacy/evas/src/evas_gl_routines.h +++ b/legacy/evas/src/evas_gl_routines.h @@ -196,7 +196,7 @@ void __evas_gl_gradient_draw(Evas_GL_Graident *gr, Display *disp, I /***********/ /* drawing */ /***********/ -void __evas_gl_init(Display *disp, int screen); +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); void __evas_gl_sync(Display *disp); diff --git a/legacy/evas/src/evas_image_routines.c b/legacy/evas/src/evas_image_routines.c index 068b87b969..710c6e79d3 100644 --- a/legacy/evas/src/evas_image_routines.c +++ b/legacy/evas/src/evas_image_routines.c @@ -792,7 +792,7 @@ __evas_image_get_colormap(Display *disp, int screen) } void -__evas_image_init(Display *disp, int screen) +__evas_image_init(Display *disp, int screen, int colors) { static int initted = 0; @@ -800,9 +800,9 @@ __evas_image_init(Display *disp, int screen) { imlib_set_font_cache_size(1024 * 1024); imlib_set_cache_size(8 * 1024 * 1024); - imlib_set_color_usage(128); initted = 1; } + imlib_set_color_usage(colors); } void diff --git a/legacy/evas/src/evas_image_routines.h b/legacy/evas/src/evas_image_routines.h index d68dac871c..2218f529c9 100644 --- a/legacy/evas/src/evas_image_routines.h +++ b/legacy/evas/src/evas_image_routines.h @@ -100,7 +100,7 @@ void __evas_image_gradient_draw(Evas_Image_Graident *gr, Display /***********/ /* drawing */ /***********/ -void __evas_image_init(Display *disp, int screen); +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); void __evas_image_sync(Display *disp); diff --git a/legacy/evas/src/evas_imlib_routines.c b/legacy/evas/src/evas_imlib_routines.c index dc96d31c4f..96cf967a0c 100644 --- a/legacy/evas/src/evas_imlib_routines.c +++ b/legacy/evas/src/evas_imlib_routines.c @@ -715,7 +715,7 @@ __evas_imlib_get_colormap(Display *disp, int screen) } void -__evas_imlib_init(Display *disp, int screen) +__evas_imlib_init(Display *disp, int screen, int colors) { static int initted = 0; @@ -723,9 +723,9 @@ __evas_imlib_init(Display *disp, int screen) { imlib_set_font_cache_size(1024 * 1024); imlib_set_cache_size(8 * 1024 * 1024); - imlib_set_color_usage(128); initted = 1; } + imlib_set_color_usage(colors); } void diff --git a/legacy/evas/src/evas_imlib_routines.h b/legacy/evas/src/evas_imlib_routines.h index 8a5a790400..b0c0f8cf5d 100644 --- a/legacy/evas/src/evas_imlib_routines.h +++ b/legacy/evas/src/evas_imlib_routines.h @@ -100,7 +100,7 @@ void __evas_imlib_gradient_draw(Evas_Imlib_Graident *gr, Display /***********/ /* drawing */ /***********/ -void __evas_imlib_init(Display *disp, int screen); +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); void __evas_imlib_sync(Display *disp); diff --git a/legacy/evas/src/evas_misc.c b/legacy/evas/src/evas_misc.c index 11c77699e2..da9f30e772 100644 --- a/legacy/evas/src/evas_misc.c +++ b/legacy/evas/src/evas_misc.c @@ -18,7 +18,8 @@ evas_new(void) e->current.viewport.y = 0.0; e->current.viewport.w = 0.0; e->current.viewport.h = 0.0; - e->current.render_method = RENDER_METHOD_3D_HARDWARE; + e->current.render_method = RENDER_METHOD_ALPHA_SOFTWARE; + e->current.colors = 128; return e; } diff --git a/legacy/evas/src/evas_render.c b/legacy/evas/src/evas_render.c index b9dd6f00f9..b865661970 100644 --- a/legacy/evas/src/evas_render.c +++ b/legacy/evas/src/evas_render.c @@ -86,7 +86,7 @@ evas_render(Evas e) void (*func_image_draw) (void *im, Display *disp, Imlib_Image dstim, Window w, int win_w, int win_h, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int cr, int cg, int cb, int ca); void (*func_image_free) (void *im); void (*func_flush_draw) (Display *disp, Imlib_Image dstim, Window w); - void (*func_init) (Display *disp, int screen); + void (*func_init) (Display *disp, int screen, int colors); int (*func_image_get_width) (void *im); int (*func_image_get_height) (void *im); void * (*func_text_font_new) (Display *disp, char *font, int size); @@ -327,7 +327,7 @@ evas_render(Evas e) evas_list_free(delete_objects); } - func_init(e->current.display, e->current.screen); + func_init(e->current.display, e->current.screen, e->current.colors); if (e->updates) { up = imlib_updates_merge_for_rendering(e->updates, @@ -744,6 +744,13 @@ evas_set_output_image(Evas e, Imlib_Image image) e->changed = 1; } +void +evas_set_output_colors(Evas e, int colors) +{ + e->current.colors = colors; + e->changed = 1; +} + void evas_set_output_size(Evas e, int w, int h) {