pWorkrow = pData->pWorkrow + 1;
pWorkrow = pData->pWorkrow + pData->iPixelofs;
mng_retcode process_idx1 (mng_datap pData){  mng_uint8p     pWorkrow;  mng_uint8p     pRGBArow;  mng_int32      iX;  mng_uint8      iB;  mng_uint8      iM;  mng_uint32     iS;  mng_uint8      iQ;  mng_imagedatap pBuf = (mng_imagedatap)pData->pStorebuf;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_PROCESS_IDX1, MNG_LC_START)#endif  if (!pBuf)                           /* no object? then use obj 0 */    pBuf = ((mng_imagep)pData->pObjzero)->pImgbuf;  pWorkrow = pData->pWorkrow + 1;      /* temporary work pointers */  pRGBArow = pData->pRGBArow;  iM       = 0;                        /* start at pixel 0 */  iB       = 0;  iS       = 0;  if (pBuf->bHasTRNS)                  /* tRNS encountered ? */  {    for (iX = 0; iX < pData->iRowsamples; iX++)    {      if (!iM)                         /* mask underflow ? */      {        iB = *pWorkrow;                /* get next input-byte */        pWorkrow++;        iM = 0x80;        iS = 7;      }                                       /* get the index */      iQ = (mng_uint8)((iB & iM) >> iS);                                       /* index valid ? */      if ((mng_uint32)iQ < pBuf->iPLTEcount)      {                                /* put in intermediate row */        *pRGBArow     = pBuf->aPLTEentries [iQ].iRed;        *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen;        *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue;                                       /* transparency for this index ? */        if ((mng_uint32)iQ < pBuf->iTRNScount)          *(pRGBArow+3) = pBuf->aTRNSentries [iQ];        else          *(pRGBArow+3) = 0xFF;      }      else        MNG_ERROR (pData, MNG_PLTEINDEXERROR)      pRGBArow += 4;                   /* next pixel */      iM >>= 1;      iS -= 1;    }    pData->bIsOpaque = MNG_FALSE;      /* it's not fully opaque */  }  else  {    for (iX = 0; iX < pData->iRowsamples; iX++)    {      if (!iM)                         /* mask underflow ? */      {        iB = *pWorkrow;                /* get next input-byte */        pWorkrow++;        iM = 0x80;        iS = 7;      }                                       /* get the index */      iQ = (mng_uint8)((iB & iM) >> iS);                                       /* index valid ? */      if ((mng_uint32)iQ < pBuf->iPLTEcount)      {                                /* put in intermediate row */        *pRGBArow     = pBuf->aPLTEentries [iQ].iRed;        *(pRGBArow+1) = pBuf->aPLTEentries [iQ].iGreen;        *(pRGBArow+2) = pBuf->aPLTEentries [iQ].iBlue;        *(pRGBArow+3) = 0xFF;      }      else        MNG_ERROR (pData, MNG_PLTEINDEXERROR)      pRGBArow += 4;                   /* next pixel */      iM >>= 1;      iS -= 1;    }    pData->bIsOpaque = MNG_TRUE;       /* it's fully opaque */  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_PROCESS_IDX1, MNG_LC_END)#endif  return MNG_NOERROR;}