add some code ro render routines to hanbdle render extension... not much yet

SVN revision: 3654
This commit is contained in:
Carsten Haitzler 2000-10-19 22:15:16 +00:00
parent b4db700396
commit 261a868816
3 changed files with 60 additions and 3 deletions

View File

@ -27,13 +27,49 @@ __evas_render_image_cache_flush(Display *disp)
Evas_Render_Image *
__evas_render_image_new_from_file(Display *disp, char *file)
{
return NULL;
{
Evas_Render_Image *im;
Imlib_Image i;
XRenderPictFormat fmt, *format, *format_color;
Visual *visual;
int screen;
/* need to look for image i local cache */
/* not found - load */
i = imlib_load_image(file);
if (!i) return NULL;
imlib_context_set_image(i);
im = malloc(sizeof(Evas_Render_Image));
memset(im, 0, sizeof(Evas_Render_Image));
/* this stuff needs to become a context lookup for the display pointer */
visual = DefaultVisual (disp, screen);
format = XRenderFindVisualFormat (disp, visual);
fmt.depth = 32;
fmt.type = PictTypeDirect;
format_color = XRenderFindFormat(disp, PictFormatType | PictFormatDepth, &fmt, 0);
im->file = strdup(file);
im->references = 1;
im->disp = disp;
im->has_alpha = imlib_image_has_alpha();
im->w = imlib_image_get_width();
im->h = imlib_image_get_height();
im->pmap = XCreatePixmap (disp, RootWindow (disp, screen), im->w, im->h, fmt.depth);
im->pic = XRenderCreatePicture (disp, im->pmap, &fmt, 0, 0);
/* need to xshmputimage to the pixmap */
/* need to add to local cache list */
return im;
}
void
__evas_render_image_free(Evas_Render_Image *im)
{
im->references--;
if (im->references <= 0)
{
/* need to flush cache */
}
}
void

View File

@ -15,6 +15,8 @@
#include "Evas_private.h"
#include "Evas.h"
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>
#include <Imlib2.h>
#ifdef HAVE_RENDER
@ -28,10 +30,25 @@
((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
#endif
typedef void Evas_Render_Image;
typedef struct _evas_render_image Evas_Render_Image;
typedef void Evas_Render_Font;
typedef void Evas_Render_Graident;
struct _evas_render_image
{
char *file;
int references;
int w, h;
Display *disp;
Picture pic;
Pixmap pmap;
int has_alpha;
struct
{
int l, r, t, b;
} border;
};
typedef struct _evas_render_drawable Evas_Render_Drawable;
typedef struct _evas_render_update Evas_Render_Update;
@ -44,6 +61,8 @@ struct _evas_render_drawable
struct _evas_render_update
{
Picture pic;
Pixmap pmap;
int x, y, w, h;
};

View File

@ -112,6 +112,8 @@ main(int argc, char **argv)
i++;
if (!strcmp(argv[i], "x11"))
evas_set_output_method(e, RENDER_METHOD_BASIC_HARDWARE);
else if (!strcmp(argv[i], "alpha"))
evas_set_output_method(e, RENDER_METHOD_ALPHA_HARDWARE);
else if (!strcmp(argv[i], "soft"))
evas_set_output_method(e, RENDER_METHOD_ALPHA_SOFTWARE);
else if (!strcmp(argv[i], "hard"))