#include "wmesadef.h"
#include "colors.h"
-#include <GL/wmesa.h>
+#include "GL/wmesa.h"
#include <winuser.h>
#include "main/context.h"
#include "main/extensions.h"
* Create a new WMesaFramebuffer object which will correspond to the
* given HDC (Window handle).
*/
-WMesaFramebuffer
+static WMesaFramebuffer
wmesa_new_framebuffer(HDC hdc, struct gl_config *visual)
{
WMesaFramebuffer pwfb
/**
* Given an hdc, free the corresponding WMesaFramebuffer
*/
-void
+static void
wmesa_free_framebuffer(HDC hdc)
{
WMesaFramebuffer pwfb, prev;
/**
* Given an hdc, return the corresponding WMesaFramebuffer
*/
-WMesaFramebuffer
+static WMesaFramebuffer
wmesa_lookup_framebuffer(HDC hdc)
{
WMesaFramebuffer pwfb;
* We write into this memory with the span routines and then blit it
* to the window on a buffer swap.
*/
-BOOL wmCreateBackingStore(WMesaFramebuffer pwfb, long lxSize, long lySize)
+static BOOL wmCreateBackingStore(WMesaFramebuffer pwfb, long lxSize, long lySize)
{
- HDC hdc = pwfb->hDC;
LPBITMAPINFO pbmi = &(pwfb->bmi);
HDC hic;
static void wmesa_flush(struct gl_context *ctx)
{
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->WinSysDrawBuffer);
if (ctx->Visual.doubleBufferMode == 1) {
static void clear_color(struct gl_context *ctx, const GLfloat color[4])
{
WMesaContext pwc = wmesa_context(ctx);
- WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
GLubyte col[3];
- UINT bytesPerPixel = pwfb->cColorBits / 8;
CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
**/
/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_front(const struct gl_context *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[] )
+static void write_rgba_span_front(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
+ const void *values,
+ const GLubyte *mask)
{
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_lookup_framebuffer(pwc->hDC);
- CONST BITMAPINFO bmi=
- {
- {
- sizeof(BITMAPINFOHEADER),
- n, 1, 1, 32, BI_RGB, 0, 1, 1, 0, 0
- }
- };
HBITMAP bmp=0;
HDC mdc=0;
typedef union
}
/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_front(const struct gl_context *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3],
- const GLubyte mask[] )
+static void write_rgb_span_front(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
+ const void *values,
+ const GLubyte *mask)
{
+ const GLubyte (*rgb)[3] = (const GLubyte (*)[3])values;
WMesaContext pwc = wmesa_context(ctx);
GLuint i;
* Write a horizontal span of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_span_front(const struct gl_context *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- const GLchan color[4],
- const GLubyte mask[])
+static void write_mono_rgba_span_front(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
+ const void *value,
+ const GLubyte *mask)
{
+ const GLchan *color = (const GLchan *)value;
GLuint i;
WMesaContext pwc = wmesa_context(ctx);
COLORREF colorref;
}
/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_front(const struct gl_context *ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- const GLint x[], const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[] )
+static void write_rgba_pixels_front(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n,
+ const GLint x[], const GLint y[],
+ const void *values,
+ const GLubyte *mask)
{
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
GLuint i;
WMesaContext pwc = wmesa_context(ctx);
(void) ctx;
* Write an array of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_pixels_front(const struct gl_context *ctx,
- struct gl_renderbuffer *rb,
- GLuint n,
- const GLint x[], const GLint y[],
- const GLchan color[4],
- const GLubyte mask[] )
+static void write_mono_rgba_pixels_front(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n,
+ const GLint x[], const GLint y[],
+ const void *value,
+ const GLubyte *mask)
{
+ const GLchan *color = (const GLchan *)value;
GLuint i;
WMesaContext pwc = wmesa_context(ctx);
COLORREF colorref;
}
/* Read a horizontal span of color pixels. */
-static void read_rgba_span_front(const struct gl_context *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
+static void read_rgba_span_front(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, GLint x, GLint y,
+ void *values)
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
WMesaContext pwc = wmesa_context(ctx);
GLuint i;
COLORREF Color;
/* Read an array of color pixels. */
-static void read_rgba_pixels_front(const struct gl_context *ctx,
- struct gl_renderbuffer *rb,
- GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4])
+static void read_rgba_pixels_front(struct gl_context *ctx,
+ struct gl_renderbuffer *rb,
+ GLuint n, const GLint x[], const GLint y[],
+ void *values)
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
WMesaContext pwc = wmesa_context(ctx);
GLuint i;
COLORREF Color;
/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_32(const struct gl_context *ctx,
+static void write_rgba_span_32(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[] )
+ const void *values,
+ const GLubyte *mask)
{
- WMesaContext pwc = wmesa_context(ctx);
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
GLuint i;
LPDWORD lpdw;
/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_32(const struct gl_context *ctx,
+static void write_rgb_span_32(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3],
- const GLubyte mask[] )
+ const void *values,
+ const GLubyte *mask)
{
- WMesaContext pwc = wmesa_context(ctx);
+ const GLubyte (*rgb)[3] = (const GLubyte (*)[3])values;
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
GLuint i;
LPDWORD lpdw;
* Write a horizontal span of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_span_32(const struct gl_context *ctx,
+static void write_mono_rgba_span_32(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLchan color[4],
- const GLubyte mask[])
+ const void *value,
+ const GLubyte *mask)
{
+ const GLchan *color = (const GLchan *)value;
LPDWORD lpdw;
DWORD pixel;
GLuint i;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
lpdw = ((LPDWORD)(pwfb->pbPixels + pwfb->ScanWidth * y)) + x;
y=FLIP(y);
}
/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_32(const struct gl_context *ctx,
+static void write_rgba_pixels_32(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[])
+ const void *values,
+ const GLubyte *mask)
{
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
GLuint i;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
for (i=0; i<n; i++)
if (mask[i])
* Write an array of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_pixels_32(const struct gl_context *ctx,
+static void write_mono_rgba_pixels_32(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
- const GLchan color[4],
- const GLubyte mask[])
+ const void *value,
+ const GLubyte *mask)
{
+ const GLchan *color = (const GLchan *)value;
GLuint i;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
for (i=0; i<n; i++)
if (mask[i])
}
/* Read a horizontal span of color pixels. */
-static void read_rgba_span_32(const struct gl_context *ctx,
+static void read_rgba_span_32(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
+ void *values)
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
GLuint i;
DWORD pixel;
LPDWORD lpdw;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
y = FLIP(y);
/* Read an array of color pixels. */
-static void read_rgba_pixels_32(const struct gl_context *ctx,
+static void read_rgba_pixels_32(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4])
+ void *values)
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
GLuint i;
DWORD pixel;
LPDWORD lpdw;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
for (i=0; i<n; i++) {
lpb[2] = (r); }
/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_24(const struct gl_context *ctx,
+static void write_rgba_span_24(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[] )
+ const void *values,
+ const GLubyte *mask)
{
- WMesaContext pwc = wmesa_context(ctx);
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
GLuint i;
LPBYTE lpb;
/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_24(const struct gl_context *ctx,
+static void write_rgb_span_24(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3],
- const GLubyte mask[] )
+ const void *values,
+ const GLubyte *mask)
{
- WMesaContext pwc = wmesa_context(ctx);
+ const GLubyte (*rgb)[3] = (const GLubyte (*)[3])values;
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
GLuint i;
LPBYTE lpb;
* Write a horizontal span of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_span_24(const struct gl_context *ctx,
+static void write_mono_rgba_span_24(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLchan color[4],
- const GLubyte mask[])
+ const void *value,
+ const GLubyte *mask)
{
+ const GLchan *color = (const GLchan *)value;
LPBYTE lpb;
GLuint i;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
lpb = ((LPBYTE)(pwfb->pbPixels + pwfb->ScanWidth * y)) + (3 * x);
y=FLIP(y);
}
/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_24(const struct gl_context *ctx,
+static void write_rgba_pixels_24(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[])
+ const void *values,
+ const GLubyte *mask)
{
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
GLuint i;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
for (i=0; i<n; i++)
if (mask[i])
* Write an array of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_pixels_24(const struct gl_context *ctx,
+static void write_mono_rgba_pixels_24(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
- const GLchan color[4],
- const GLubyte mask[])
+ const void *value,
+ const GLubyte *mask)
{
+ const GLchan *color = (const GLchan *)value;
GLuint i;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
for (i=0; i<n; i++)
if (mask[i])
}
/* Read a horizontal span of color pixels. */
-static void read_rgba_span_24(const struct gl_context *ctx,
+static void read_rgba_span_24(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
+ void *values)
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
GLuint i;
LPBYTE lpb;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
y = FLIP(y);
/* Read an array of color pixels. */
-static void read_rgba_pixels_24(const struct gl_context *ctx,
+static void read_rgba_pixels_24(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4])
+ void *values)
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
GLuint i;
LPBYTE lpb;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
for (i=0; i<n; i++) {
/* Write a horizontal span of RGBA color pixels with a boolean mask. */
-static void write_rgba_span_16(const struct gl_context *ctx,
+static void write_rgba_span_16(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLubyte rgba[][4],
- const GLubyte mask[] )
+ const void *values,
+ const GLubyte *mask)
{
- WMesaContext pwc = wmesa_context(ctx);
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
GLuint i;
LPWORD lpw;
/* Write a horizontal span of RGB color pixels with a boolean mask. */
-static void write_rgb_span_16(const struct gl_context *ctx,
+static void write_rgb_span_16(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLubyte rgb[][3],
- const GLubyte mask[] )
+ const void *values,
+ const GLubyte *mask)
{
- WMesaContext pwc = wmesa_context(ctx);
+ const GLubyte (*rgb)[3] = (const GLubyte (*)[3])values;
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
GLuint i;
LPWORD lpw;
* Write a horizontal span of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_span_16(const struct gl_context *ctx,
+static void write_mono_rgba_span_16(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- const GLchan color[4],
- const GLubyte mask[])
+ const void *value,
+ const GLubyte *mask)
{
+ const GLchan *color = (const GLchan *)value;
LPWORD lpw;
WORD pixel;
GLuint i;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
(void) ctx;
lpw = ((LPWORD)(pwfb->pbPixels + pwfb->ScanWidth * y)) + x;
}
/* Write an array of RGBA pixels with a boolean mask. */
-static void write_rgba_pixels_16(const struct gl_context *ctx,
+static void write_rgba_pixels_16(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
- const GLubyte rgba[][4],
- const GLubyte mask[])
+ const void *values,
+ const GLubyte *mask)
{
+ const GLubyte (*rgba)[4] = (const GLubyte (*)[4])values;
GLuint i;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
(void) ctx;
for (i=0; i<n; i++)
* Write an array of pixels with a boolean mask. The current color
* is used for all pixels.
*/
-static void write_mono_rgba_pixels_16(const struct gl_context *ctx,
+static void write_mono_rgba_pixels_16(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
- const GLchan color[4],
- const GLubyte mask[])
+ const void *value,
+ const GLubyte *mask)
{
+ const GLchan *color = (const GLchan *)value;
GLuint i;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
(void) ctx;
for (i=0; i<n; i++)
}
/* Read a horizontal span of color pixels. */
-static void read_rgba_span_16(const struct gl_context *ctx,
+static void read_rgba_span_16(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
- GLubyte rgba[][4] )
+ void *values)
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
GLuint i, pixel;
LPWORD lpw;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
y = FLIP(y);
/* Read an array of color pixels. */
-static void read_rgba_pixels_16(const struct gl_context *ctx,
+static void read_rgba_pixels_16(struct gl_context *ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
- GLubyte rgba[][4])
+ void *values)
{
+ GLubyte (*rgba)[4] = (GLubyte (*)[4])values;
GLuint i, pixel;
LPWORD lpw;
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);
for (i=0; i<n; i++) {
* Plug in the Get/PutRow/Values functions for a renderbuffer depending
* on if we're drawing to the front or back color buffer.
*/
-void wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
- int cColorBits, int double_buffer)
+static void
+wmesa_set_renderbuffer_funcs(struct gl_renderbuffer *rb, int pixelformat,
+ int cColorBits, int double_buffer)
{
if (double_buffer) {
/* back buffer */
wmesa_resize_buffers(struct gl_context *ctx, struct gl_framebuffer *buffer,
GLuint width, GLuint height)
{
- WMesaContext pwc = wmesa_context(ctx);
WMesaFramebuffer pwfb = wmesa_framebuffer(buffer);
if (pwfb->Base.Width != width || pwfb->Base.Height != height) {
GLint x, GLint y,
GLsizei width, GLsizei height)
{
- WMesaContext pwc = wmesa_context(ctx);
GLuint new_width, new_height;
wmesa_get_buffer_size(ctx->WinSysDrawBuffer, &new_width, &new_height);
/**
* Create a new color renderbuffer.
*/
-struct gl_renderbuffer *
+static struct gl_renderbuffer *
wmesa_new_renderbuffer(void)
{
struct gl_renderbuffer *rb = CALLOC_STRUCT(gl_renderbuffer);