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

📄 texstore.c

📁 mesa-6.5-minigui源码
💻 C
📖 第 1 页 / 共 5 页
字号:
       !srcPacking->SwapBytes &&       baseInternalFormat == GL_RGB &&       srcFormat == GL_BGR &&       srcType == GL_UNSIGNED_BYTE &&       littleEndian) {      /* simple memcpy path */      memcpy_texture(ctx, dims,                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,                     dstRowStride, dstImageStride,                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,                     srcAddr, srcPacking);   }   else if (!ctx->_ImageTransferState &&            !srcPacking->SwapBytes &&            srcFormat == GL_RGBA &&            srcType == GL_UNSIGNED_BYTE) {      /* extract RGB from RGBA */      int img, row, col;      GLubyte *dstImage = (GLubyte *) dstAddr                        + dstZoffset * dstImageStride                        + dstYoffset * dstRowStride                        + dstXoffset * dstFormat->TexelBytes;      for (img = 0; img < srcDepth; img++) {         const GLint srcRowStride = _mesa_image_row_stride(srcPacking,                                                 srcWidth, srcFormat, srcType);         GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,                  srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);         GLubyte *dstRow = dstImage;         for (row = 0; row < srcHeight; row++) {            for (col = 0; col < srcWidth; col++) {               dstRow[col * 3 + 0] = srcRow[col * 4 + BCOMP];               dstRow[col * 3 + 1] = srcRow[col * 4 + GCOMP];               dstRow[col * 3 + 2] = srcRow[col * 4 + RCOMP];            }            dstRow += dstRowStride;            srcRow += srcRowStride;         }         dstImage += dstImageStride;      }   }   else {      /* general path */      const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,                                                 baseInternalFormat,                                                 dstFormat->BaseFormat,                                                 srcWidth, srcHeight, srcDepth,                                                 srcFormat, srcType, srcAddr,                                                 srcPacking);      const GLchan *src = (const GLchan *) tempImage;      GLubyte *dstImage = (GLubyte *) dstAddr                        + dstZoffset * dstImageStride                        + dstYoffset * dstRowStride                        + dstXoffset * dstFormat->TexelBytes;      GLint img, row, col;      if (!tempImage)         return GL_FALSE;      _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);      for (img = 0; img < srcDepth; img++) {         GLubyte *dstRow = dstImage;         for (row = 0; row < srcHeight; row++) {#if 0            if (littleEndian) {               for (col = 0; col < srcWidth; col++) {                  dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]);                  dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]);                  dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[BCOMP]);                  srcUB += 3;               }            }            else {               for (col = 0; col < srcWidth; col++) {                  dstRow[col * 3 + 0] = srcUB[BCOMP];                  dstRow[col * 3 + 1] = srcUB[GCOMP];                  dstRow[col * 3 + 2] = srcUB[RCOMP];                  srcUB += 3;               }            }#else            for (col = 0; col < srcWidth; col++) {               dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[BCOMP]);               dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]);               dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[RCOMP]);               src += 3;            }#endif            dstRow += dstRowStride;         }         dstImage += dstImageStride;      }      _mesa_free((void *) tempImage);   }   return GL_TRUE;}GLboolean_mesa_texstore_bgr888(STORE_PARAMS){   const GLuint ui = 1;   const GLubyte littleEndian = *((const GLubyte *) &ui);   ASSERT(dstFormat == &_mesa_texformat_bgr888);   ASSERT(dstFormat->TexelBytes == 3);   if (!ctx->_ImageTransferState &&       !srcPacking->SwapBytes &&       baseInternalFormat == GL_RGB &&       srcFormat == GL_RGB &&       srcType == GL_UNSIGNED_BYTE &&       littleEndian) {      /* simple memcpy path */      memcpy_texture(ctx, dims,                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,                     dstRowStride, dstImageStride,                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,                     srcAddr, srcPacking);   }   else if (!ctx->_ImageTransferState &&            !srcPacking->SwapBytes &&            srcFormat == GL_RGBA &&            srcType == GL_UNSIGNED_BYTE) {      /* extract BGR from RGBA */      int img, row, col;      GLubyte *dstImage = (GLubyte *) dstAddr                        + dstZoffset * dstImageStride                        + dstYoffset * dstRowStride                        + dstXoffset * dstFormat->TexelBytes;      for (img = 0; img < srcDepth; img++) {         const GLint srcRowStride = _mesa_image_row_stride(srcPacking,                                                 srcWidth, srcFormat, srcType);         GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking,                  srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);         GLubyte *dstRow = dstImage;         for (row = 0; row < srcHeight; row++) {            for (col = 0; col < srcWidth; col++) {               dstRow[col * 3 + 0] = srcRow[col * 4 + RCOMP];               dstRow[col * 3 + 1] = srcRow[col * 4 + GCOMP];               dstRow[col * 3 + 2] = srcRow[col * 4 + BCOMP];            }            dstRow += dstRowStride;            srcRow += srcRowStride;         }         dstImage += dstImageStride;      }   }   else {      /* general path */      const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,                                                 baseInternalFormat,                                                 dstFormat->BaseFormat,                                                 srcWidth, srcHeight, srcDepth,                                                 srcFormat, srcType, srcAddr,                                                 srcPacking);      const GLchan *src = (const GLchan *) tempImage;      GLubyte *dstImage = (GLubyte *) dstAddr                        + dstZoffset * dstImageStride                        + dstYoffset * dstRowStride                        + dstXoffset * dstFormat->TexelBytes;      GLint img, row, col;      if (!tempImage)         return GL_FALSE;      _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);      for (img = 0; img < srcDepth; img++) {         GLubyte *dstRow = dstImage;         for (row = 0; row < srcHeight; row++) {            for (col = 0; col < srcWidth; col++) {               dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]);               dstRow[col * 3 + 1] = CHAN_TO_UBYTE(src[GCOMP]);               dstRow[col * 3 + 2] = CHAN_TO_UBYTE(src[BCOMP]);               src += 3;            }            dstRow += dstRowStride;         }         dstImage += dstImageStride;      }      _mesa_free((void *) tempImage);   }   return GL_TRUE;}GLboolean_mesa_texstore_argb4444(STORE_PARAMS){   ASSERT(dstFormat == &_mesa_texformat_argb4444 ||          dstFormat == &_mesa_texformat_argb4444_rev);   ASSERT(dstFormat->TexelBytes == 2);   if (!ctx->_ImageTransferState &&       !srcPacking->SwapBytes &&       dstFormat == &_mesa_texformat_argb4444 &&       baseInternalFormat == GL_RGBA &&       srcFormat == GL_BGRA &&       srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) {      /* simple memcpy path */      memcpy_texture(ctx, dims,                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,                     dstRowStride, dstImageStride,                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,                     srcAddr, srcPacking);   }   else {      /* general path */      const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,                                                 baseInternalFormat,                                                 dstFormat->BaseFormat,                                                 srcWidth, srcHeight, srcDepth,                                                 srcFormat, srcType, srcAddr,                                                 srcPacking);      const GLchan *src = tempImage;      GLubyte *dstImage = (GLubyte *) dstAddr                        + dstZoffset * dstImageStride                        + dstYoffset * dstRowStride                        + dstXoffset * dstFormat->TexelBytes;      GLint img, row, col;      if (!tempImage)         return GL_FALSE;      _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);      for (img = 0; img < srcDepth; img++) {         GLubyte *dstRow = dstImage;         for (row = 0; row < srcHeight; row++) {            GLushort *dstUS = (GLushort *) dstRow;            if (dstFormat == &_mesa_texformat_argb4444) {               for (col = 0; col < srcWidth; col++) {                  dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[ACOMP]),                                                CHAN_TO_UBYTE(src[RCOMP]),                                                CHAN_TO_UBYTE(src[GCOMP]),                                                CHAN_TO_UBYTE(src[BCOMP]) );                  src += 4;               }            }            else {               for (col = 0; col < srcWidth; col++) {                  dstUS[col] = PACK_COLOR_4444_REV( CHAN_TO_UBYTE(src[ACOMP]),                                                    CHAN_TO_UBYTE(src[RCOMP]),                                                    CHAN_TO_UBYTE(src[GCOMP]),                                                    CHAN_TO_UBYTE(src[BCOMP]) );                  src += 4;               }            }            dstRow += dstRowStride;         }         dstImage += dstImageStride;      }      _mesa_free((void *) tempImage);   }   return GL_TRUE;}GLboolean_mesa_texstore_argb1555(STORE_PARAMS){   ASSERT(dstFormat == &_mesa_texformat_argb1555 ||          dstFormat == &_mesa_texformat_argb1555_rev);   ASSERT(dstFormat->TexelBytes == 2);   if (!ctx->_ImageTransferState &&       !srcPacking->SwapBytes &&       dstFormat == &_mesa_texformat_argb1555 &&       baseInternalFormat == GL_RGBA &&       srcFormat == GL_BGRA &&       srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) {      /* simple memcpy path */      memcpy_texture(ctx, dims,                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,                     dstRowStride, dstImageStride,                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,                     srcAddr, srcPacking);   }   else {      /* general path */      const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims,                                                 baseInternalFormat,                                                 dstFormat->BaseFormat,                                                 srcWidth, srcHeight, srcDepth,                                                 srcFormat, srcType, srcAddr,                                                 srcPacking);      const GLchan *src =tempImage;      GLubyte *dstImage = (GLubyte *) dstAddr                        + dstZoffset * dstImageStride                        + dstYoffset * dstRowStride                        + dstXoffset * dstFormat->TexelBytes;      GLint img, row, col;      if (!tempImage)         return GL_FALSE;      _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);      for (img = 0; img < srcDepth; img++) {         GLubyte *dstRow = dstImage;         for (row = 0; row < srcHeight; row++) {            GLushort *dstUS = (GLushort *) dstRow;            if (dstFormat == &_mesa_texformat_argb1555) {               for (col = 0; col < srcWidth; col++) {                  dstUS[col] = PACK_COLOR_1555( CHAN_TO_UBYTE(src[ACOMP]),                                                CHAN_TO_UBYTE(src[RCOMP]),                                                CHAN_TO_UBYTE(src[GCOMP]),                                                CHAN_TO_UBYTE(src[BCOMP]) );                  src += 4;               }            }            else {               for (col = 0; col < srcWidth; col++) {                  dstUS[col] = PACK_COLOR_1555_REV( CHAN_TO_UBYTE(src[ACOMP]),                                                    CHAN_TO_UBYTE(src[RCOMP]),                                                    CHAN_TO_UBYTE(src[GCOMP]),                                                    CHAN_TO_UBYTE(src[BCOMP]) );                  src += 4;               }            }            dstRow += dstRowStride;         }         dstImage += dstImageStride;      }      _mesa_free((void *) tempImage);   }   return GL_TRUE;}GLboolean_mesa_texstore_al88(STORE_PARAMS){   const GLuint ui = 1;   const GLubyte littleEndian = *((const GLubyte *) &ui);   ASSERT(dstFormat == &_mesa_texformat_al88 ||          dstFormat == &_mesa_texformat_al88_rev);   ASSERT(dstFormat->TexelBytes == 2);   if (!ctx->_ImageTransferState &&       !srcPacking->SwapBytes &&       dstFormat == &_mesa_texformat_al88 &&       baseInternalFormat == GL_LUMINANCE_ALPHA &&       srcFormat == GL_LUMINANCE_ALPHA &&       srcType == GL_UNSIGNED_BYTE &&       littleEndian) {      /* simple memcpy path */      memcpy_texture(ctx, dims,                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,                     dstRowStride, dstImageStride,                     srcWidth, srcHeight, srcDepth, srcForma

⌨️ 快捷键说明

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