Only build tested.
* New in Mesa 7.1
*/
extern void
-XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
+XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer,
const int *attrib_list);
extern void
-XMesaReleaseTexImage(Display *dpy, XMesaBuffer drawable, int buffer);
+XMesaReleaseTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer);
extern XMesaBuffer
#define XMesaDrawPoints XDrawPoints
#define XMesaDrawLine XDrawLine
#define XMesaFillRectangle XFillRectangle
+#define XMesaGetImage XGetImage
#define XMesaPutImage XPutImage
#define XMesaCopyArea XCopyArea
#include "scrnintstr.h"
#include "pixmapstr.h"
#include "gcstruct.h"
+#include "servermd.h"
-typedef struct _XMesaImageRec XMesaImage;
+
+typedef struct _XMesaImageRec {
+ int width, height;
+ char *data;
+ int bytes_per_line; /* Padded to 32 bits */
+ int bits_per_pixel;
+} XMesaImage;
typedef ScreenRec XMesaDisplay;
typedef PixmapPtr XMesaPixmap;
(*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
} while (0)
+static _X_INLINE XMesaImage *XMesaGetImage(XMesaDisplay *dpy, PixmapPtr p, int x,
+ int y, unsigned int width,
+ unsigned int height,
+ unsigned long plane_mask, int format)
+{
+ XMesaImage *img = Xcalloc(sizeof(*img));
+
+ img->width = p->drawable.width;
+ img->height = p->drawable.height;
+ img->bits_per_pixel = p->drawable.bitsPerPixel;
+ img->bytes_per_line = PixmapBytePad(width, p->drawable.depth);
+ img->data = malloc(height * img->bytes_per_line);
+
+ /* Assumes: Images are always in ZPixmap format */
+ (*p->drawable.pScreen->GetImage)(&p->drawable, x, y, width, height,
+ plane_mask, ZPixmap, img->data);
+
+ return img;
+}
+
#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
do { \
/* Assumes: Images are always in ZPixmap format */ \
#endif
#include "glxheader.h"
+#include "GL/glxtokens.h"
#include "GL/xmesa.h"
#include "xmesaP.h"
#include "context.h"
XSetErrorHandler(old_handler);
return WindowExistsFlag;
}
-#endif
-
static Status
-get_drawable_size(Display *dpy, Drawable d, GLuint *width, GLuint *height)
+get_drawable_size( XMesaDisplay *dpy, Drawable d, GLuint *width, GLuint *height )
{
Window root;
Status stat;
*height = h;
return stat;
}
+#endif
/**
return NULL;
/* get pixmap size, update framebuffer/renderbuffer dims */
- get_drawable_size(v->display, p, &width, &height);
+ xmesa_get_window_size(v->display, b, &width, &height);
_mesa_resize_framebuffer(NULL, &(b->mesa_buffer), width, height);
if (target == 0) {
PUBLIC void
-XMesaBindTexImage(Display *dpy, XMesaBuffer drawable, int buffer,
+XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer,
const int *attrib_list)
{
#if 0
struct gl_renderbuffer *rb;
struct xmesa_renderbuffer *xrb;
GLint b;
- XMesaImage *img;
+ XMesaImage *img = NULL;
GLboolean freeImg = GL_FALSE;
b = xbuffer_to_renderbuffer(buffer);
* The following is a quick and simple way to implement
* BindTexImage. The better way is to write some new FetchTexel()
* functions which would extract texels from XImages. We'd still
- * need to use XGetImage when texturing from a Pixmap (front buffer)
+ * need to use GetImage when texturing from a Pixmap (front buffer)
* but texturing from a back buffer (XImage) would avoid an image
* copy.
*/
/* get XImage */
if (xrb->pixmap) {
- img = XGetImage(dpy, xrb->pixmap, 0, 0, rb->Width, rb->Height,
- AllPlanes, ZPixmap );
+ img = XMesaGetImage(dpy, xrb->pixmap, 0, 0, rb->Width, rb->Height, ~0L,
+ ZPixmap);
freeImg = GL_TRUE;
}
else if (xrb->ximage) {
PUBLIC void
-XMesaReleaseTexImage(Display *dpy, XMesaBuffer drawable, int buffer)
+XMesaReleaseTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer)
{
const GLint b = xbuffer_to_renderbuffer(buffer);
if (b < 0)
#define XMESA_USE_PUTPIXEL_MACRO
-struct _XMesaImageRec {
- int width, height;
- char *data;
- int bytes_per_line; /* Padded to 32 bits */
- int bits_per_pixel;
-};
-
extern XMesaImage *XMesaCreateImage(int bitsPerPixel, int width, int height,
char *data);
extern void XMesaDestroyImage(XMesaImage *image);