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

📄 xm_span.c

📁 mesa-6.5-minigui源码
💻 C
📖 第 1 页 / 共 5 页
字号:
      for (i=0;i<n;i++,x++) {         if (mask[i]) {            PACK_TRUEDITHER( ptr[i], x, y2, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );         }      }   }   else {      /* draw all pixels */#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */      GLuint *ptr32 = (GLuint *) ptr;      GLuint extraPixel = (n & 1);      n -= extraPixel;      for (i = 0; i < n; i += 2, x += 2) {         GLuint p0, p1;         PACK_TRUEDITHER( p0, x, y2, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );         PACK_TRUEDITHER( p1, x+1, y2, rgba[i+1][RCOMP], rgba[i+1][GCOMP], rgba[i+1][BCOMP] );         *ptr32++ = (p1 << 16) | p0;      }      if (extraPixel) {         PACK_TRUEDITHER( ptr[n], x+n, y2, rgba[n][RCOMP], rgba[n][GCOMP], rgba[n][BCOMP]);      }#else      for (i = 0; i < n; i++, x++) {         PACK_TRUEDITHER( ptr[i], x, y2, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]);      }#endif   }}/* * Write a span of PF_5R6G5B-format pixels to an ximage (no alpha). */static void put_row_rgb_5R6G5B_ximage( RGB_SPAN_ARGS ){   const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   register GLuint i;   register GLushort *ptr = PIXEL_ADDR2(xrb, x, y);   if (mask) {      for (i=0;i<n;i++) {         if (mask[i]) {            ptr[i] = PACK_5R6G5B( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );         }      }   }   else {      /* draw all pixels */#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */      GLuint *ptr32 = (GLuint *) ptr;      GLuint extraPixel = (n & 1);      n -= extraPixel;      for (i = 0; i < n; i += 2) {         GLuint p0, p1;         p0 = PACK_5R6G5B(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]);         p1 = PACK_5R6G5B(rgb[i+1][RCOMP], rgb[i+1][GCOMP], rgb[i+1][BCOMP]);         *ptr32++ = (p1 << 16) | p0;      }      if (extraPixel) {         ptr[n] = PACK_5R6G5B(rgb[n][RCOMP], rgb[n][GCOMP], rgb[n][BCOMP]);      }#else      for (i=0;i<n;i++) {         ptr[i] = PACK_5R6G5B( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );      }#endif   }}/* * Write a span of PF_DITHER_5R6G5B-format pixels to an ximage (no alpha). */static void put_row_rgb_DITHER_5R6G5B_ximage( RGB_SPAN_ARGS ){   const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   const XMesaContext xmesa = XMESA_CONTEXT(ctx);   register GLuint i;   register GLushort *ptr = PIXEL_ADDR2(xrb, x, y );   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            PACK_TRUEDITHER( ptr[i], x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );         }      }   }   else {      /* draw all pixels */#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */      GLuint *ptr32 = (GLuint *) ptr;      GLuint extraPixel = (n & 1);      n -= extraPixel;      for (i = 0; i < n; i += 2, x += 2) {         GLuint p0, p1;         PACK_TRUEDITHER( p0, x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );         PACK_TRUEDITHER( p1, x+1, y, rgb[i+1][RCOMP], rgb[i+1][GCOMP], rgb[i+1][BCOMP] );         *ptr32++ = (p1 << 16) | p0;      }      if (extraPixel) {         PACK_TRUEDITHER( ptr[n], x+n, y, rgb[n][RCOMP], rgb[n][GCOMP], rgb[n][BCOMP]);      }#else      for (i=0;i<n;i++,x++) {         PACK_TRUEDITHER( ptr[i], x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );      }#endif   }}/* * Write a span of PF_DITHER pixels to an XImage. */static void put_row_DITHER_ximage( PUT_ROW_ARGS ){   const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   XMesaImage *img = xrb->ximage;   register GLuint i;   int yy = YFLIP(xrb, y);   XDITHER_SETUP(yy);   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            XMesaPutPixel( img, x, yy, XDITHER( x, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) );         }      }   }   else {      /* draw all pixels */      for (i=0;i<n;i++,x++) {         XMesaPutPixel( img, x, yy, XDITHER( x, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) );      }   }}/* * Write a span of PF_DITHER pixels to an XImage (no alpha). */static void put_row_rgb_DITHER_ximage( RGB_SPAN_ARGS ){   const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   XMesaImage *img = xrb->ximage;   register GLuint i;   int yy = YFLIP(xrb, y);   XDITHER_SETUP(yy);   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            XMesaPutPixel( img, x, yy, XDITHER( x, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ) );         }      }   }   else {      /* draw all pixels */      for (i=0;i<n;i++,x++) {         XMesaPutPixel( img, x, yy, XDITHER( x, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ) );      }   }}/* * Write a span of 8-bit PF_DITHER pixels to an XImage. */static void put_row_DITHER8_ximage( PUT_ROW_ARGS ){   const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   register GLuint i;   register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y);   XDITHER_SETUP(y);   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            ptr[i] = (GLubyte) XDITHER( x, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );         }      }   }   else {      for (i=0;i<n;i++,x++) {         ptr[i] = (GLubyte) XDITHER( x, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );      }   }}static void put_row_rgb_DITHER8_ximage( RGB_SPAN_ARGS ){   const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   register GLuint i;   register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y);   XDITHER_SETUP(y);   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            ptr[i] = (GLubyte) XDITHER( x, rgb[i][0], rgb[i][1], rgb[i][2] );         }      }   }   else {      const GLubyte *data = (GLubyte *) rgb;      for (i=0;i<n;i++,x++) {         /*ptr[i] = XDITHER( x, rgb[i][0], rgb[i][1], rgb[i][2] );*/         ptr[i] = (GLubyte) XDITHER( x, data[i+i+i], data[i+i+i+1], data[i+i+i+2] );      }   }}/* * Write a span of PF_1BIT pixels to an XImage. */static void put_row_1BIT_ximage( PUT_ROW_ARGS ){   const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;   const XMesaContext xmesa = XMESA_CONTEXT(ctx);   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   XMesaImage *img = xrb->ximage;   register GLuint i;   SETUP_1BIT;   y = YFLIP(xrb, y);   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            XMesaPutPixel(img, x, y, DITHER_1BIT(x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]));         }      }   }   else {      for (i=0;i<n;i++,x++) {         XMesaPutPixel( img, x, y, DITHER_1BIT(x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]) );      }   }}/* * Write a span of PF_1BIT pixels to an XImage (no alpha). */static void put_row_rgb_1BIT_ximage( RGB_SPAN_ARGS ){   const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;   const XMesaContext xmesa = XMESA_CONTEXT(ctx);   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   XMesaImage *img = xrb->ximage;   register GLuint i;   SETUP_1BIT;   y = YFLIP(xrb, y);   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            XMesaPutPixel(img, x, y, DITHER_1BIT(x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]));         }      }   }   else {      for (i=0;i<n;i++,x++) {         XMesaPutPixel( img, x, y, DITHER_1BIT(x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]) );      }   }}/* * Write a span of PF_HPCR pixels to an XImage. */static void put_row_HPCR_ximage( PUT_ROW_ARGS ){   const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   const XMesaContext xmesa = XMESA_CONTEXT(ctx);   register GLuint i;   register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y);   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            ptr[i] = DITHER_HPCR( x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );         }      }   }   else {      /* draw all pixels */      for (i=0;i<n;i++,x++) {         ptr[i] = DITHER_HPCR( x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );      }   }}/* * Write a span of PF_HPCR pixels to an XImage (no alpha). */static void put_row_rgb_HPCR_ximage( RGB_SPAN_ARGS ){   const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   const XMesaContext xmesa = XMESA_CONTEXT(ctx);   register GLuint i;   register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y);   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            ptr[i] = DITHER_HPCR( x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );         }      }   }   else {      /* draw all pixels */      for (i=0;i<n;i++,x++) {         ptr[i] = DITHER_HPCR( x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );      }   }}/* * Write a span of PF_LOOKUP pixels to an XImage. */static void put_row_LOOKUP_ximage( PUT_ROW_ARGS ){   const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   XMesaImage *img = xrb->ximage;   register GLuint i;   LOOKUP_SETUP;   y = YFLIP(xrb, y);   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            XMesaPutPixel( img, x, y, LOOKUP( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) );         }      }   }   else {      /* draw all pixels */      for (i=0;i<n;i++,x++) {         XMesaPutPixel( img, x, y, LOOKUP( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) );      }   }}/* * Write a span of PF_LOOKUP pixels to an XImage (no alpha). */static void put_row_rgb_LOOKUP_ximage( RGB_SPAN_ARGS ){   const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   XMesaImage *img = xrb->ximage;   register GLuint i;   LOOKUP_SETUP;   y = YFLIP(xrb, y);   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            XMesaPutPixel( img, x, y, LOOKUP( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ) );         }      }   }   else {      /* draw all pixels */      for (i=0;i<n;i++,x++) {         XMesaPutPixel( img, x, y, LOOKUP( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ) );      }   }}/* * Write a span of 8-bit PF_LOOKUP pixels to an XImage. */static void put_row_LOOKUP8_ximage( PUT_ROW_ARGS ){   const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   register GLuint i;   register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y);   LOOKUP_SETUP;   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            ptr[i] = (GLubyte) LOOKUP( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );         }      }   }   else {      /* draw all pixels */      for (i=0;i<n;i++,x++) {         ptr[i] = (GLubyte) LOOKUP( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );      }   }}static void put_row_rgb_LOOKUP8_ximage( RGB_SPAN_ARGS ){   const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;   struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb;   register GLuint i;   register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y);   LOOKUP_SETUP;   if (mask) {      for (i=0;i<n;i++,x++) {         if (mask[i]) {            ptr[i] = (GLubyte) LOOKUP( rgb[i][0], rgb[i][1], rgb[i][2] );         }      }   }   else {      /* draw all pixels */      const GLubyte *data = (GLubyte *) rgb;      for (i=0;i<n;i++,x++) {         /*ptr[i] = LOOKUP( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );*/         ptr[i] = (GLubyte) LOOKUP( data[i+i+i], data[i+

⌨️ 快捷键说明

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