2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 #include "..\..\..\include\RealMedia\pntypes.h"
25 #include "..\..\..\include\RealMedia\pnwintyp.h"
26 #include "..\..\..\include\RealMedia\pncom.h"
27 #include "..\..\..\include\RealMedia\rmapckts.h"
28 #include "..\..\..\include\RealMedia\rmacomm.h"
29 #include "..\..\..\include\RealMedia\rmamon.h"
30 #include "..\..\..\include\RealMedia\rmafiles.h"
31 #include "..\..\..\include\RealMedia\rmaengin.h"
32 #include "..\..\..\include\RealMedia\rmacore.h"
33 #include "..\..\..\include\RealMedia\rmaclsnk.h"
34 #include "..\..\..\include\RealMedia\rmaerror.h"
35 #include "..\..\..\include\RealMedia\rmaauth.h"
36 #include "..\..\..\include\RealMedia\rmawin.h"
37 #include "..\..\..\include\RealMedia\rmasite2.h"
38 #include "..\..\..\include\RealMedia\rmaausvc.h"
39 #include "..\..\..\include\RealMedia\rmavsurf.h"
40 #include "..\..\..\include\RealMedia\rmaevent.h"
47 REGION() : rects(0), pOSRegion(0) {}
55 void ExtractRects(REGION
* pRegion
);
56 REGION
* RMACreateRectRegion(int left
, int top
, int right
, int bottom
);
57 void RMASubtractRegion(REGION
* regM
, REGION
* regS
, REGION
* regD
);
58 void RMAUnionRegion(REGION
* reg1
, REGION
* reg2
, REGION
* regD
);
59 void RMAIntersectRegion(REGION
* reg1
, REGION
* reg2
, REGION
* regD
);
60 BOOL
RMAEqualRegion(REGION
* reg1
, REGION
* reg2
);
61 void RMADestroyRegion(REGION
* reg
);
62 REGION
* RMACreateRegion();
64 class CRealMediaWindowlessSite
;
67 // CRealMediaVideoSurface
70 class CRealMediaWindowlessSite
;
72 class CRealMediaVideoSurface
74 , public IRMAVideoSurface
76 void IntersectRect(PNxRect
* pRect
, PNxRect
* pBox
, PNxRect
* pRetVal
);
79 CComPtr
<IUnknown
> m_pContext
;
80 CRealMediaWindowlessSite
* m_pSiteWindowless
;
81 RMABitmapInfoHeader m_bitmapInfo
;
82 RMABitmapInfoHeader m_lastBitmapInfo
;
85 CRealMediaVideoSurface(IUnknown
* pContext
, CRealMediaWindowlessSite
* pSiteWindowless
);
86 virtual ~CRealMediaVideoSurface();
89 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
);
93 STDMETHODIMP
Blt(UCHAR
* /*IN*/ pImageData
, RMABitmapInfoHeader
* /*IN*/ pBitmapInfo
, REF(PNxRect
) /*IN*/ inDestRect
, REF(PNxRect
) /*IN*/ inSrcRect
);
94 STDMETHODIMP
BeginOptimizedBlt(RMABitmapInfoHeader
* /*IN*/ pBitmapInfo
);
95 STDMETHODIMP
OptimizedBlt(UCHAR
* /*IN*/ pImageBits
, REF(PNxRect
) /*IN*/ rDestRect
, REF(PNxRect
) /*IN*/ rSrcRect
);
96 STDMETHODIMP
EndOptimizedBlt();
97 STDMETHODIMP
GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE
) /*OUT*/ ulType
);
98 STDMETHODIMP
GetPreferredFormat(REF(RMA_COMPRESSION_TYPE
) /*OUT*/ ulType
);
102 // CRealMediaWindowlessSite
105 class CRealMediaWindowlessSite
109 , public IRMASiteWindowless
110 , public IRMAVideoSurface
112 CComQIPtr
<IRMACommonClassFactory
, &IID_IRMACommonClassFactory
> m_pCCF
;
113 CComPtr
<IUnknown
> m_pContext
;
114 CComPtr
<IRMAValues
> m_pValues
;
116 CComPtr
<IRMASiteUser
> m_pUser
;
118 CRealMediaWindowlessSite
* m_pParentSite
;
119 CInterfaceList
<IRMASite
, &IID_IRMASite
> m_pChildren
;
121 CComPtr
<IRMASiteWatcher
> m_pWatcher
;
122 CInterfaceList
<IRMAPassiveSiteWatcher
, &IID_IRMAPassiveSiteWatcher
> m_pPassiveWatchers
;
126 bool m_fDamaged
, m_fInRedraw
, m_fIsVisible
;
132 REGION
* m_pRegionWithoutChildren
;
134 void RecomputeRegion();
135 void InternalRecomputeRegion();
136 void ComputeRegion();
137 void SubtractSite(REGION
* pRegion
);
139 void UpdateZOrder(CRealMediaWindowlessSite
* pUpdatedChildSite
, INT32 lOldZOrder
, INT32 lNewZOrder
);
140 void SetInternalZOrder(INT32 lZOrder
);
143 CRealMediaWindowlessSite(HRESULT
& hr
, IUnknown
* pContext
, CRealMediaWindowlessSite
* pParentSite
= NULL
, IUnknown
* pUnkOuter
= NULL
);
144 virtual ~CRealMediaWindowlessSite();
147 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
);
149 void GetTopLeft(PNxPoint
* pPoint
);
152 // IRMASiteWindowless
154 STDMETHODIMP
EventOccurred(PNxEvent
* /*IN*/ pEvent
);
155 STDMETHODIMP_(PNxWindow
*) GetParentWindow();
159 STDMETHODIMP
AttachUser(IRMASiteUser
* /*IN*/ pUser
);
160 STDMETHODIMP
DetachUser();
161 STDMETHODIMP
GetUser(REF(IRMASiteUser
*) /*OUT*/ pUser
);
163 STDMETHODIMP
CreateChild(REF(IRMASite
*) /*OUT*/ pChildSite
);
164 STDMETHODIMP
DestroyChild(IRMASite
* /*IN*/ pChildSite
);
166 STDMETHODIMP
AttachWatcher(IRMASiteWatcher
* /*IN*/ pWatcher
);
167 STDMETHODIMP
DetachWatcher();
169 STDMETHODIMP
SetPosition(PNxPoint position
);
170 STDMETHODIMP
GetPosition(REF(PNxPoint
) position
);
171 STDMETHODIMP
SetSize(PNxSize size
);
172 STDMETHODIMP
GetSize(REF(PNxSize
) size
);
174 STDMETHODIMP
DamageRect(PNxRect rect
);
175 STDMETHODIMP
DamageRegion(PNxRegion region
);
176 STDMETHODIMP
ForceRedraw();
180 STDMETHODIMP
UpdateSiteWindow(PNxWindow
* /*IN*/ pWindow
);
181 STDMETHODIMP
ShowSite(BOOL bShow
);
182 STDMETHODIMP_(BOOL
) IsSiteVisible();
183 STDMETHODIMP
SetZOrder(INT32 lZOrder
);
184 STDMETHODIMP
GetZOrder(REF(INT32
) lZOrder
);
185 STDMETHODIMP
MoveSiteToTop();
186 STDMETHODIMP
GetVideoSurface(REF(IRMAVideoSurface
*) pSurface
);
187 STDMETHODIMP_(UINT32
) GetNumberOfChildSites();
189 STDMETHODIMP
AddPassiveSiteWatcher(IRMAPassiveSiteWatcher
* pWatcher
);
190 STDMETHODIMP
RemovePassiveSiteWatcher(IRMAPassiveSiteWatcher
* pWatcher
);
192 STDMETHODIMP
SetCursor(PNxCursor cursor
, REF(PNxCursor
) oldCursor
);
195 void IntersectRect(PNxRect
* pRect
, PNxRect
* pBox
, PNxRect
* pRetVal
);
198 RMABitmapInfoHeader m_bitmapInfo
;
199 RMABitmapInfoHeader m_lastBitmapInfo
;
201 CComPtr
<IRMAVideoSurface
> m_pBltService
;
204 bool GetBltService(IRMAVideoSurface
** ppBltService
);
205 void SetBltService(IRMAVideoSurface
* ppBltService
);
209 STDMETHODIMP
Blt(UCHAR
* /*IN*/ pImageData
, RMABitmapInfoHeader
* /*IN*/ pBitmapInfo
, REF(PNxRect
) /*IN*/ inDestRect
, REF(PNxRect
) /*IN*/ inSrcRect
);
210 STDMETHODIMP
BeginOptimizedBlt(RMABitmapInfoHeader
* /*IN*/ pBitmapInfo
);
211 STDMETHODIMP
OptimizedBlt(UCHAR
* /*IN*/ pImageBits
, REF(PNxRect
) /*IN*/ rDestRect
, REF(PNxRect
) /*IN*/ rSrcRect
);
212 STDMETHODIMP
EndOptimizedBlt();
213 STDMETHODIMP
GetOptimizedFormat(REF(RMA_COMPRESSION_TYPE
) /*OUT*/ ulType
);
214 STDMETHODIMP
GetPreferredFormat(REF(RMA_COMPRESSION_TYPE
) /*OUT*/ ulType
);
218 using namespace DSObjects
;