📄 basesurf.h
字号:
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: basesurf.h,v 1.3.34.1 2004/07/09 01:58:56 hubbe Exp $ * * 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 * http://www.helixcommunity.org/content/rpsl unless you have licensed * the file under the current version of the RealNetworks Community * Source License (the "RCSL") available at * http://www.helixcommunity.org/content/rcsl, in which case the RCSL * will apply. You may also obtain the license terms directly from * RealNetworks. You may not use this file except in compliance with * the RPSL or, if you have a valid RCSL with RealNetworks applicable * 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 * instead of those above. If you wish to allow use of your version of * this file only under the terms of the GPL, and not to allow others * to use your version of this file under the terms of either the RPSL * or RCSL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by * 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 ***** */#ifndef _BASESURF_H_#define _BASESURF_H_#include "hxvctrl.h"#include "baseroot.h"#include "coloracc.h"#include "region.h"#include "hxmap.h"#include "hxwin.h"#if !defined(_GOLD) && 0#include "timestmp.h" #endif//Bliting modes#define HX_NO_BLT -1#define HX_BASIC_BLT 0#define HX_OVERLAY_BLT 1#define HX_BLT_YUV_STRETCH 2//defines for device caps#define HX_OVERLAY (1<<0) //Supports overlays of some type#define HX_OVERLAY_STRETCH (1<<1) //Supports stretchable overlays#define HX_BLTFOURCC (1<<2) //Supports color conversion in blts#define HX_OVER_KEYDEST 1#define HX_OVER_HIDE 2#define HX_OVER_SHOW 4 #define HX_OVER_BOB 8#define OVERLAY_NOT_VISIBLE 0//XXXgfw just to clean up the code. We still *REALLY* need to clean//this up in colormap.#ifdef _WIN32#define GETBITMAPCOLOR(x) GetBitmapColor( (LPBITMAPINFO)(x) )#else#define GETBITMAPCOLOR(x) GetBitmapColor( (HXBitmapInfo*)(x))#endif#ifdef _WIN32#define GETBITMAPPITCH(x) GetBitmapPitch( (LPBITMAPINFO)(x) )#else#define GETBITMAPPITCH(x) GetBitmapPitch( (HXBitmapInfo*)(x))#endif//Forward declarationsclass CHXBaseSite;class CBaseRootSurface;class CYUVInputFormatMngr;class CHWMemObj;//Just used to optimize YUV alphablendingstruct Image{ UCHAR* pucImage; HXBitmapInfoHeader bmiImage;};struct ImageBlock{ Image* pImage; //Image to draw HXxRect rect; //Where to draw it, site rel coords. CHXBaseSite* pSrcSite; //The ARGB site this came from. INT32 startX; //Where this rect starts INT32 startY; //Where this rect starts};class CBaseSurface :public IHXSubRectVideoSurface,public IHXVideoControl,public IHXOverlayResponse{public: friend class CHXBaseSite; #ifdef _MACINTOSH friend class CHXMacSite;#endif //Creation... static CBaseSurface* Create(IUnknown* pContext, CHXBaseSite* pSite); //IUnknown methods STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj); STDMETHOD_(ULONG32,AddRef)(THIS); STDMETHOD_(ULONG32,Release)(THIS); //IHXVideoSurface methods usually called by renderers to Draw on //the surface STDMETHOD(Blt)(THIS_ UCHAR* pImageData, HXBitmapInfoHeader* pBitmapInfo, REF(HXxRect) rDestRect, REF(HXxRect) rSrcRect); STDMETHOD(BeginOptimizedBlt)(THIS_ HXBitmapInfoHeader* pBitmapInfo); STDMETHOD(OptimizedBlt) (THIS_ UCHAR* pImageBits, REF(HXxRect) rDestRect, REF(HXxRect) rSrcRect ); STDMETHOD(EndOptimizedBlt) (THIS); STDMETHOD(GetOptimizedFormat)(THIS_ REF(HX_COMPRESSION_TYPE) /*OUT*/ ulType); STDMETHOD(GetPreferredFormat)(THIS_ REF(HX_COMPRESSION_TYPE) /*OUT*/ ulType); //IHXSubRectVideoSurface method. STDMETHOD(BltSubRects)( THIS_ UCHAR* /*IN*/ pImageBits, HXBitmapInfoHeader* /*IN*/ pBitmapInfo, HXxBoxRegion* /*IN*/ rDestRects, HXxBoxRegion* /*IN*/ rSrcRects, float fScaleFactorX, float fScaleFactorY ); //IHXVideoControls methods STDMETHOD_(float, GetBrightness)(THIS); STDMETHOD(SetBrightness) (THIS_ float Brightness); STDMETHOD_(float, GetContrast) (THIS); STDMETHOD(SetContrast) (THIS_ float Contrast); STDMETHOD_(float, GetSaturation)(THIS); STDMETHOD(SetSaturation) (THIS_ float Saturation); STDMETHOD_(float, GetHue) (THIS); STDMETHOD(SetHue) (THIS_ float Hue); STDMETHOD_(float, GetSharpness) (THIS); STDMETHOD(SetSharpness) (THIS_ float Sharpness); STDMETHOD(SetModeSharpness) (THIS_ UINT16 dFlag); /* * IHXOverlayResponse methods */ STDMETHOD(OverlayGranted) (THIS); STDMETHOD(OverlayRevoked) (THIS); // helper methods virtual void SetRootSurface( CBaseRootSurface* pSurface); HXxRect ComputeIntersection(HXxRect* pRect, HXxRect* newDestRect); //Overlay support. void TryCreateOverlay(BOOL bOverlay); void TryCreateOffScreenBuffer(); HX_RESULT CreateOverlay(BOOL, int cid, int x, int y); virtual HX_RESULT ByPassCompositionSurface( UCHAR* pImageData, HXBitmapInfoHeader* pBitmapInfo, HXxRect& rDestRect, HXxRect& rSrcRect, UCHAR* pSurface, LONG32 nSurfPitch ); HX_RESULT UpdateOverlay( REF(HXxRect) rDestRect, REF(HXxRect) rSrcRect, int x=0, int y=0 ); void FillColorKey(); void FillColorKey(HXxDC hdc); INT32 GetOverlayColor(); void UpdateDestRect(int x=0, int y=0); void DestroySurfaces(); virtual void ReInitSurfaces(); BOOL ForceGDIMode(BOOL); void ResetUpdateOverlay(); HX_RESULT BltToPrimary(REF(HXxRect) rDestRect, REF(HXxRect) rSrcRect); void DrawTransitionBorders( HXBitmapInfoHeader* pBitmapInfo, INT32 width, ULONG32 color, BOOL bBlendedBorders ); void SetColorspacePriorities(int* pList, int nEntries, int cid); void RestoreColorspacePriorities(int cid); void LinkOverlay(CHXBaseSite* pSite); void AddLinkedSite(CHXBaseSite* pSite); virtual HX_RESULT RelinquishOverlay(); virtual HX_RESULT AcquireOverlay(); void UpdateBltStats(HXxRect* pRect); void DisableColorControls(float &fBrightness, float &fContrast, float &fSaturation, float &fHue); void EnableColorControls(float fBrightness, float fContrast, float fSaturation, float fHue); virtual BOOL _IsDisplaySurfaceYuv(); HXxSize* GetSurfaceSize() {return &m_surfaceSize;}private: CBaseSurface(); CBaseSurface( const CBaseSurface& it ); CBaseSurface& operator=(const CBaseSurface& rhs ); protected: void _FillColorKey(); CBaseSurface(IUnknown* pContext, CHXBaseSite* pSite); virtual ~CBaseSurface(); PRIVATE_DESTRUCTORS_ARE_NOT_A_CRIME //Converts window coordinates into device coordinates //if needed. This is used on Windows at least because //its overlays use screen coords instead of window coords. //This is a noop on unix as its overlays are in window coords. virtual void _GetWindowDeviceCords(HXxRect* rect )=0; LONG32 m_lRefCount; IUnknown* m_pContext; IHXOverlayManager* m_pOverlayManager; BOOL m_bNeedColorKeyFilled; BOOL m_bOffBecauseofShinking; float m_Brightness; float m_Contrast; float m_Saturation; float m_Hue; float m_Sharpness; UINT16 m_ModeSharpness; float m_PrevBrightness; float m_PrevContrast; float m_PrevSaturation; float m_PrevHue; float m_PrevSharpness; CHXBaseSite* m_pSite; CBaseRootSurface* m_pRootSurface; HXBitmapInfoHeader* m_pOptimizedFormat; UINT32 m_oldOverlayColorDepth; UINT32 m_convertedOverlayColor; //Overlay Support UINT32 m_nSrcCID; UINT32 m_nSurfaceCID; HXxSize m_surfaceSize;public: INT32 m_nBltMode;protected: INT32 m_nOldBltMode; INT32 m_nOldBltMode2; BOOL m_bBackGroundDirty; BOOL m_bUseOverlays; BOOL m_bDisableFillColorKey; BOOL m_bMultipleOverlay; HXxRect m_lastSrcRect; BOOL m_bSpamUpdateOverlay; BOOL m_bFlipOverlay; int m_nBackBufferCount; int m_nMaxBackBuffers; int m_nOverlayFailureCount; int m_nDDSurfaceSize; int m_nUpdateOverlayByPassCount; HXxRect m_lastUpdateDestRect; HXxRect m_lastUpdateSrcRect; CBaseSurface* m_pLinkedOverlay; BOOL m_bAllowOverlayLinking; BOOL m_bLostHWAcceleration;#if !defined(_GOLD) && 0 CTimeSample m_TimeStamps;#endif HXBitmapInfoHeader m_bmi; typedef struct tagFrameElement { int nIndex; INT32 lTimeStamp; double dTimeAvailable; INT32 nBltMode;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -