[prev in list] [next in list] [prev in thread] [next in thread]
List: helix-video-cvs
Subject: [Video-cvs] sitelib/platform/win winsurf.cpp,1.5,1.6
From: pankajgupta () helixcommunity ! org
Date: 2004-07-26 10:22:42
[Download RAW message or body]
Update of /cvsroot/video/sitelib/platform/win
In directory cvs-new:/tmp/cvs-serv27031
Modified Files:
winsurf.cpp
Log Message:
To remove dependency on Real Media files
Index: winsurf.cpp
===================================================================
RCS file: /cvsroot/video/sitelib/platform/win/winsurf.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- winsurf.cpp 9 Jul 2004 18:35:26 -0000 1.5
+++ winsurf.cpp 26 Jul 2004 10:22:39 -0000 1.6
@@ -1,8 +1,8 @@
/* ***** BEGIN LICENSE BLOCK *****
* Source last modified: $Id$
- *
+ *
* Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
- *
+ *
* The contents of this file, and the files included with this file,
* are subject to the current version of the RealNetworks Public
* Source License (the "RPSL") available at
@@ -16,7 +16,7 @@
* to this file, the RCSL. Please see the applicable RPSL or RCSL for
* the rights, obligations and limitations governing use of the
* contents of the file.
- *
+ *
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL") in which case the provisions of the GPL are applicable
@@ -28,30 +28,29 @@
* the GPL. If you do not delete the provisions above, a recipient may
* use your version of this file under the terms of any one of the
* RPSL, the RCSL or the GPL.
- *
+ *
* This file is part of the Helix DNA Technology. RealNetworks is the
* developer of the Original Code and owns the copyrights in the
* portions it created.
- *
+ *
* This file, and the files included with this file, is distributed
* and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
* ENJOYMENT OR NON-INFRINGEMENT.
- *
+ *
* Technology Compatibility Kit Test Suite(s) Location:
* http://www.helixcommunity.org/content/tck
- *
+ *
* Contributor(s):
- *
+ *
* ***** END LICENSE BLOCK ***** */
#include "hxtypes.h"
#include "hlxclib/windows.h"
#include "ddraw.h"
#include "hxcom.h"
-#include "hxmtypes.h"
#include "hxwintyp.h"
#include "hxvsurf.h"
#include "hxslist.h"
@@ -67,11 +66,11 @@
// these are defined in basesurf.cpp and should probably be moved to a .h file
#define HX_OVER_KEYDEST 1
#define HX_OVER_HIDE 2
-#define HX_OVER_SHOW 4
+#define HX_OVER_SHOW 4
#define OVERLAY_NOT_VISIBLE 0
#ifdef _DEBUG
-#undef HX_THIS_FILE
+#undef HX_THIS_FILE
static const char HX_THIS_FILE[] = __FILE__;
#include "winthrd.h"
@@ -118,16 +117,16 @@
CWinBaseRootSurface* pSurface = (CWinBaseRootSurface*)m_pSite->GetRootSurface();
pSurface->OpenWindraw();
WINDRAW* pWindraw = pSurface->GetWinDraw();
-
+
BMI bmi;
memset(&bmi, 0, sizeof(BMI));
WinDraw2_GetDisplayFormat(pWindraw, &bmi);
int cid = GetBitmapColor((LPBITMAPINFO)&bmi);
-
+
memset(&bmi, 0, sizeof(BMI));
MakeBitmap((LPBITMAPINFO)&bmi, sizeof(BMI), cid, m_pOptimizedFormat->biWidth, \
m_pOptimizedFormat->biHeight, NULL, NULL); memset(&m_surface, 0, \
sizeof(WINDRAWSURFACE));
-
+
if (NOERROR == WinDraw2_CreateSurface(pWindraw, &m_surface, &bmi, \
pSurface->GetSurfaceType(), 0, 0)) {
m_surfaceSize.cx = m_pOptimizedFormat->biWidth;
@@ -150,10 +149,10 @@
CWinBaseRootSurface* pSurface = (CWinBaseRootSurface*)m_pSite->GetRootSurface();
pSurface->OpenWindraw();
WINDRAW* pWindraw = pSurface->GetWinDraw();
-
+
// UINT32 fSurfaceCaps;
UINT32 garbagea, garbageb;
-
+
if (NOERROR != Windraw_GetCaps(pWindraw, pfSurfaceCaps, &garbagea, &garbageb))
{
return HXR_FAIL;
@@ -168,20 +167,20 @@
{
//Get our windraw object from the root surface
CWinBaseRootSurface* pSurface = (CWinBaseRootSurface*)m_pSite->GetRootSurface();
-
+
HX_ASSERT( pSurface );
if( !pSurface )
return HXR_FAIL;
-
+
pSurface->OpenWindraw();
WINDRAW* pWindraw = pSurface->GetWinDraw();
BMI bmi;
memset(&bmi, 0, sizeof(BMI));
MakeBitmap((LPBITMAPINFO)&bmi, sizeof(BMI), cid, x, y, NULL, NULL);
memset(&m_surface, 0, sizeof(WINDRAWSURFACE));
-
+
int fFlags = 0;
-
+
if (bOverlay)
{
fFlags = WINDRAWSURFACE_DIRECTDRAW | WINDRAWSURFACE_OVERLAY | \
WINDRAWSURFACE_VIDEOMEMORY; @@ -190,7 +189,7 @@
{
fFlags = WINDRAWSURFACE_DIRECTDRAW | WINDRAWSURFACE_DEFAULTMEMORY;
}
-
+
int numBuffers = (m_bFlipOverlay && bOverlay) ? m_nBackBufferCount+1 : 1;
for (; numBuffers; numBuffers--)
{
@@ -223,7 +222,7 @@
return HXR_OK;
}
}
-
+
return HXR_FAIL;
}
@@ -232,42 +231,42 @@
#ifdef _CHECK_PERFORMANCE
static LARGE_INTEGER QueryPerformanceCounterResult = {0,0};
static LARGE_INTEGER QueryPerformanceFrequencyResult = {0,0};
-
+
QueryPerformanceFrequency(&QueryPerformanceFrequencyResult);
-
+
double frequency = ((double)QueryPerformanceFrequencyResult.LowPart + \
4294967296.0*QueryPerformanceFrequencyResult.HighPart); \
QueryPerformanceCounter(&QueryPerformanceCounterResult);
-
+
double startTime = ((double)QueryPerformanceCounterResult.LowPart + \
4294967296.0*QueryPerformanceCounterResult.HighPart)/frequency; #endif
-
+
if ((m_surfaceSize.cx==0 && m_surfaceSize.cy == 0) || HX_BLT_YUV_STRETCH != \
m_nBltMode ) {
return HXR_FAIL;
}
-
+
CWinBaseRootSurface* pSurface = (CWinBaseRootSurface*)m_pSite->GetRootSurface();
WINDRAW* pWindraw = pSurface->GetWinDraw();
-
+
HX_RESULT retVal = HXR_FAIL;
-
+
if (NOERROR == WinDrawSurface_Blt(pWindraw, &m_surface, (RECT*)&rDestRect, \
(RECT*)&rSrcRect)) {
- retVal = HXR_OK;
+ retVal = HXR_OK;
}
-
+
#ifdef _CHECK_PERFORMANCE
QueryPerformanceCounter(&QueryPerformanceCounterResult);
double endTime = ((double)QueryPerformanceCounterResult.LowPart + \
4294967296.0*QueryPerformanceCounterResult.HighPart)/frequency;
-
+
static UINT32 z_nNumTimes = 0;
static double z_fTotalTime;
static double z_fAverageTime;
-
+
z_nNumTimes++;
z_fTotalTime += endTime - startTime;
z_fAverageTime = z_fTotalTime / (double) z_nNumTimes;
-
+
if (! (z_nNumTimes % 25))
{
FILE* f1 = ::fopen("c:\\performance.txt", "a+"); /* Flawfinder: ignore */
@@ -282,7 +281,7 @@
{
HX_RESULT ret = HXR_OK;
IDirectDrawSurface *pBackBuffer = NULL;
-
+
CWinBaseRootSurface* pSurface = (CWinBaseRootSurface*)m_pSite->GetRootSurface();
WINDRAW* pWindraw = pSurface->GetWinDraw();
@@ -297,10 +296,10 @@
ret = HXR_OK;
else
ret = HXR_FAIL;
-
+
if (pBackBuffer)
m_surface.dd.lpDDBackBuffer = pBackBuffer;
-
+
return ret;
}
@@ -320,9 +319,9 @@
m_pSite);
}
-
+
IDirectDrawSurface *pBackBuffer = NULL;
-
+
//This is a VS1 only call. If we are calling this and we are in
//VS2 mode then it means we are sharing the overlay.
//VS1 only uses the front buffer and so we need to hide the back
@@ -339,20 +338,20 @@
if (pBackBuffer)
m_surface.dd.lpDDBackBuffer = pBackBuffer;
-
+
return HXR_OK;
}
void CWinSurface::_SetupDCObjects(HXxDC hxxDC, void** phOldBrush, void** phOldPen)
{
HDC hdc = (HDC) hxxDC;
-
+
LOGBRUSH brush;
-
+
brush.lbStyle = BS_SOLID;
brush.lbColor = GetOverlayColor();
brush.lbHatch = 0;
-
+
HBRUSH hBrush = (HBRUSH)CreateBrushIndirect(&brush);
HPEN hPen = (HPEN)CreatePen(PS_SOLID, 1, GetOverlayColor());
*phOldBrush = (void*)SelectObject(hdc, hBrush);
@@ -363,20 +362,20 @@
{
HDC hdc = (HDC)hxxDC;
LOGBRUSH brush;
-
+
brush.lbStyle = BS_SOLID;
// Do NOT use _InsureColorMatch() here. This color must be RGB(8,8,8) format and \
_InsureColorMatch() // will return a different format if display isn't in 24 or \
32-bit mode. brush.lbColor = GetOverlayColor();
brush.lbHatch = 0;
-
+
HBRUSH hBrush = (HBRUSH)CreateBrushIndirect(&brush);
HPEN hPen = (HPEN)CreatePen(PS_SOLID, 1, brush.lbColor);
HBRUSH hOldBrush = (HBRUSH)SelectObject(hdc, hBrush);
HPEN hOldPen = (HPEN)SelectObject(hdc, hPen);
-
+
Rectangle(hdc, left, top, right, bottom);
-
+
SelectObject(hdc, hOldBrush);
SelectObject(hdc, hOldPen);
DeleteObject(hBrush);
@@ -396,7 +395,7 @@
CWinBaseRootSurface* pSurface = (CWinBaseRootSurface*)m_pSite->GetRootSurface();
WINDRAWSURFACE* pDrawSurface = pSurface->GetCompositionSurface();
WINDRAW* pWindraw = pSurface->GetWinDraw();
-
+
WinDrawSurface_GetDC(pWindraw, pDrawSurface, (HDC*)hdc);
// XXXAH Huh? Fix this up!
}
@@ -407,7 +406,7 @@
WINDRAWSURFACE* pDrawSurface = pSurface->GetCompositionSurface();
WINDRAW* pWindraw = pSurface->GetWinDraw();
-
+
WinDrawSurface_ReleaseDC(pWindraw, pDrawSurface, (HDC)hdc);
}
@@ -430,22 +429,22 @@
{
CWinBaseRootSurface* pSurface = (CWinBaseRootSurface*)m_pSite->GetRootSurface();
WINDRAW* pWindraw = pSurface->GetWinDraw();
-
+
// convert flags.
INT32 flags = 0;
-
+
if (inFlags & HX_OVER_KEYDEST)
- {
+ {
flags |= DDOVER_KEYDEST;
}
-
+
if (inFlags & HX_OVER_HIDE)
- {
+ {
flags |= DDOVER_HIDE;
}
-
+
if (inFlags & HX_OVER_SHOW)
- {
+ {
flags |= DDOVER_SHOW;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic