mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-23 17:43:04 +00:00
make xrender optional
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@642 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -451,7 +451,9 @@ MwLLPixmap MwLLCreatePixmap(MwLL handle, unsigned char* data, int width, int hei
|
||||
r->data = malloc(sizeof(unsigned long) * width * height);
|
||||
r->handle = handle;
|
||||
|
||||
r->use_render = XRenderQueryExtension(handle->display, &evbase, &erbase) ? 1 : 0;
|
||||
#ifdef USE_XRENDER
|
||||
r->use_xrender = XRenderQueryExtension(handle->display, &evbase, &erbase) ? 1 : 0;
|
||||
#endif
|
||||
|
||||
r->image = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), r->depth, ZPixmap, 0, di, width, height, 32, width * 4);
|
||||
r->mask = XCreateImage(handle->display, DefaultVisual(handle->display, DefaultScreen(handle->display)), 1, ZPixmap, 0, dm, width, height, 32, width * 4);
|
||||
@@ -499,6 +501,7 @@ void MwLLDestroyPixmap(MwLLPixmap pixmap) {
|
||||
|
||||
void MwLLDrawPixmap(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
|
||||
if(rect->width == 0 || rect->height == 0) return;
|
||||
#ifdef USE_XRENDER
|
||||
if(pixmap->image != NULL && pixmap->use_render) {
|
||||
Pixmap px = XCreatePixmap(handle->display, handle->window, pixmap->width, pixmap->height, pixmap->depth);
|
||||
Pixmap mask = XCreatePixmap(handle->display, handle->window, rect->width, rect->height, 1);
|
||||
@@ -565,7 +568,9 @@ void MwLLDrawPixmap(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
|
||||
XFreePixmap(handle->display, mask);
|
||||
XFreePixmap(handle->display, px);
|
||||
XFreePixmap(handle->display, pxsrc);
|
||||
} else if(pixmap->image != NULL) {
|
||||
} else
|
||||
#endif
|
||||
if(pixmap->image != NULL) {
|
||||
XImage* dest;
|
||||
XImage* destmask;
|
||||
Pixmap mask = XCreatePixmap(handle->display, handle->window, rect->width, rect->height, 1);
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#ifdef USE_XRENDER
|
||||
#include <X11/extensions/Xrender.h>
|
||||
#endif
|
||||
|
||||
struct _MwLL {
|
||||
Display* display;
|
||||
@@ -58,7 +60,7 @@ struct _MwLLPixmap {
|
||||
int depth;
|
||||
unsigned char* data;
|
||||
MwLL handle;
|
||||
int use_render;
|
||||
int use_xrender;
|
||||
Display* display;
|
||||
XImage* image;
|
||||
XImage* mask;
|
||||
|
||||
Reference in New Issue
Block a user