{                                   pData->pDeltaImage       = (mng_ptr)pImage; pData->iDeltaImagetype   = iImagetype; pData->iDeltatype        = iDeltatype; pData->iDeltaBlockwidth  = iBlockwidth; pData->iDeltaBlockheight = iBlockheight; pData->iDeltaBlockx      = iBlockx; pData->iDeltaBlocky      = iBlocky;
{                                   if ((pImage->iMAGN_MethodX) || (pImage->iMAGN_MethodY)) { mng_retcode iRetcode = magnify_imageobject (pData, pImage);  if (iRetcode)                   return iRetcode; }  pData->pDeltaImage           = (mng_ptr)pImage; pData->iDeltaImagetype       = iImagetype; pData->iDeltatype            = iDeltatype; pData->iDeltaBlockwidth      = iBlockwidth; pData->iDeltaBlockheight     = iBlockheight; pData->iDeltaBlockx          = iBlockx; pData->iDeltaBlocky          = iBlocky;
mng_retcode process_display_dhdr (mng_datap  pData,                                  mng_uint16 iObjectid,                                  mng_uint8  iImagetype,                                  mng_uint8  iDeltatype,                                  mng_uint32 iBlockwidth,                                  mng_uint32 iBlockheight,                                  mng_uint32 iBlockx,                                  mng_uint32 iBlocky){  mng_imagep  pImage;  mng_retcode iRetcode;#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_START)#endif  pData->fInitrowproc     = 0;         /* do nothing by default */  pData->fDisplayrow      = 0;  pData->fCorrectrow      = 0;  pData->fStorerow        = 0;  pData->fProcessrow      = 0;  pData->pStoreobj        = 0;  pData->fDeltagetrow     = 0;  pData->fDeltaaddrow     = 0;  pData->fDeltareplacerow = 0;  pData->fDeltaputrow     = 0;  pImage = find_imageobject (pData, iObjectid);  if (pImage)                          /* object exists ? */  {    if (pImage->pImgbuf->bConcrete)    /* is it concrete ? */    {                                  /* save delta fields */      pData->pDeltaImage       = (mng_ptr)pImage;      pData->iDeltaImagetype   = iImagetype;      pData->iDeltatype        = iDeltatype;      pData->iDeltaBlockwidth  = iBlockwidth;      pData->iDeltaBlockheight = iBlockheight;      pData->iDeltaBlockx      = iBlockx;      pData->iDeltaBlocky      = iBlocky;                                       /* restore target-object fields */      pData->iDatawidth        = pImage->pImgbuf->iWidth;      pData->iDataheight       = pImage->pImgbuf->iHeight;      pData->iBitdepth         = pImage->pImgbuf->iBitdepth;      pData->iColortype        = pImage->pImgbuf->iColortype;      pData->iCompression      = pImage->pImgbuf->iCompression;      pData->iFilter           = pImage->pImgbuf->iFilter;      pData->iInterlace        = pImage->pImgbuf->iInterlace;                                       /* block size specified ? */      if (iDeltatype != MNG_DELTATYPE_NOCHANGE)      {        pData->iDatawidth      = iBlockwidth;        pData->iDataheight     = iBlockheight;      }      switch (iDeltatype)              /* determine nr of delta-channels */      {         case MNG_DELTATYPE_BLOCKALPHAADD : ;         case MNG_DELTATYPE_BLOCKALPHAREPLACE :              {                if (pData->iColortype == MNG_COLORTYPE_GRAYA)                  pData->iColortype = MNG_COLORTYPE_GRAY;                else                if (pData->iColortype == MNG_COLORTYPE_RGBA)                  pData->iColortype = MNG_COLORTYPE_GRAY;                else                   /* target has no alpha; that sucks! */                  MNG_ERROR (pData, MNG_TARGETNOALPHA)                break;              }         case MNG_DELTATYPE_BLOCKCOLORADD : ;         case MNG_DELTATYPE_BLOCKCOLORREPLACE :              {                if (pData->iColortype == MNG_COLORTYPE_GRAYA)                  pData->iColortype = MNG_COLORTYPE_GRAY;                else                if (pData->iColortype == MNG_COLORTYPE_RGBA)                  pData->iColortype = MNG_COLORTYPE_RGB;                else                   /* target has no alpha; that sucks! */                  MNG_ERROR (pData, MNG_TARGETNOALPHA)                break;              }      }                                       /* full image replace ? */      if (iDeltatype == MNG_DELTATYPE_REPLACE)      {        iRetcode = reset_object_details (pData, pImage,                                         pData->iDatawidth, pData->iDataheight,                                         pData->iBitdepth, pData->iColortype,                                         pData->iCompression, pData->iFilter,                                         pData->iInterlace, MNG_FALSE);        if (iRetcode)                  /* on error bail out */          return iRetcode;        pData->pStoreobj = pImage;     /* and store straight into this object */      }      else      {        mng_imagedatap pBufzero, pBuf;                                       /* we store in object 0 and process it later */        pData->pStoreobj = pData->pObjzero;                                       /* make sure to initialize object 0 then */        iRetcode = reset_object_details (pData, (mng_imagep)pData->pObjzero,                                         pData->iDatawidth, pData->iDataheight,                                         pData->iBitdepth, pData->iColortype,                                         pData->iCompression, pData->iFilter,                                         pData->iInterlace, MNG_TRUE);        if (iRetcode)                  /* on error bail out */          return iRetcode;        pBuf     = pImage->pImgbuf;    /* copy possible palette & cheap transparency */        pBufzero = ((mng_imagep)pData->pObjzero)->pImgbuf;        pBufzero->bHasPLTE = pBuf->bHasPLTE;        pBufzero->bHasTRNS = pBuf->bHasTRNS;        if (pBufzero->bHasPLTE)        /* copy palette ? */        {          mng_uint32 iX;          pBufzero->iPLTEcount = pBuf->iPLTEcount;          for (iX = 0; iX < pBuf->iPLTEcount; iX++)          {            pBufzero->aPLTEentries [iX].iRed   = pBuf->aPLTEentries [iX].iRed;            pBufzero->aPLTEentries [iX].iGreen = pBuf->aPLTEentries [iX].iGreen;            pBufzero->aPLTEentries [iX].iBlue  = pBuf->aPLTEentries [iX].iBlue;          }        }        if (pBufzero->bHasTRNS)        /* copy cheap transparency ? */        {          pBufzero->iTRNSgray  = pBuf->iTRNSgray;          pBufzero->iTRNSred   = pBuf->iTRNSred;          pBufzero->iTRNSgreen = pBuf->iTRNSgreen;          pBufzero->iTRNSblue  = pBuf->iTRNSblue;          pBufzero->iTRNScount = pBuf->iTRNScount;          MNG_COPY (pBufzero->aTRNSentries, pBuf->aTRNSentries,                    sizeof (pBufzero->aTRNSentries))        }                                       /* process immediatly if bitdepth & colortype are equal */        pData->bDeltaimmediate =          (mng_bool)((pData->iBitdepth  == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iBitdepth ) &&                     (pData->iColortype == ((mng_imagep)pData->pDeltaImage)->pImgbuf->iColortype)    );      }      switch (pData->iColortype)       /* determine row initialization routine */      {        case 0 : {                     /* gray */                   switch (pData->iBitdepth)                   {                     case  1 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_g1_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_g1_i;                                 break;                               }                     case  2 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_g2_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_g2_i;                                 break;                               }                     case  4 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_g4_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_g4_i;                                 break;                               }                     case  8 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_g8_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_g8_i;                                 break;                               }                     case 16 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_g16_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_g16_i;                                 break;                               }                   }                   break;                 }        case 2 : {                     /* rgb */                   switch (pData->iBitdepth)                   {                     case  8 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_rgb8_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_rgb8_i;                                 break;                               }                     case 16 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_rgb16_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_rgb16_i;                                 break;                               }                   }                   break;                 }        case 3 : {                     /* indexed */                   switch (pData->iBitdepth)                   {                     case  1 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_idx1_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_idx1_i;                                 break;                               }                     case  2 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_idx2_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_idx2_i;                                 break;                               }                     case  4 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_idx4_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_idx4_i;                                 break;                               }                     case  8 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_idx8_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_idx8_i;                                 break;                               }                   }                   break;                 }        case 4 : {                     /* gray+alpha */                   switch (pData->iBitdepth)                   {                     case  8 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_ga8_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_ga8_i;                                 break;                               }                     case 16 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_ga16_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_ga16_i;                                 break;                               }                   }                   break;                 }        case 6 : {                     /* rgb+alpha */                   switch (pData->iBitdepth)                   {                     case  8 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_rgba8_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_rgba8_i;                                 break;                               }                     case 16 : {                                 if (!pData->iInterlace)                                   pData->fInitrowproc = (mng_ptr)init_rgba16_ni;                                 else                                   pData->fInitrowproc = (mng_ptr)init_rgba16_i;                                 break;                               }                   }                   break;                 }      }    }    else      MNG_ERROR (pData, MNG_OBJNOTCONCRETE)  }  else    MNG_ERROR (pData, MNG_OBJECTUNKNOWN)#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_PROCESS_DISPLAY_DHDR, MNG_LC_END)#endif  return MNG_NOERROR;}