unixroot.cpp
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:20k
源码类别:

Symbian

开发平台:

Visual C++

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Source last modified: $Id: unixroot.cpp,v 1.3.4.2 2004/07/09 12:48:45 pankajgupta Exp $
  3.  * 
  4.  * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
  5.  * 
  6.  * The contents of this file, and the files included with this file,
  7.  * are subject to the current version of the RealNetworks Public
  8.  * Source License (the "RPSL") available at
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed
  10.  * the file under the current version of the RealNetworks Community
  11.  * Source License (the "RCSL") available at
  12.  * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
  13.  * will apply. You may also obtain the license terms directly from
  14.  * RealNetworks.  You may not use this file except in compliance with
  15.  * the RPSL or, if you have a valid RCSL with RealNetworks applicable
  16.  * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
  17.  * the rights, obligations and limitations governing use of the
  18.  * contents of the file.
  19.  * 
  20.  * Alternatively, the contents of this file may be used under the
  21.  * terms of the GNU General Public License Version 2 or later (the
  22.  * "GPL") in which case the provisions of the GPL are applicable
  23.  * instead of those above. If you wish to allow use of your version of
  24.  * this file only under the terms of the GPL, and not to allow others
  25.  * to use your version of this file under the terms of either the RPSL
  26.  * or RCSL, indicate your decision by deleting the provisions above
  27.  * and replace them with the notice and other provisions required by
  28.  * the GPL. If you do not delete the provisions above, a recipient may
  29.  * use your version of this file under the terms of any one of the
  30.  * RPSL, the RCSL or the GPL.
  31.  * 
  32.  * This file is part of the Helix DNA Technology. RealNetworks is the
  33.  * developer of the Original Code and owns the copyrights in the
  34.  * portions it created.
  35.  * 
  36.  * This file, and the files included with this file, is distributed
  37.  * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
  38.  * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
  39.  * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
  40.  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
  41.  * ENJOYMENT OR NON-INFRINGEMENT.
  42.  * 
  43.  * Technology Compatibility Kit Test Suite(s) Location:
  44.  *    http://www.helixcommunity.org/content/tck
  45.  * 
  46.  * Contributor(s):
  47.  * 
  48.  * ***** END LICENSE BLOCK ***** */
  49. // for shared memory
  50. #include <sys/types.h>
  51. #include <sys/ipc.h>
  52. #include <sys/shm.h>
  53. #include <sys/utsname.h>
  54. #include "hxcom.h"
  55. #include "hxwintyp.h"
  56. #include "hxvsurf.h"
  57. #include "hxslist.h"
  58. #include "colormap.h"
  59. #include "hxprefs.h"
  60. #include "hxtick.h"
  61. #include "hxthread.h"
  62. #include "basesite.h"
  63. #include "unixroot.h"
  64. #include "unixsite.h"
  65. #include "unixcmap.h"
  66. #include "shmhelp.h"
  67. //  #ifdef _DEBUG
  68. //  #include <X11/extensions/xf86vmode.h> //for debug video sync rates..
  69. //  #endif
  70. //Work around AIX problem.
  71. #ifdef _AIX
  72. #  define MAX_SHARED_REGIONS ((UINT32)1)
  73. #else
  74. #  define MAX_SHARED_REGIONS ((UINT32)9999)
  75. #endif
  76. CUnixRootSurf::CUnixRootSurf(IUnknown* pContext, CHXBaseSite* pSite )
  77.    : CBaseRootSurface(pContext, pSite)
  78.    , m_bUseShm(FALSE)
  79.    , m_nShmId(0)
  80.    , m_pDisplay(NULL)
  81.    , m_GC(0)
  82.    , m_nScreenNumber(0)
  83.    , m_pXImage(NULL)
  84.    , m_pVisual(NULL)
  85.    , m_unDepth(0)
  86.    , m_pScreen(NULL)
  87.    , m_pYUVScratchBits(NULL)
  88.    , m_nYUVScratchPitch(0)
  89.    , m_pScratchBits(NULL)
  90.    , m_nScratchPitch(0)
  91.    , m_nBitsPerPixel(0)
  92.    , m_nCompositionSize(0)
  93. {
  94. }
  95. HX_RESULT CUnixRootSurf::Init()
  96. {
  97.    //get window and display from main Site.
  98.    HXxWindow* pWindow = m_pSite->GetWindow();
  99.    HX_ASSERT(pWindow);
  100.    m_pDisplay = (Display*)pWindow->display;
  101.    m_window   = (Window)pWindow->window;
  102.     
  103.    HX_ASSERT( m_pDisplay );
  104.    HX_ASSERT( m_window );
  105.    //
  106.    // Now see if our X11 server supports the Shared Memory extension.
  107.    //
  108.    ShmHelp::Init(m_pDisplay);
  109.    m_bUseShm = ShmHelp::ShmAvailable();
  110.    
  111.    //Create the graphics context 
  112.    XGCValues values;
  113.  
  114.    XLockDisplay(m_pDisplay);  
  115.    m_GC = XCreateGC(m_pDisplay, m_window, 0, &values);
  116.    
  117.     //Get X window attributes & visual
  118.    XWindowAttributes attr;
  119.    XGetWindowAttributes(m_pDisplay, m_window, &attr);
  120.    XUnlockDisplay(m_pDisplay);
  121.    m_pVisual = attr.visual;
  122.    // get visual info & depth 
  123.    int nv=0;
  124.    XVisualInfo visInfo;
  125.    memset(&visInfo, 0, sizeof(XVisualInfo));
  126.    XLockDisplay(m_pDisplay);
  127.    visInfo.visualid = XVisualIDFromVisual(m_pVisual);
  128.    XVisualInfo* pVisualInfo = XGetVisualInfo (m_pDisplay, VisualIDMask, &visInfo, &nv);
  129.    m_unDepth       = pVisualInfo->depth;
  130.    m_nScreenNumber = DefaultScreen(m_pDisplay);
  131.    m_pScreen       = XScreenOfDisplay(m_pDisplay, m_nScreenNumber);
  132.    XUnlockDisplay(m_pDisplay);
  133.    m_colormap      = HXGetXColormap(m_pDisplay, m_window);
  134.    // get pixmap (blt) information for the best depth we can display
  135.    int i=0;
  136.    int nNum=0;
  137.    XLockDisplay(m_pDisplay);
  138.    XPixmapFormatValues *pixmap_formats = XListPixmapFormats(m_pDisplay, &nNum);
  139.    XUnlockDisplay(m_pDisplay);
  140.    if(pixmap_formats) 
  141.    {
  142.       for (i=0 ; i<nNum; i++)
  143.       {
  144.          if (pixmap_formats[i].depth == m_unDepth)
  145.          {
  146.             m_nBitsPerPixel = pixmap_formats[i].bits_per_pixel;
  147.          }
  148.       }
  149.       XFree(pixmap_formats);
  150.       pixmap_formats = NULL;
  151.    }
  152.    memset(&m_bmiSave, 0, sizeof(HXBitmapInfo));
  153.    m_bmiSave.bmiHeader.biBitCount    = m_nBitsPerPixel;
  154.    m_bmiSave.bmiHeader.biCompression = (m_unDepth==8 ? BI_RGB : BI_BITFIELDS);
  155.    m_bmiSave.un.dwBitMask[0]         = pVisualInfo->red_mask;
  156.    m_bmiSave.un.dwBitMask[1]         = pVisualInfo->green_mask;
  157.    m_bmiSave.un.dwBitMask[2]         = pVisualInfo->blue_mask;
  158.    //Set primary surface CID.
  159.    m_nCompositionSurfaceCID = GetBitmapColor(&m_bmiSave);
  160.    XFree( pVisualInfo );
  161. //  #ifdef _DEBUG
  162. //     //Lets find out what Hsync and Vsync rates we have for this display.
  163. //     //Ripped from xvidtune.c
  164. //     XF86VidModeModeLine mode_line;
  165. //     int    scrn=0; 
  166. //     int    dot_clock;
  167. //     double vsync_hz, HSyncRate,HTotal, VTotal, PixelClock;
  168. //     if(XF86VidModeGetModeLine(m_pDisplay, scrn, &dot_clock, &mode_line))
  169. //     {
  170. //        PixelClock=dot_clock;
  171. //        HTotal = mode_line.htotal;
  172. //        VTotal = mode_line.vtotal;
  173. //        HSyncRate = PixelClock*1000.0/HTotal;
  174. //        vsync_hz = HSyncRate/VTotal;
  175. //        fprintf( stderr, "This Display's Hsync rate is: %f and Vsync: %fn",
  176. //                 HSyncRate, vsync_hz );
  177. //     }
  178.    
  179. //  #endif
  180.    
  181.    return HXR_OK;
  182. }
  183. CUnixRootSurf::~CUnixRootSurf()
  184. {
  185.    _DestroyCompositionSurface();
  186.    if( m_GC )
  187.    {
  188.       XLockDisplay(m_pDisplay);
  189.       XFreeGC( m_pDisplay, m_GC );
  190.       XUnlockDisplay(m_pDisplay);
  191.       m_GC=0;
  192.    }
  193.    if (m_pVisual)
  194.    {
  195.       /* PJG: don't have to free visuals */
  196.       m_pVisual = NULL;
  197.    }
  198.    
  199.    if(m_bUseShm)
  200.    {
  201.       if( m_pCompositionSurface != NULL )
  202.          ShmHelp::DetachSharedRegion(&m_pCompositionSurface, &m_shmInfo);
  203.    }
  204.    else
  205.    {
  206.       HX_DELETE(m_pCompositionSurface);
  207.       m_nCompositionSize=0;
  208.       m_bCompositionSurfaceCreated=FALSE;
  209.    }
  210.    
  211.    //XXXgfw any more clean up for these two?
  212.    HX_VECTOR_DELETE( m_pScratchBits );
  213.    HX_VECTOR_DELETE( m_pYUVScratchBits );
  214. }
  215. HX_RESULT CUnixRootSurf::_ResizeVideoBuffer( INT32 nSize)
  216. {
  217.    HX_RESULT retVal=HXR_OK;
  218.    if(nSize <= m_nCompositionSize)
  219.       return retVal;
  220.    if(m_bUseShm) 
  221.    {
  222.       if( m_pCompositionSurface != NULL )
  223.          retVal = ShmHelp::DetachSharedRegion(&m_pCompositionSurface, &m_shmInfo);
  224.       if( retVal==HXR_OK )
  225.       {
  226.          retVal = ShmHelp::CreateSharedRegion( nSize,
  227.                                                &m_pCompositionSurface,
  228.                                                &m_nShmId,
  229.                                                &m_shmInfo
  230.                                                );
  231.          
  232.       }
  233.       if( retVal != HXR_OK )
  234.       {
  235.          m_bCompositionSurfaceCreated = FALSE;
  236.          m_nCompositionSize           = 0;
  237.          m_bUseShm = FALSE;
  238.       }
  239.       else
  240.       {
  241.          //It all worked
  242.          m_nCompositionSize           = nSize;
  243.          m_bCompositionSurfaceCreated = TRUE;
  244.          return retVal;
  245.       }
  246.       
  247.    }
  248.    //We need to fall through here so that if the shared memory stuff
  249.    //above fails we can create it the old fashioned way.
  250.    if(m_pCompositionSurface == NULL)
  251.    {
  252.       m_pCompositionSurface = (UCHAR*) malloc(nSize);
  253.    }
  254.    else
  255.    {
  256.       m_pCompositionSurface = (UCHAR*) realloc(m_pCompositionSurface, nSize);
  257.    }
  258.    if( m_pCompositionSurface )
  259.    {
  260.       m_nCompositionSize = nSize;
  261.    }
  262.    else
  263.    {
  264.       HX_ASSERT("We can't alloc the composition surface." == NULL );
  265.       m_nCompositionSize = 0;
  266.    }
  267.    return retVal;
  268. }
  269. HX_RESULT CUnixRootSurf::_DebugBlt( UCHAR* pImageData, HXBitmapInfoHeader* pBitmapInfo,
  270.                      HXxRect& rDestRect, HXxRect& rSrcRect)
  271. {
  272.    HX_ASSERT( m_window );
  273.    HX_ASSERT( m_pDisplay );
  274.    HX_ASSERT( m_GC );
  275.    XLockDisplay(m_pDisplay);
  276.    XSetForeground( m_pDisplay, m_GC, WhitePixel(m_pDisplay, 0 ));
  277.    XSetBackground( m_pDisplay, m_GC, BlackPixel(m_pDisplay, 0 ));
  278.    XSetLineAttributes(m_pDisplay, m_GC, 5, LineSolid, CapRound, JoinRound );
  279.    XSetForeground( m_pDisplay, m_GC, WhitePixel(m_pDisplay, 0) );
  280.    XFillRectangle( m_pDisplay, m_window, m_GC,
  281.                    rDestRect.left, rDestRect.top,
  282.                    rDestRect.right-rDestRect.left,
  283.                    rDestRect.bottom-rDestRect.top
  284.                    );
  285.    XDrawRectangle( m_pDisplay, m_window, m_GC,
  286.                    rDestRect.left, rDestRect.top,
  287.                    rDestRect.right-rDestRect.left,
  288.                    rDestRect.bottom-rDestRect.top
  289.                    );
  290.    XUnlockDisplay(m_pDisplay);
  291.    return HXR_OK;
  292. }
  293. void CUnixRootSurf::_GetYUVScratchWidthHeight(UINT32* pWidth, UINT32* pHeight)
  294. {
  295.    *pWidth     = m_bmiYUVScratch.bmiHeader.biWidth;
  296.    *pHeight    = m_bmiYUVScratch.bmiHeader.biHeight;
  297. }
  298. XImage* CUnixRootSurf::_GetCompositionSurfaceDrawable()
  299. {
  300.    return m_pXImage;
  301. }
  302. //Not used except for XING.....
  303. void CUnixRootSurf::_CreateYUVScratchSurface(UINT32 width, UINT32 height)
  304. {
  305.    //Remove old bits....
  306.    HX_DELETE(m_pYUVScratchBits);
  307.    //Clear BitmapInfo struct....
  308.    memset(&m_bmiYUVScratch, 0, sizeof(HXBitmapInfo));
  309.    int nResult = MakeBitmap( &m_bmiYUVScratch,
  310.                              sizeof(m_bmiYUVScratch),
  311.                              CID_YUY2,
  312.                              width,
  313.                              height,
  314.                              NULL,
  315.                              0);
  316.    if( nResult )
  317.    {
  318.       m_pYUVScratchBits  = new UCHAR[m_bmiYUVScratch.bmiHeader.biSizeImage];
  319.       m_nYUVScratchPitch = GetBitmapPitch(&m_bmiYUVScratch);
  320.    }
  321. }
  322. void CUnixRootSurf::_GetYUVScratchSurfacePointer(UCHAR** pYUVBits, INT32* YUVPitch)
  323. {
  324.    *pYUVBits = m_pYUVScratchBits;
  325.    *YUVPitch = m_nYUVScratchPitch;
  326. }
  327. HX_RESULT CUnixRootSurf::CreateScratchSurface( int nCompositionSurfaceCID, HXxSize* pSize)
  328. {
  329.    //Remove old bits....
  330.    HX_DELETE(m_pScratchBits);
  331.    
  332.    //Clear BitmapInfo struct....
  333.    memset(&m_bmiScratch, 0, sizeof(HXBitmapInfo));
  334.    int nResult = MakeBitmap( &m_bmiScratch,
  335.                              sizeof(m_bmiScratch),
  336.                              nCompositionSurfaceCID,
  337.                              pSize->cx,
  338.                              pSize->cy,
  339.                              NULL,
  340.                              0);
  341.    if( nResult )
  342.    {
  343.       m_pScratchBits  = new UCHAR[m_bmiScratch.bmiHeader.biSizeImage];
  344.       m_nScratchPitch = GetBitmapPitch(&m_bmiScratch);
  345.    }
  346.    return nResult? HXR_OK : HXR_FAIL;
  347. }
  348. HX_RESULT CUnixRootSurf::ScratchLock(UCHAR** pBits, INT32* pPitch)
  349. {
  350.    *pBits  = m_pScratchBits;
  351.    *pPitch = m_nScratchPitch;
  352.    return HXR_OK;
  353. }
  354. HX_RESULT CUnixRootSurf::ScratchUnlock(UCHAR* pBits)
  355. {
  356.    return HXR_OK;
  357. }
  358. HX_RESULT CUnixRootSurf::_MinimalUnlock(HXxWindow* pWindow)
  359. {
  360. //     Window win = m_window;
  361. //     HX_ASSERT(win);
  362. //     HXxSize hxxSize;
  363. //     m_pSite->GetSize(hxxSize);
  364.    
  365. //     if (m_bUseShm)
  366. //     {
  367. //        XShmPutImage(m_pDisplay,
  368. //                     win,
  369. //                     m_GC,
  370. //                     m_pXImage,
  371. //                     0, 
  372. //                     0,
  373. //                     0,
  374. //                     0,
  375. //                     hxxSize.cx,      
  376. //                     hxxSize.cy,
  377. //                     False
  378. //                     );
  379. //     }
  380. //     else
  381. //     {
  382. //        XPutImage(m_pDisplay,
  383. //                  win,
  384. //                  m_GC,
  385. //                  m_pXImage,
  386. //                  0, 
  387. //                  0,
  388. //                  0,
  389. //                  0,
  390. //                  hxxSize.cx,
  391. //                  hxxSize.cy
  392. //                  );
  393. //     }
  394.      return HXR_OK;
  395. }
  396. HX_RESULT CUnixRootSurf::_LockComposition(UCHAR** pBits, INT32* pPitch)
  397. {
  398.    HX_RESULT retVal = HXR_OK;
  399.    if( !m_bCompositionSurfaceCreated || m_pCompositionSurface==NULL )
  400.    {
  401.       retVal = _CreateCompositionSurface();
  402.    }
  403.    HX_ASSERT( m_pCompositionSurface );
  404.    *pBits  = m_pCompositionSurface;
  405.    *pPitch = m_nCompositionPitch;
  406.    return HXR_OK;
  407. }
  408. void CUnixRootSurf::_BltFromScratchToComposition( HXxRect& rDestRect, HXxRect& rSrcRect)
  409. {
  410.    HX_ASSERT( "Not implemented on unix yet...."==NULL );
  411. }
  412. HX_RESULT CUnixRootSurf::_CreateCompositionSurface()
  413. {
  414.    HX_RESULT retVal = HXR_FAIL;
  415.    if(m_bCompositionSurfaceCreated)
  416.    {
  417.       return HXR_OK;
  418.    }
  419.    HX_ASSERT( !m_bCompositionSurfaceCreated );
  420.    HX_ASSERT( m_pSite );
  421.    //Create a BMI to describe the composition surface
  422.    HXxSize hxxSize;
  423.    m_pSite->GetSize(hxxSize);
  424.    memcpy(&m_compositionSize, &hxxSize, sizeof(HXxSize)); /* Flawfinder: ignore */
  425.    // find out how big we want to allocate.
  426.    if (m_pSite->IsFullScreen())
  427.    {
  428.       UINT16 unDummy=0;
  429.       UINT16 unHorzRes=0;
  430.       UINT16 unVertRes=0;
  431.       m_pSite->_GetDeviceCaps(NULL, unDummy, unHorzRes, unVertRes );
  432.       m_allocatedCompositionSize.cx = unHorzRes;
  433.       m_allocatedCompositionSize.cy = unVertRes;
  434.    }
  435.    else
  436.    {
  437.       m_allocatedCompositionSize.cx = m_compositionSize.cx;
  438.       m_allocatedCompositionSize.cy = m_compositionSize.cy;
  439.    }
  440.    //XXXgfw uhhhh, OK.
  441.    if( m_compositionSize.cx > m_allocatedCompositionSize.cx ||
  442.        m_compositionSize.cy > m_allocatedCompositionSize.cy )
  443.    {
  444.       m_allocatedCompositionSize.cx = m_compositionSize.cx;
  445.       m_allocatedCompositionSize.cy = m_compositionSize.cy;
  446.    }
  447.    //Make the bitmap header struct.
  448.    m_bmiComposition.bmiHeader.biBitCount    = m_bmiSave.bmiHeader.biBitCount;
  449.    m_bmiComposition.bmiHeader.biCompression = m_bmiSave.bmiHeader.biCompression;
  450.    m_bmiComposition.un.dwBitMask[0]         = m_bmiSave.un.dwBitMask[0];
  451.    m_bmiComposition.un.dwBitMask[1]         = m_bmiSave.un.dwBitMask[1];
  452.    m_bmiComposition.un.dwBitMask[2]         = m_bmiSave.un.dwBitMask[2];
  453.    int nResult = MakeBitmap( &m_bmiComposition,
  454.                              sizeof(m_bmiComposition),
  455.                              m_nCompositionSurfaceCID,
  456.                              m_allocatedCompositionSize.cx,
  457.                              m_allocatedCompositionSize.cy,
  458.                              NULL,
  459.                              0
  460.                              );
  461.    m_bmiComposition.bmiHeader.biBitCount    = m_bmiSave.bmiHeader.biBitCount;
  462.    m_bmiComposition.bmiHeader.biCompression = m_bmiSave.bmiHeader.biCompression;
  463.    m_bmiComposition.un.dwBitMask[0]         = m_bmiSave.un.dwBitMask[0];
  464.    m_bmiComposition.un.dwBitMask[1]         = m_bmiSave.un.dwBitMask[1];
  465.    m_bmiComposition.un.dwBitMask[2]         = m_bmiSave.un.dwBitMask[2];
  466.    //Now create the bits....
  467.    _ResizeVideoBuffer( m_bmiComposition.bmiHeader.biSizeImage );
  468.    m_nCompositionPitch = GetBitmapPitch( &m_bmiComposition );
  469.    if( m_pXImage )
  470.    {
  471.       XFree( m_pXImage );
  472.    }
  473.    if( m_bUseShm )
  474.    {
  475.       XLockDisplay(m_pDisplay);
  476.       m_pXImage  = XShmCreateImage( m_pDisplay,
  477.                                     m_pVisual,
  478.                                     m_unDepth,
  479.                                     ZPixmap,
  480.                                     (char*)m_pCompositionSurface,
  481.                                     &m_shmInfo,
  482.                                     m_allocatedCompositionSize.cx,
  483.                                     m_allocatedCompositionSize.cy
  484.                                     );
  485.       XUnlockDisplay(m_pDisplay);
  486.    }
  487.    else
  488.    {
  489.       XLockDisplay(m_pDisplay);    
  490.       m_pXImage  = XCreateImage( m_pDisplay,
  491.                                  m_pVisual,
  492.                                  m_unDepth,
  493.                                  ZPixmap,
  494.                                  0,
  495.                                  (char*)m_pCompositionSurface,
  496.                                  m_allocatedCompositionSize.cx,
  497.                                  m_allocatedCompositionSize.cy,
  498.                                  32,
  499.                                  0);
  500.       XUnlockDisplay(m_pDisplay);
  501.    }
  502.    
  503.    if( m_pXImage )
  504.    {
  505.       m_bCompositionSurfaceCreated = TRUE;
  506. #ifdef _BIG_ENDIAN
  507.       m_pXImage->byte_order = MSBFirst;
  508. #else
  509.       m_pXImage->byte_order = LSBFirst;
  510. #endif      
  511.       retVal = HXR_OK;
  512.    }
  513.    return retVal;
  514. }
  515. void CUnixRootSurf::_MinimalBlt(HXxRect& srcRect, HXxRect& destRect)
  516. {
  517.    Window win = m_window;
  518.    HX_ASSERT(win);
  519.    if (m_bUseShm)
  520.    {
  521.       XLockDisplay(m_pDisplay);
  522.       XShmPutImage(m_pDisplay,
  523.                    win,
  524.                    m_GC,
  525.                    m_pXImage,
  526.                    destRect.left, 
  527.                    destRect.top,
  528.                    destRect.left,
  529.                    destRect.top,
  530.                    destRect.right - destRect.left,      
  531.                    destRect.bottom - destRect.top,
  532.                    False
  533.                    );
  534.       XUnlockDisplay(m_pDisplay);
  535.    }
  536.    else
  537.    {
  538.       XLockDisplay(m_pDisplay);
  539.       XPutImage(m_pDisplay,
  540.                 win,
  541.                 m_GC,
  542.                 m_pXImage,
  543.                 srcRect.left, 
  544.                 srcRect.top,
  545.                 destRect.left,
  546.                 destRect.top,
  547.                 destRect.right - destRect.left,      
  548.                 destRect.bottom - destRect.top);
  549.       XUnlockDisplay(m_pDisplay);
  550.    }
  551. }
  552. HX_RESULT CUnixRootSurf::_DestroyCompositionSurface()
  553. {
  554.    HX_RESULT retVal = HXR_OK;
  555.    if( m_bCompositionSurfaceCreated )
  556.    {
  557.       if( m_pXImage )
  558.       {
  559.          XFree(m_pXImage);
  560.          m_pXImage = NULL;
  561.       }
  562.       m_bCompositionSurfaceCreated = FALSE;
  563.    }
  564.    
  565.    return retVal;
  566. }
  567. HX_RESULT CUnixRootSurf::BeginOptimizedBlt(HXBitmapInfoHeader* pBitmapInfo)
  568. {
  569. #ifdef _DEBUG
  570.    fprintf(stderr, "CUnixRootSurf::BeginOptimizedBlt Needs to be writtenn" );
  571. #endif
  572.    return HXR_NOTIMPL;
  573. }
  574. HX_RESULT CUnixRootSurf::OptimizedBlt( UCHAR*   pImageBits,
  575.                                        HXxRect& rDestRect,
  576.                                        HXxRect& rSrcRect)
  577. {
  578. #ifdef _DEBUG
  579.    fprintf(stderr, "CUnixRootSurf::OptimizedBlt Needs to be writtenn" );
  580. #endif
  581.    return HXR_NOTIMPL;
  582. }
  583. HX_RESULT CUnixRootSurf::EndOptimizedBlt(void)
  584. {
  585. #ifdef _DEBUG
  586.    fprintf(stderr, "CUnixRootSurf::EndOptimizedBlt Needs to be writtenn" );
  587. #endif
  588.    return HXR_NOTIMPL;
  589. }
  590. HX_RESULT CUnixRootSurf::GetOptimizedFormat(HX_COMPRESSION_TYPE& ulType)
  591. {
  592. #ifdef _DEBUG
  593.    fprintf(stderr, "CUnixRootSurf::GetOptimizedFormat Needs to be writtenn" );
  594. #endif
  595.    return HXR_NOTIMPL;
  596. }
  597. HX_RESULT CUnixRootSurf::GetPreferredFormat(HX_COMPRESSION_TYPE& ulType)
  598. {
  599. #ifdef _DEBUG
  600.    fprintf(stderr, "CUnixRootSurf::GetPreferredFormat Needs to be writtenn" );
  601. #endif
  602.    return HXR_NOTIMPL;
  603. }
  604. GC CUnixRootSurf::GetGC()
  605. {
  606.    return m_GC;
  607. }