⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wmesa.c

📁 mesa-6.5-minigui源码
💻 C
📖 第 1 页 / 共 3 页
字号:
					       rgba[i][BCOMP]));    }    else {	for (i=0; i<n; i++)	    SetPixel(pwc->hDC, x+i, y, RGB(rgba[i][RCOMP], rgba[i][GCOMP], 					   rgba[i][BCOMP]));    }    }/* Write a horizontal span of RGB color pixels with a boolean mask. */static void write_rgb_span_front(const GLcontext *ctx, 				  struct gl_renderbuffer *rb, 				  GLuint n, GLint x, GLint y,				  const GLubyte rgb[][3], 				  const GLubyte mask[] ){    WMesaContext pwc = wmesa_context(ctx);    GLuint i;        (void) ctx;    y=FLIP(y);    if (mask) {	for (i=0; i<n; i++)	    if (mask[i])		SetPixel(pwc->hDC, x+i, y, RGB(rgb[i][RCOMP], rgb[i][GCOMP], 					       rgb[i][BCOMP]));    }    else {	for (i=0; i<n; i++)	    SetPixel(pwc->hDC, x+i, y, RGB(rgb[i][RCOMP], rgb[i][GCOMP], 					   rgb[i][BCOMP]));    }    }/* * 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 GLcontext *ctx, 					struct gl_renderbuffer *rb,					GLuint n, GLint x, GLint y,					const GLchan color[4], 					const GLubyte mask[]){    GLuint i;    WMesaContext pwc = wmesa_context(ctx);    COLORREF colorref;    (void) ctx;    colorref = RGB(color[RCOMP], color[GCOMP], color[BCOMP]);    y=FLIP(y);    if (mask) {	for (i=0; i<n; i++)	    if (mask[i])		SetPixel(pwc->hDC, x+i, y, colorref);    }    else	for (i=0; i<n; i++)	    SetPixel(pwc->hDC, x+i, y, colorref);}/* Write an array of RGBA pixels with a boolean mask. */static void write_rgba_pixels_front(const GLcontext *ctx, 				     struct gl_renderbuffer *rb,				     GLuint n, 				     const GLint x[], const GLint y[],				     const GLubyte rgba[][4], 				     const GLubyte mask[] ){    GLuint i;    WMesaContext pwc = wmesa_context(ctx);    (void) ctx;    for (i=0; i<n; i++)	if (mask[i])	    SetPixel(pwc->hDC, x[i], FLIP(y[i]), 		     RGB(rgba[i][RCOMP], rgba[i][GCOMP], 			 rgba[i][BCOMP]));}/* * 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 GLcontext *ctx, 					  struct gl_renderbuffer *rb,					  GLuint n,					  const GLint x[], const GLint y[],					  const GLchan color[4],					  const GLubyte mask[] ){    GLuint i;    WMesaContext pwc = wmesa_context(ctx);    COLORREF colorref;    (void) ctx;    colorref = RGB(color[RCOMP], color[GCOMP], color[BCOMP]);    for (i=0; i<n; i++)	if (mask[i])	    SetPixel(pwc->hDC, x[i], FLIP(y[i]), colorref);}/* Read a horizontal span of color pixels. */static void read_rgba_span_front(const GLcontext *ctx, 				  struct gl_renderbuffer *rb,				  GLuint n, GLint x, GLint y,				  GLubyte rgba[][4] ){    WMesaContext pwc = wmesa_context(ctx);    GLuint i;    COLORREF Color;    y = FLIP(y);    for (i=0; i<n; i++) {	Color = GetPixel(pwc->hDC, x+i, y);	rgba[i][RCOMP] = GetRValue(Color);	rgba[i][GCOMP] = GetGValue(Color);	rgba[i][BCOMP] = GetBValue(Color);	rgba[i][ACOMP] = 255;    }}/* Read an array of color pixels. */static void read_rgba_pixels_front(const GLcontext *ctx, 				    struct gl_renderbuffer *rb,				    GLuint n, const GLint x[], const GLint y[],				    GLubyte rgba[][4]){    WMesaContext pwc = wmesa_context(ctx);    GLuint i;    COLORREF Color;    for (i=0; i<n; i++) {        GLint y2 = FLIP(y[i]);        Color = GetPixel(pwc->hDC, x[i], y2);        rgba[i][RCOMP] = GetRValue(Color);        rgba[i][GCOMP] = GetGValue(Color);        rgba[i][BCOMP] = GetBValue(Color);        rgba[i][ACOMP] = 255;    }}/*********************************************************************//* DOUBLE BUFFER 32-bit */#define WMSETPIXEL32(pwc, y, x, r, g, b) { \LPDWORD lpdw = ((LPDWORD)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (x)); \*lpdw = BGR32((r),(g),(b)); }/* Write a horizontal span of RGBA color pixels with a boolean mask. */static void write_rgba_span_32(const GLcontext *ctx, 			       struct gl_renderbuffer *rb, 			       GLuint n, GLint x, GLint y,			       const GLubyte rgba[][4], 			       const GLubyte mask[] ){    WMesaContext pwc = wmesa_context(ctx);    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);    GLuint i;    LPDWORD lpdw;    (void) ctx;        y=FLIP(y);    lpdw = ((LPDWORD)(pwfb->pbPixels + pwfb->ScanWidth * y)) + x;    if (mask) {	for (i=0; i<n; i++)	    if (mask[i])                lpdw[i] = BGR32(rgba[i][RCOMP], rgba[i][GCOMP], 				rgba[i][BCOMP]);    }    else {	for (i=0; i<n; i++)                *lpdw++ = BGR32(rgba[i][RCOMP], rgba[i][GCOMP], 				rgba[i][BCOMP]);    }}/* Write a horizontal span of RGB color pixels with a boolean mask. */static void write_rgb_span_32(const GLcontext *ctx, 			      struct gl_renderbuffer *rb, 			      GLuint n, GLint x, GLint y,			      const GLubyte rgb[][3], 			      const GLubyte mask[] ){    WMesaContext pwc = wmesa_context(ctx);    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);    GLuint i;    LPDWORD lpdw;    (void) ctx;        y=FLIP(y);    lpdw = ((LPDWORD)(pwfb->pbPixels + pwfb->ScanWidth * y)) + x;    if (mask) {	for (i=0; i<n; i++)	    if (mask[i])                lpdw[i] = BGR32(rgb[i][RCOMP], rgb[i][GCOMP], 				rgb[i][BCOMP]);    }    else {	for (i=0; i<n; i++)                *lpdw++ = BGR32(rgb[i][RCOMP], rgb[i][GCOMP], 				rgb[i][BCOMP]);    }}/* * 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 GLcontext *ctx, 				    struct gl_renderbuffer *rb,				    GLuint n, GLint x, GLint y,				    const GLchan color[4], 				    const GLubyte mask[]){    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);    pixel = BGR32(color[RCOMP], color[GCOMP], color[BCOMP]);    if (mask) {	for (i=0; i<n; i++)	    if (mask[i])                lpdw[i] = pixel;    }    else	for (i=0; i<n; i++)                *lpdw++ = pixel;}/* Write an array of RGBA pixels with a boolean mask. */static void write_rgba_pixels_32(const GLcontext *ctx, 				 struct gl_renderbuffer *rb,				 GLuint n, const GLint x[], const GLint y[],				 const GLubyte rgba[][4], 				 const GLubyte mask[]){    GLuint i;    WMesaContext pwc = wmesa_context(ctx);    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);    for (i=0; i<n; i++)	if (mask[i])	    WMSETPIXEL32(pwfb, FLIP(y[i]), x[i],			 rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);}/* * 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 GLcontext *ctx, 				      struct gl_renderbuffer *rb,				      GLuint n,				      const GLint x[], const GLint y[],				      const GLchan color[4],				      const GLubyte mask[]){    GLuint i;    WMesaContext pwc = wmesa_context(ctx);    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);    for (i=0; i<n; i++)	if (mask[i])	    WMSETPIXEL32(pwfb, FLIP(y[i]),x[i],color[RCOMP],			 color[GCOMP], color[BCOMP]);}/* Read a horizontal span of color pixels. */static void read_rgba_span_32(const GLcontext *ctx, 			      struct gl_renderbuffer *rb,			      GLuint n, GLint x, GLint y,			      GLubyte rgba[][4] ){    GLuint i;    DWORD pixel;    LPDWORD lpdw;    WMesaContext pwc = wmesa_context(ctx);    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);        y = FLIP(y);    lpdw = ((LPDWORD)(pwfb->pbPixels + pwfb->ScanWidth * y)) + x;    for (i=0; i<n; i++) {	pixel = lpdw[i];	rgba[i][RCOMP] = (pixel & 0x00ff0000) >> 16;	rgba[i][GCOMP] = (pixel & 0x0000ff00) >> 8;	rgba[i][BCOMP] = (pixel & 0x000000ff);	rgba[i][ACOMP] = 255;    }}/* Read an array of color pixels. */static void read_rgba_pixels_32(const GLcontext *ctx, 				struct gl_renderbuffer *rb,				GLuint n, const GLint x[], const GLint y[],				GLubyte rgba[][4]){    GLuint i;    DWORD pixel;    LPDWORD lpdw;    WMesaContext pwc = wmesa_context(ctx);    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);    for (i=0; i<n; i++) {	GLint y2 = FLIP(y[i]);	lpdw = ((LPDWORD)(pwfb->pbPixels + pwfb->ScanWidth * y2)) + x[i];	pixel = lpdw[i];	rgba[i][RCOMP] = (pixel & 0x00ff0000) >> 16;	rgba[i][GCOMP] = (pixel & 0x0000ff00) >> 8;	rgba[i][BCOMP] = (pixel & 0x000000ff);	rgba[i][ACOMP] = 255;  }}/*********************************************************************//* DOUBLE BUFFER 16-bit */#define WMSETPIXEL16(pwc, y, x, r, g, b) { \LPWORD lpw = ((LPWORD)((pwc)->pbPixels + (pwc)->ScanWidth * (y)) + (x)); \*lpw = BGR16((r),(g),(b)); }/* Write a horizontal span of RGBA color pixels with a boolean mask. */static void write_rgba_span_16(const GLcontext *ctx, 			       struct gl_renderbuffer *rb, 			       GLuint n, GLint x, GLint y,			       const GLubyte rgba[][4], 			       const GLubyte mask[] ){    WMesaContext pwc = wmesa_context(ctx);    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);    GLuint i;    LPWORD lpw;    (void) ctx;        y=FLIP(y);    lpw = ((LPWORD)(pwfb->pbPixels + pwfb->ScanWidth * y)) + x;    if (mask) {	for (i=0; i<n; i++)	    if (mask[i])                lpw[i] = BGR16(rgba[i][RCOMP], rgba[i][GCOMP], 			       rgba[i][BCOMP]);    }    else {	for (i=0; i<n; i++)                *lpw++ = BGR16(rgba[i][RCOMP], rgba[i][GCOMP], 			       rgba[i][BCOMP]);    }}/* Write a horizontal span of RGB color pixels with a boolean mask. */static void write_rgb_span_16(const GLcontext *ctx, 			      struct gl_renderbuffer *rb, 			      GLuint n, GLint x, GLint y,			      const GLubyte rgb[][3], 			      const GLubyte mask[] ){    WMesaContext pwc = wmesa_context(ctx);    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);    GLuint i;    LPWORD lpw;    (void) ctx;        y=FLIP(y);    lpw = ((LPWORD)(pwfb->pbPixels + pwfb->ScanWidth * y)) + x;    if (mask) {	for (i=0; i<n; i++)	    if (mask[i])                lpw[i] = BGR16(rgb[i][RCOMP], rgb[i][GCOMP], 			       rgb[i][BCOMP]);    }    else {	for (i=0; i<n; i++)                *lpw++ = BGR16(rgb[i][RCOMP], rgb[i][GCOMP], 			       rgb[i][BCOMP]);    }}/* * 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 GLcontext *ctx, 				    struct gl_renderbuffer *rb,				    GLuint n, GLint x, GLint y,				    const GLchan color[4], 				    const GLubyte mask[]){    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;    y=FLIP(y);    pixel = BGR16(color[RCOMP], color[GCOMP], color[BCOMP]);    if (mask) {	for (i=0; i<n; i++)	    if (mask[i])                lpw[i] = pixel;    }    else	for (i=0; i<n; i++)                *lpw++ = pixel;}/* Write an array of RGBA pixels with a boolean mask. */static void write_rgba_pixels_16(const GLcontext *ctx, 				 struct gl_renderbuffer *rb,				 GLuint n, const GLint x[], const GLint y[],				 const GLubyte rgba[][4], 				 const GLubyte mask[]){    GLuint i;    WMesaContext pwc = wmesa_context(ctx);    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);    (void) ctx;    for (i=0; i<n; i++)	if (mask[i])	    WMSETPIXEL16(pwfb, FLIP(y[i]), x[i],			 rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);}/* * 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 GLcontext *ctx, 				      struct gl_renderbuffer *rb,				      GLuint n,				      const GLint x[], const GLint y[],				      const GLchan color[4],				      const GLubyte mask[]){    GLuint i;    WMesaContext pwc = wmesa_context(ctx);    WMesaFramebuffer pwfb = wmesa_framebuffer(ctx->DrawBuffer);    (void) ctx;    for (i=0; i<n; i++)	if (mask[i])	    WMSETPIXEL16(pwfb, FLIP(y[i]),x[i],color[RCOMP],			 color[GCOMP], color[BCOMP]);}/* Read a horizontal span of color pixels. */static void read_rgba_span_16(const GLcontext *ctx, 			      struct gl_renderbuffer *rb,			      GLuint n, GLint x, GLint y,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -