📄 xm_span.c
字号:
{ const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XDITHER_SETUP(y); y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaSetForeground( dpy, gc, XDITHER(x, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); } } } else { /* draw all pixels */ XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, XDITHER(x+i, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]) ); } XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 ); }}/* * Write a span of PF_1BIT pixels to a pixmap. */static void put_row_1BIT_pixmap( PUT_ROW_ARGS ){ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaSetForeground( dpy, gc, DITHER_1BIT( x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); } } } else { /* draw all pixels */ XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, DITHER_1BIT( x+i, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) ); } XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 ); }}/* * Write a span of PF_1BIT pixels to a pixmap (no alpha). */static void put_row_rgb_1BIT_pixmap( RGB_SPAN_ARGS ){ const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaSetForeground( dpy, gc, DITHER_1BIT(x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); } } } else { /* draw all pixels */ XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, DITHER_1BIT(x+i, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]) ); } XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 ); }}/* * Write a span of PF_HPCR pixels to a pixmap. */static void put_row_HPCR_pixmap( PUT_ROW_ARGS ){ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaSetForeground( dpy, gc, DITHER_HPCR( x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); } } } else { XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLubyte *ptr = (GLubyte *) XMESA_BUFFER(ctx->DrawBuffer)->rowimage->data; for (i=0;i<n;i++) { ptr[i] = DITHER_HPCR( (x+i), y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); } XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 ); }}/* * Write a span of PF_HPCR pixels to a pixmap (no alpha). */static void put_row_rgb_HPCR_pixmap( RGB_SPAN_ARGS ){ const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaSetForeground( dpy, gc, DITHER_HPCR(x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); } } } else { XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLubyte *ptr = (GLubyte *) XMESA_BUFFER(ctx->DrawBuffer)->rowimage->data; for (i=0;i<n;i++) { ptr[i] = DITHER_HPCR( (x+i), y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); } XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 ); }}/* * Write a span of PF_LOOKUP pixels to a pixmap. */static void put_row_LOOKUP_pixmap( PUT_ROW_ARGS ){ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaSetForeground( dpy, gc, LOOKUP( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); } } } else { XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, LOOKUP(rgba[i][RCOMP],rgba[i][GCOMP],rgba[i][BCOMP]) ); } XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 ); }}/* * Write a span of PF_LOOKUP pixels to a pixmap (no alpha). */static void put_row_rgb_LOOKUP_pixmap( RGB_SPAN_ARGS ){ const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaSetForeground( dpy, gc, LOOKUP( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); } } } else { XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, LOOKUP(rgb[i][RCOMP],rgb[i][GCOMP],rgb[i][BCOMP]) ); } XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 ); }}/* * Write a span of PF_GRAYSCALE pixels to a pixmap. */static void put_row_GRAYSCALE_pixmap( PUT_ROW_ARGS ){ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaSetForeground( dpy, gc, GRAY_RGB( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); } } } else { XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, GRAY_RGB(rgba[i][RCOMP],rgba[i][GCOMP],rgba[i][BCOMP]) ); } XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 ); }}/* * Write a span of PF_GRAYSCALE pixels to a pixmap (no alpha). */static void put_row_rgb_GRAYSCALE_pixmap( RGB_SPAN_ARGS ){ const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaSetForeground( dpy, gc, GRAY_RGB( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); } } } else { XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, GRAY_RGB(rgb[i][RCOMP],rgb[i][GCOMP],rgb[i][BCOMP]) ); } XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 ); }}/* * Write a span of PF_TRUECOLOR pixels to an XImage. */static void put_row_TRUECOLOR_ximage( PUT_ROW_ARGS ){ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { unsigned long p; PACK_TRUECOLOR( p, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); XMesaPutPixel( img, x, y, p ); } } } else { /* draw all pixels */ for (i=0;i<n;i++,x++) { unsigned long p; PACK_TRUECOLOR( p, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); XMesaPutPixel( img, x, y, p ); } }}/* * Write a span of PF_TRUECOLOR pixels to an XImage (no alpha). */static void put_row_rgb_TRUECOLOR_ximage( RGB_SPAN_ARGS ){ const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { unsigned long p; PACK_TRUECOLOR( p, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); XMesaPutPixel( img, x, y, p ); } } } else { /* draw all pixels */ for (i=0;i<n;i++,x++) { unsigned long p; PACK_TRUECOLOR( p, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); XMesaPutPixel( img, x, y, p ); } }}/* * Write a span of PF_TRUEDITHER pixels to an XImage. */static void put_row_TRUEDITHER_ximage( PUT_ROW_ARGS ){ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { unsigned long p; PACK_TRUEDITHER(p, x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); XMesaPutPixel( img, x, y, p ); } } } else { /* draw all pixels */ for (i=0;i<n;i++,x++) { unsigned long p; PACK_TRUEDITHER(p, x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); XMesaPutPixel( img, x, y, p ); } }}/* * Write a span of PF_TRUEDITHER pixels to an XImage (no alpha). */static void put_row_rgb_TRUEDITHER_ximage( RGB_SPAN_ARGS ){ const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { unsigned long p; PACK_TRUEDITHER(p, x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); XMesaPutPixel( img, x, y, p ); } } } else { /* draw all pixels */ for (i=0;i<n;i++,x++) { unsigned long p; PACK_TRUEDITHER(p, x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); XMesaPutPixel( img, x, y, p ); } }}/* * Write a span of PF_8A8B8G8R-format pixels to an ximage. */static void put_row_8A8B8G8R_ximage( PUT_ROW_ARGS ){ const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; GET_XRB(xrb); register GLuint i; register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); (void) ctx; if (mask) { for (i=0;i<n;i++) { if (mask[i]) { ptr[i] = PACK_8A8B8G8R( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ); } } } else { /* draw all pixels */ for (i=0;i<n;i++) { ptr[i] = PACK_8A8B8G8R( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ); } }}/* * Write a span of PF_8A8B8G8R-format pixels to an ximage (no alpha). */static void put_row_rgb_8A8B8G8R_ximage( RGB_SPAN_ARGS ){ const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; GET_XRB(xrb);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -