pData->iPass       = -1;          pData->iRow        = pData->iSourcet; pData->iRowinc     = 1; pData->iCol        = 0; pData->iColinc     = 1; pData->iRowsamples = pImage->pImgbuf->iWidth; pData->iRowsize    = pData->iRowsamples << 2; pData->bIsRGBA16   = MNG_FALSE;  if (pImage->pImgbuf->iBitdepth > 8) { pData->bIsRGBA16 = MNG_TRUE; pData->iRowsize  = pData->iRowsamples << 3; }  pData->fCorrectrow = 0;            #ifndef MNG_NO_CMS #if defined(MNG_FULL_CMS)               iRetcode = init_full_cms_object   (pData); #elif defined(MNG_GAMMA_ONLY) iRetcode = init_gamma_only_object (pData); #elif defined(MNG_APP_CMS) iRetcode = init_app_cms_object    (pData); #endif if (iRetcode)                     return iRetcode; #endif   MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize)  iY = pData->iSourcet;              while ((!iRetcode) && (iY < pData->iSourceb)) {                                 iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData);  if ((!iRetcode) && (pData->fCorrectrow)) iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);  if (!iRetcode)                  iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);  if (!iRetcode) iRetcode = next_row (pData);   iY++;                           }  MNG_FREE (pData, pData->pRGBArow, pData->iRowsize)  if (iRetcode)                     return iRetcode;
mng_retcode display_image (mng_datap  pData,                           mng_imagep pImage,                           mng_bool   bLayeradvanced){#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_DISPLAY_IMAGE, MNG_LC_START)#endif  pData->pRetrieveobj = pImage;        /* so retrieve-row and color-correction can find it */  if (!bLayeradvanced)                 /* need to advance the layer ? */  {    mng_imagep pSave    = pData->pCurrentobj;    pData->pCurrentobj  = pImage;    next_layer (pData);                /* advance to next layer */    pData->pCurrentobj  = pSave;  }  if (!pData->bTimerset)               /* all systems still go ? */  {    pData->iBreakpoint = 0;            /* let's make absolutely sure... */                                       /* anything to display ? */    if ((pData->iDestr >= pData->iDestl) && (pData->iDestb >= pData->iDestt))    {      mng_int32   iY;#ifdef MNG_NO_CMS      mng_retcode iRetcode = MNG_NOERROR;#else      mng_retcode iRetcode;#endif      set_display_routine (pData);     /* determine display routine */                                       /* and image-buffer retrieval routine */      switch (pImage->pImgbuf->iColortype)      {        case  0 : { if (pImage->pImgbuf->iBitdepth > 8)                      pData->fRetrieverow = (mng_ptr)retrieve_g16;                    else                      pData->fRetrieverow = (mng_ptr)retrieve_g8;                    pData->bIsOpaque      = (mng_bool)(!pImage->pImgbuf->bHasTRNS);                    break;                  }        case  2 : { if (pImage->pImgbuf->iBitdepth > 8)                      pData->fRetrieverow = (mng_ptr)retrieve_rgb16;                    else                      pData->fRetrieverow = (mng_ptr)retrieve_rgb8;                    pData->bIsOpaque      = (mng_bool)(!pImage->pImgbuf->bHasTRNS);                    break;                  }        case  3 : { pData->fRetrieverow   = (mng_ptr)retrieve_idx8;                    pData->bIsOpaque      = (mng_bool)(!pImage->pImgbuf->bHasTRNS);                    break;                  }        case  4 : { if (pImage->pImgbuf->iBitdepth > 8)                      pData->fRetrieverow = (mng_ptr)retrieve_ga16;                    else                      pData->fRetrieverow = (mng_ptr)retrieve_ga8;                    pData->bIsOpaque      = MNG_FALSE;                    break;                  }        case  6 : { if (pImage->pImgbuf->iBitdepth > 8)                      pData->fRetrieverow = (mng_ptr)retrieve_rgba16;                    else                      pData->fRetrieverow = (mng_ptr)retrieve_rgba8;                    pData->bIsOpaque      = MNG_FALSE;                    break;                  }        case  8 : { if (pImage->pImgbuf->iBitdepth > 8)                      pData->fRetrieverow = (mng_ptr)retrieve_g16;                    else                      pData->fRetrieverow = (mng_ptr)retrieve_g8;                    pData->bIsOpaque      = MNG_TRUE;                    break;                  }        case 10 : { if (pImage->pImgbuf->iBitdepth > 8)                      pData->fRetrieverow = (mng_ptr)retrieve_rgb16;                    else                      pData->fRetrieverow = (mng_ptr)retrieve_rgb8;                    pData->bIsOpaque      = MNG_TRUE;                    break;                  }        case 12 : { if (pImage->pImgbuf->iBitdepth > 8)                      pData->fRetrieverow = (mng_ptr)retrieve_ga16;                    else                      pData->fRetrieverow = (mng_ptr)retrieve_ga8;                    pData->bIsOpaque      = MNG_FALSE;                    break;                  }        case 14 : { if (pImage->pImgbuf->iBitdepth > 8)                      pData->fRetrieverow = (mng_ptr)retrieve_rgba16;                    else                      pData->fRetrieverow = (mng_ptr)retrieve_rgba8;                    pData->bIsOpaque      = MNG_FALSE;                    break;                  }      }      pData->iPass       = -1;         /* these are the object's dimensions now */      pData->iRow        = pData->iSourcet;      pData->iRowinc     = 1;      pData->iCol        = 0;      pData->iColinc     = 1;      pData->iRowsamples = pImage->pImgbuf->iWidth;      pData->iRowsize    = pData->iRowsamples << 2;      pData->bIsRGBA16   = MNG_FALSE;                                       /* adjust for 16-bit object ? */      if (pImage->pImgbuf->iBitdepth > 8)      {        pData->bIsRGBA16 = MNG_TRUE;        pData->iRowsize  = pData->iRowsamples << 3;      }      pData->fCorrectrow = 0;          /* default no color-correction */#ifndef MNG_NO_CMS#if defined(MNG_FULL_CMS)              /* determine color-management routine */      iRetcode = init_full_cms_object   (pData);#elif defined(MNG_GAMMA_ONLY)      iRetcode = init_gamma_only_object (pData);#elif defined(MNG_APP_CMS)      iRetcode = init_app_cms_object    (pData);#endif      if (iRetcode)                    /* on error bail out */        return iRetcode;#endif /* !MNG_NO_CMS */                                       /* get a temporary row-buffer */      MNG_ALLOC (pData, pData->pRGBArow, pData->iRowsize)      iY = pData->iSourcet;            /* this is where we start */      while ((!iRetcode) && (iY < pData->iSourceb))      {                                /* get a row */        iRetcode = ((mng_retrieverow)pData->fRetrieverow) (pData);                                       /* color correction ? */        if ((!iRetcode) && (pData->fCorrectrow))          iRetcode = ((mng_correctrow)pData->fCorrectrow) (pData);        if (!iRetcode)                 /* so... display it */          iRetcode = ((mng_displayrow)pData->fDisplayrow) (pData);        if (!iRetcode)          iRetcode = next_row (pData); /* adjust variables for next row */        iY++;                          /* and next line */      }                                       /* drop the temporary row-buffer */      MNG_FREE (pData, pData->pRGBArow, pData->iRowsize)      if (iRetcode)                    /* on error bail out */        return iRetcode;    }  }#ifdef MNG_SUPPORT_TRACE  MNG_TRACE (pData, MNG_FN_DISPLAY_IMAGE, MNG_LC_END)#endif  return MNG_NOERROR;                  /* whehehe, this is good ! */}