import "instance"
-#if (defined(__unix__) || defined(__APPLE__)) && !defined(ECERE_MINIGLX)
+#if (defined(__unix__) || defined(__APPLE__)) && !defined(ECERE_MINIGLX) && !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
default:
#include <X11/Xlib.h>
#include <X11/Xutil.h>
+#if !defined(__EMSCRIPTEN__) && !defined(__pnacl__)
#include <X11/extensions/shape.h>
#include <X11/extensions/Xrender.h>
+#endif
#include <X11/extensions/XShm.h>
#include <sys/ipc.h>
#include <sys/shm.h>
bool opaqueText;
int xOffset;
bool writingText;
+ bool writingOutline;
ColorAlpha foreground, background;
bool opaque;
xDisplay.image = XShmCreateImage(xGlobalDisplay, xSystemVisual /*DefaultVisual(xGlobalDisplay, DefaultScreen(xGlobalDisplay))*/,
format->depth, ZPixmap, null, &xDisplay.shminfo, width, height);
}
+ else if(display.useSharedMemory && !xSharedMemory)
+ printf("%s", $"Error: Requested shared memory but shared memory pixmaps are not supported by X server.\n");
#endif
if(xDisplay.image)
{
xDisplay.bitmap.height = height;
xDisplay.bitmap.stride = xDisplay.image->bytes_per_line >> GetColorDepthShifts(display.pixelFormat);
xDisplay.bitmap.pixelFormat = display.pixelFormat;
- xDisplay.bitmap.picture = xDisplay.shminfo.shmaddr;
+ xDisplay.bitmap.picture = (byte *)xDisplay.shminfo.shmaddr;
xDisplay.bitmap.size = width * height;
xDisplay.bitmap.sizeBytes = (uint)xDisplay.bitmap.size << GetColorDepthShifts(display.pixelFormat);
}
void RestorePalette(Display display)
{
- XDisplay xDisplay = display.driverData;
+
}
void FreeBitmap(DisplaySystem displaySystem, Bitmap bitmap)
*/
// image.red_mask = 0xFFFF0000;
- image.data = bitmap.picture;
+ image.data = (char *)bitmap.picture;
XInitImage(&image);
if(bitmap.pixelFormat != pixelFormatAlpha && bitmap.alphaBlend)
XSurface xSurface = surface.driverData;
XDisplay xDisplay = display.driverData;
bool changed = false;
- XRectangle rectangle;
if(clip != null)
{
Box box = clip;
xImage = XGetImage(xGlobalDisplay, DefaultRootWindow(xGlobalDisplay), sx, sy, sw, sh, MAXDWORD, ZPixmap);
source.pixelFormat = format;
- source.picture = xImage->data;
+ source.picture = (byte *)xImage->data;
source.width = sw;
source.height = sh;
source.stride = xImage->bytes_per_line / 4;
{
XSurface xSurface = surface.driverData;
XDisplay xDisplay = display ? display.driverData : null;
- XRenderColor renderColor = { color.color.r * color.a, color.color.g * color.a, color.color.b * color.a, color.a * 255};
- X11Picture colorPicture;
+ XRenderColor renderColor = { (uint16)(color.color.r * color.a), (uint16)(color.color.g * color.a), (uint16)(color.color.b * color.a), (uint16)(color.a * 255) };
if(xSurface.colorPicture)
XRenderFreePicture(xGlobalDisplay, xSurface.colorPicture);
(uint16)(xSurface.background.color.r * xSurface.background.a),
(uint16)(xSurface.background.color.g * xSurface.background.a),
(uint16)(xSurface.background.color.b * xSurface.background.a),
- (uint16)xSurface.background.a * 255
+ (uint16)(xSurface.background.a * 255)
};
x1 += surface.offset.x;
y1 += surface.offset.y;
(uint16)(xSurface.background.color.r * xSurface.background.a),
(uint16)(xSurface.background.color.g * xSurface.background.a),
(uint16)(xSurface.background.color.b * xSurface.background.a),
- (uint16)xSurface.background.a * 255
+ (uint16)(xSurface.background.a * 255)
};
x1 += surface.offset.x;
y1 += surface.offset.y;
void Stretch(Display display, Surface surface, Bitmap src, int dx, int dy, int sx, int sy, int w, int h, int sw, int sh)
{
- XDisplay xDisplay = display.driverData;
XSurface xSurface = surface.driverData;
XBitmap xBitmap = src.driverData;
if(xBitmap)
image.bytes_per_line = ((src.pixelFormat == pixelFormat888) ? 4 : 2) * src.stride;
image.bits_per_pixel = (src.pixelFormat == pixelFormat888) ? 32 : 16;
- image.data = src.picture;
+ image.data = (char *)src.picture;
XInitImage(&image);
XPutImage(xGlobalDisplay, (Pixmap)xSurface.pixmap, xDisplay.gc, &image,
image.bytes_per_line = ((temp.pixelFormat == pixelFormat888) ? 4 : 2) * temp.stride;
image.bits_per_pixel = (temp.pixelFormat == pixelFormat888) ? 32 : 16;
- image.data = temp.picture;
+ image.data = (char *)temp.picture;
XInitImage(&image);
if(!src.transparent)
image.bytes_per_line = ((temp.pixelFormat == pixelFormat888) ? 4 : 2) * temp.stride;
image.bits_per_pixel = (temp.pixelFormat == pixelFormat888) ? 32 : 16;
- image.data = temp.picture;
+ image.data = (char *)temp.picture;
XInitImage(&image);
// printf("Blitting DI\n");
image.bytes_per_line = ((temp.pixelFormat == pixelFormat888) ? 4 : 2) * temp.stride;
image.bits_per_pixel = (temp.pixelFormat == pixelFormat888) ? 32 : 16;;
- image.data = temp.picture;
+ image.data = (char *)temp.picture;
XInitImage(&image);
// printf("Blitting DI\n");
}
}
- Font LoadFont(DisplaySystem displaySystem, char * faceName, float size, FontFlags flags)
+ Font LoadFont(DisplaySystem displaySystem, const char * faceName, float size, FontFlags flags)
{
Font font;
font = ((subclass(DisplayDriver))class(LFBDisplayDriver)).LoadFont(displaySystem, faceName, size, flags);
#define CHAR_WIDTH 6
#define CHAR_HEIGHT 14
- void WriteText(Display display, Surface surface, int x, int y, char * text, int len)
+ void WriteText(Display display, Surface surface, int x, int y, const char * text, int len)
{
XSurface xSurface = surface.driverData;
- XDisplay xDisplay = display.driverData;
+ //XDisplay xDisplay = display.driverData;
int tw, th;
((subclass(DisplayDriver))class(LFBDisplayDriver)).TextExtent(display, surface, text, len, &tw, &th);
((subclass(DisplayDriver))class(LFBDisplayDriver)).WriteText(display, surface, x, y, text, len);
}
- void TextExtent(Display display, Surface surface, char * text, int len, int * width, int * height)
+ void TextExtent(Display display, Surface surface, const char * text, int len, int * width, int * height)
{
XSurface xSurface = surface.driverData;
/*
FontExtent(display.displaySystem, xSurface.font, text, len, width, height);
}
- void FontExtent(DisplaySystem displaySystem, Font font, char * text, int len, int * width, int * height)
+ void FontExtent(DisplaySystem displaySystem, Font font, const char * text, int len, int * width, int * height)
{
/*
if(width) *width = len * CHAR_WIDTH;
void LineStipple(Display display, Surface surface, uint stipple)
{
- XSurface xSurface = surface.driverData;
XDisplay xDisplay = display.driverData;
char list[32] = { 0 };
int count = 0;
}
}
-default dllexport int __attribute__((stdcall)) IS_XGetPixmap(Bitmap bitmap)
+default dllexport long IS_XGetPixmap(Bitmap bitmap)
{
XBitmap xBitmap = bitmap.driverData;
return xBitmap.pixmap;
}
-default dllexport void __attribute__((stdcall)) IS_XGetSurfaceInfo(Surface surface, Pixmap * pixmap, GC * gc, int *x, int * y)
+default dllexport void IS_XGetSurfaceInfo(Surface surface, Pixmap * pixmap, GC * gc, int *x, int * y)
{
Display display = surface.display;
XDisplay xDisplay = display.driverData;