📄 wmesa.c
字号:
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_single(const GLcontext* ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
const GLchan color[4],
const GLubyte mask[])
{
GLuint i;
PWMC pwc = Current;
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_single(const GLcontext* ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
const GLubyte rgba[][4],
const GLubyte mask[] )
{
GLuint i;
PWMC pwc = Current;
(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_single(const GLcontext* ctx,
struct gl_renderbuffer *rb,
GLuint n,
const GLint x[], const GLint y[],
const GLchan color[4],
const GLubyte mask[] )
{
GLuint i;
PWMC pwc = Current;
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_single(const GLcontext* ctx,
struct gl_renderbuffer *rb,
GLuint n, GLint x, GLint y,
GLubyte rgba[][4] )
{
GLuint i;
COLORREF Color;
y = FLIP(y);
for (i=0; i<n; i++) {
Color = GetPixel(Current->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_single(const GLcontext* ctx,
struct gl_renderbuffer *rb,
GLuint n, const GLint x[], const GLint y[],
GLubyte rgba[][4])
{
GLuint i;
COLORREF Color;
for (i=0; i<n; i++) {
GLint y2 = FLIP(y[i]);
Color = GetPixel(Current->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[] )
{
PWMC pwc = Current;
GLuint i;
LPDWORD lpdw;
(void) ctx;
y=FLIP(y);
lpdw = ((LPDWORD)(pwc->pbPixels + pwc->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[][4],
const GLubyte mask[] )
{
PWMC pwc = Current;
GLuint i;
LPDWORD lpdw;
(void) ctx;
y=FLIP(y);
lpdw = ((LPDWORD)(pwc->pbPixels + pwc->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;
PWMC pwc = Current;
lpdw = ((LPDWORD)(pwc->pbPixels + pwc->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;
PWMC pwc = Current;
for (i=0; i<n; i++)
if (mask[i])
WMSETPIXEL32(pwc, 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;
PWMC pwc = Current;
for (i=0; i<n; i++)
if (mask[i])
WMSETPIXEL32(pwc, 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;
PWMC pwc = Current;
y = FLIP(y);
lpdw = ((LPDWORD)(pwc->pbPixels + pwc->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;
PWMC pwc = Current;
for (i=0; i<n; i++) {
GLint y2 = FLIP(y[i]);
lpdw = ((LPDWORD)(pwc->pbPixels + pwc->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[] )
{
PWMC pwc = Current;
GLuint i;
LPWORD lpw;
(void) ctx;
y=FLIP(y);
lpw = ((LPWORD)(pwc->pbPixels + pwc->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[][4],
const GLubyte mask[] )
{
PWMC pwc = Current;
GLuint i;
LPWORD lpw;
(void) ctx;
y=FLIP(y);
lpw = ((LPWORD)(pwc->pbPixels + pwc->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;
PWMC pwc = Current;
(void) ctx;
lpw = ((LPWORD)(pwc->pbPixels + pwc->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;
PWMC pwc = Current;
(void) ctx;
for (i=0; i<n; i++)
if (mask[i])
WMSETPIXEL16(pwc, FLIP(y[i]), x[i],
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -