/*=====================================================================
FILE:  OEMBitmap_common.c

SERVICES:  OEMBitmap common functions

DESCRIPTION: Functions shared between OEMBitmap implementations

PUBLIC CLASSES: Not Applicable

INITIALIZATION AND SEQUENCING REQUIREMENTS: Not Applicable
        
        Copyright © 2003 QUALCOMM Incorporated.
               All Rights Reserved.
            QUALCOMM Proprietary/GTDR
=====================================================================*/

#include "OEMBitmap_priv.h"

int OEMBitmap_CopyMode(IBitmap *pDst, IBitmap *pSrc)
{
   int nErr;
   OEMBitmap *pbmSrc = NULL, *pbmDst = NULL;

   nErr = IBITMAP_QueryInterface(pSrc, AEEIID_OEMBITMAP, (void**)&pbmSrc);
   if (SUCCESS != nErr) {
      goto Done;
   }

   nErr = IBITMAP_QueryInterface(pDst, AEEIID_OEMBITMAP, (void**)&pbmDst);
   if (SUCCESS != nErr) {
      goto Done;
   }

   pbmDst->m_dib.pvt = pbmSrc->m_dib.pvt;
   pbmDst->m_IBitmapDev.pvt = pbmSrc->m_IBitmapDev.pvt;
   pbmDst->m_IBitmapCtl.pvt = pbmSrc->m_IBitmapCtl.pvt;
#if defined(IMPLEMENT_ITRANSFORM)
   pbmDst->m_ITransform.pvt = pbmSrc->m_ITransform.pvt;
#endif

   pbmDst->m_dib.nDepth = pbmSrc->m_dib.nDepth;
   pbmDst->m_dib.nColorScheme = pbmSrc->m_dib.nColorScheme;
   pbmDst->m_dib.nPitch = pbmSrc->m_dib.nPitch;

Done:
   if (NULL != pbmSrc) {
      IBITMAP_Release(OEMBITMAP_TO_IBITMAP(pbmSrc));
   }
   if (NULL != pbmDst) {
      IBITMAP_Release(OEMBITMAP_TO_IBITMAP(pbmDst));
   }

   return nErr;
}

