2 * $Id: SubPicImpl.h 2786 2010-12-17 16:42:55Z XhmikosR $
5 * (C) 2006-2010 see AUTHORS
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Make; see the file COPYING. If not, write to
19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 * http://www.gnu.org/copyleft/gpl.html
28 class CSubPicImplHelper
31 REFERENCE_TIME m_rtStart
, m_rtStop
;
32 REFERENCE_TIME m_rtSegmentStart
, m_rtSegmentStop
;
36 CSize m_maxsize
, m_size
;
38 CSize m_VirtualTextureSize
;
39 CPoint m_VirtualTextureTopLeft
;
44 +-------+---------------------------------+
47 TextureTopLeft .<=============================== |======> . Video
48 | . . . +-------------------------------- | -----+ +-----------------------------------+
49 | | . | | | m_vidrect |
52 | | +-----------+ . | | | |
53 | | | m_rcDirty | . | | | |
55 | | +-----------+ . | | | |
56 | +-------------------------------- | -----+ | |
58 | <=========================> | | |
60 | | +-----------------------------------+
64 +-----------------------------------------+
66 <=========================================>
74 STDMETHODIMP_(REFERENCE_TIME
) GetStart() const;
75 STDMETHODIMP_(REFERENCE_TIME
) GetStop() const;
76 STDMETHODIMP_(void) SetStart(REFERENCE_TIME rtStart
);
77 STDMETHODIMP_(void) SetStop(REFERENCE_TIME rtStop
);
79 //STDMETHODIMP GetDesc(SubPicDesc& spd) const = 0;
80 STDMETHODIMP
CopyTo(ISubPic
* pSubPic
);
82 //STDMETHODIMP ClearDirtyRect(DWORD color) = 0;
83 STDMETHODIMP
GetDirtyRect(RECT
* pDirtyRect
) const;
84 STDMETHODIMP
SetDirtyRect(RECT
* pDirtyRect
/*[in]*/);
86 STDMETHODIMP
GetMaxSize(SIZE
* pMaxSize
) const;
87 STDMETHODIMP
SetSize(SIZE size
, RECT vidrect
);
89 //STDMETHODIMP Lock(SubPicDesc& spd) = 0;
90 //STDMETHODIMP Unlock(RECT* pDirtyRect /*[in]*/) = 0;
92 //STDMETHODIMP AlphaBlt(const RECT* pSrc, const RECT* pDst, SubPicDesc* pTarget) = 0;
94 STDMETHODIMP
SetVirtualTextureSize (const SIZE pSize
, const POINT pTopLeft
);
95 STDMETHODIMP
GetSourceAndDest(SIZE
* pSize
, RECT
* pRcSource
, RECT
* pRcDest
);
97 STDMETHODIMP_(REFERENCE_TIME
) GetSegmentStart();
98 STDMETHODIMP_(REFERENCE_TIME
) GetSegmentStop();
99 STDMETHODIMP_(void) SetSegmentStart(REFERENCE_TIME rtStart
);
100 STDMETHODIMP_(void) SetSegmentStop(REFERENCE_TIME rtStop
);
103 class CSubPicImpl
: public CUnknown
, public CSubPicImplHelper
, public ISubPic
109 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
);
113 STDMETHODIMP_(REFERENCE_TIME
) GetStart() const
115 return CSubPicImplHelper::GetStart();
117 STDMETHODIMP_(REFERENCE_TIME
) GetStop() const
119 return CSubPicImplHelper::GetStop();
121 STDMETHODIMP_(void) SetStart(REFERENCE_TIME rtStart
)
123 return CSubPicImplHelper::SetStart(rtStart
);
125 STDMETHODIMP_(void) SetStop(REFERENCE_TIME rtStop
)
127 return CSubPicImplHelper::SetStop(rtStop
);
130 STDMETHODIMP
GetDesc(SubPicDesc
& spd
) const = 0;
131 STDMETHODIMP
CopyTo(ISubPic
* pSubPic
)
133 return CSubPicImplHelper::CopyTo(pSubPic
);
136 STDMETHODIMP
ClearDirtyRect(DWORD color
) = 0;
137 STDMETHODIMP
GetDirtyRect(RECT
* pDirtyRect
) const
139 return CSubPicImplHelper::GetDirtyRect(pDirtyRect
);
141 STDMETHODIMP
SetDirtyRect(RECT
* pDirtyRect
/*[in]*/)
143 return CSubPicImplHelper::SetDirtyRect(pDirtyRect
);
146 STDMETHODIMP
GetMaxSize(SIZE
* pMaxSize
) const
148 return CSubPicImplHelper::GetMaxSize(pMaxSize
);
150 STDMETHODIMP
SetSize(SIZE size
, RECT vidrect
)
152 return CSubPicImplHelper::SetSize(size
, vidrect
);
155 STDMETHODIMP
Lock(SubPicDesc
& spd
) = 0;
156 STDMETHODIMP
Unlock(RECT
* pDirtyRect
/*[in]*/) = 0;
158 STDMETHODIMP
AlphaBlt(const RECT
* pSrc
, const RECT
* pDst
, SubPicDesc
* pTarget
) = 0;
160 STDMETHODIMP
SetVirtualTextureSize (const SIZE pSize
, const POINT pTopLeft
)
162 return CSubPicImplHelper::SetVirtualTextureSize(pSize
, pTopLeft
);
164 STDMETHODIMP
GetSourceAndDest(SIZE
* pSize
, RECT
* pRcSource
, RECT
* pRcDest
)
166 return CSubPicImplHelper::GetSourceAndDest(pSize
, pRcSource
, pRcDest
);
169 STDMETHODIMP_(REFERENCE_TIME
) GetSegmentStart()
171 return CSubPicImplHelper::GetSegmentStart();
173 STDMETHODIMP_(REFERENCE_TIME
) GetSegmentStop()
175 return CSubPicImplHelper::GetSegmentStop();
177 STDMETHODIMP_(void) SetSegmentStart(REFERENCE_TIME rtStart
)
179 return CSubPicImplHelper::SetSegmentStart(rtStart
);
181 STDMETHODIMP_(void) SetSegmentStop(REFERENCE_TIME rtStop
)
183 return CSubPicImplHelper::SetSegmentStop(rtStop
);
187 class CSubPicExImpl
: public CUnknown
, public CSubPicImplHelper
, public ISubPicEx
190 CAtlList
<CRect
> m_rectListDirty
;
196 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
);
200 STDMETHODIMP_(REFERENCE_TIME
) GetStart() const
202 return CSubPicImplHelper::GetStart();
204 STDMETHODIMP_(REFERENCE_TIME
) GetStop() const
206 return CSubPicImplHelper::GetStop();
208 STDMETHODIMP_(void) SetStart(REFERENCE_TIME rtStart
)
210 return CSubPicImplHelper::SetStart(rtStart
);
212 STDMETHODIMP_(void) SetStop(REFERENCE_TIME rtStop
)
214 return CSubPicImplHelper::SetStop(rtStop
);
217 STDMETHODIMP
GetDesc(SubPicDesc
& spd
) const = 0;
218 STDMETHODIMP
CopyTo(ISubPic
* pSubPic
)
220 return CSubPicImplHelper::CopyTo(pSubPic
);
223 STDMETHODIMP
ClearDirtyRect(DWORD color
) = 0;
224 STDMETHODIMP
GetDirtyRect(RECT
* pDirtyRect
) const
226 return CSubPicImplHelper::GetDirtyRect(pDirtyRect
);
228 STDMETHODIMP
SetDirtyRect(RECT
* pDirtyRect
/*[in]*/);
230 STDMETHODIMP
GetMaxSize(SIZE
* pMaxSize
) const
232 return CSubPicImplHelper::GetMaxSize(pMaxSize
);
234 STDMETHODIMP
SetSize(SIZE size
, RECT vidrect
)
236 return CSubPicImplHelper::SetSize(size
, vidrect
);
239 STDMETHODIMP
Lock(SubPicDesc
& spd
) = 0;
240 STDMETHODIMP
Unlock(RECT
* pDirtyRect
/*[in]*/);
242 STDMETHODIMP
AlphaBlt(const RECT
* pSrc
, const RECT
* pDst
, SubPicDesc
* pTarget
) = 0;
244 STDMETHODIMP
SetVirtualTextureSize (const SIZE pSize
, const POINT pTopLeft
)
246 return CSubPicImplHelper::SetVirtualTextureSize(pSize
, pTopLeft
);
248 STDMETHODIMP
GetSourceAndDest(SIZE
* pSize
, RECT
* pRcSource
, RECT
* pRcDest
)
250 return CSubPicImplHelper::GetSourceAndDest(pSize
, pRcSource
, pRcDest
);
253 STDMETHODIMP_(REFERENCE_TIME
) GetSegmentStart()
255 return CSubPicImplHelper::GetSegmentStart();
257 STDMETHODIMP_(REFERENCE_TIME
) GetSegmentStop()
259 return CSubPicImplHelper::GetSegmentStop();
261 STDMETHODIMP_(void) SetSegmentStart(REFERENCE_TIME rtStart
)
263 return CSubPicImplHelper::SetSegmentStart(rtStart
);
265 STDMETHODIMP_(void) SetSegmentStop(REFERENCE_TIME rtStop
)
267 return CSubPicImplHelper::SetSegmentStop(rtStop
);
271 STDMETHODIMP
CopyTo(ISubPicEx
* pSubPicEx
);
273 STDMETHODIMP
GetDirtyRects(CAtlList
<const CRect
>& dirtyRectList
/*[out]*/) const;
274 STDMETHODIMP
SetDirtyRectEx(CAtlList
<CRect
>* dirtyRectList
/*[in]*/);
276 STDMETHODIMP
Unlock(CAtlList
<CRect
>* dirtyRectList
/*[in]*/) = 0;
279 class CSubPicAllocatorImpl
: public CUnknown
, public ISubPicAllocator
281 CComPtr
<ISubPic
> m_pStatic
;
286 bool m_fDynamicWriteOnly
;
288 virtual bool Alloc(bool fStatic
, ISubPic
** ppSubPic
) = 0;
290 bool m_fPow2Textures
;
292 CSubPicAllocatorImpl(SIZE cursize
, bool fDynamicWriteOnly
, bool fPow2Textures
);
295 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
);
299 STDMETHODIMP
SetCurSize(SIZE cursize
);
300 STDMETHODIMP
SetCurVidRect(RECT curvidrect
);
301 STDMETHODIMP
GetStatic(ISubPic
** ppSubPic
);
302 STDMETHODIMP
AllocDynamic(ISubPic
** ppSubPic
);
303 STDMETHODIMP_(bool) IsDynamicWriteOnly();
304 STDMETHODIMP
ChangeDevice(IUnknown
* pDev
);
305 STDMETHODIMP
SetMaxTextureSize(SIZE MaxTextureSize
) {
310 class CSubPicExAllocatorImpl
: public CUnknown
, public ISubPicExAllocator
315 bool m_fDynamicWriteOnly
;
317 bool Alloc(bool fStatic
, ISubPic
** ppSubPic
);
319 virtual bool AllocEx(bool fStatic
, ISubPicEx
** ppSubPic
) = 0;
321 CComPtr
<ISubPicEx
> m_pStatic
;
322 bool m_fPow2Textures
;
324 CSubPicExAllocatorImpl(SIZE cursize
, bool fDynamicWriteOnly
, bool fPow2Textures
);
327 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
, void** ppv
);
331 STDMETHODIMP
SetCurSize(SIZE cursize
);
332 STDMETHODIMP
SetCurVidRect(RECT curvidrect
);
333 STDMETHODIMP
GetStatic(ISubPic
** ppSubPic
);
334 STDMETHODIMP
AllocDynamic(ISubPic
** ppSubPic
);
335 STDMETHODIMP_(bool) IsDynamicWriteOnly();
336 STDMETHODIMP
ChangeDevice(IUnknown
* pDev
);
337 STDMETHODIMP
SetMaxTextureSize(SIZE MaxTextureSize
) {
341 // ISubPicExAllocator
342 STDMETHODIMP_(bool) IsSpdColorTypeSupported(int type
);
343 STDMETHODIMP_(int) SetSpdColorType(int color_type
);
345 STDMETHODIMP
GetStaticEx(ISubPicEx
** ppSubPic
);
346 STDMETHODIMP
AllocDynamicEx(ISubPicEx
** ppSubPic
);