X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=activex%2Fviewobject.cpp;h=a194ff71af2d77dee01ae2eb815b230b91f85c7b;hb=6ee1e193fd896ab9a4729fde14f009d9ce629815;hp=4cd39c4bebbf7944b3a49acb3ed142995985a8b5;hpb=da4dc63b33a3cbffa38513107882a05f2043d17c;p=vlc diff --git a/activex/viewobject.cpp b/activex/viewobject.cpp index 4cd39c4beb..a194ff71af 100644 --- a/activex/viewobject.cpp +++ b/activex/viewobject.cpp @@ -1,7 +1,7 @@ /***************************************************************************** * viewobject.cpp: ActiveX control for VLC ***************************************************************************** - * Copyright (C) 2005 VideoLAN + * Copyright (C) 2005 the VideoLAN team * * Authors: Damien Fouilleul * @@ -17,7 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #include "plugin.h" @@ -33,12 +33,35 @@ STDMETHODIMP VLCViewObject::Draw(DWORD dwAspect, LONG lindex, PVOID pvAspect, { if( dwAspect & DVASPECT_CONTENT ) { - RECT bounds; - bounds.left = lprcBounds->left; - bounds.top = lprcBounds->top; - bounds.right = lprcBounds->right; - bounds.bottom = lprcBounds->bottom; - _p_instance->onPaint(hdcDraw, bounds, bounds); + if( NULL == lprcBounds ) + return E_INVALIDARG; + + BOOL releaseDC = FALSE; + SIZEL size = _p_instance->getExtent(); + + if( NULL == ptd ) + { + hicTargetDev = CreateDevDC(NULL); + releaseDC = TRUE; + } + DPFromHimetric(hicTargetDev, (LPPOINT)&size, 1); + + RECTL bounds = { 0L, 0L, size.cx, size.cy }; + + int sdc = SaveDC(hdcDraw); + SetMapMode(hdcDraw, MM_ANISOTROPIC); + SetWindowOrgEx(hdcDraw, 0, 0, NULL); + SetWindowExtEx(hdcDraw, size.cx, size.cy, NULL); + OffsetViewportOrgEx(hdcDraw, lprcBounds->left, lprcBounds->top, NULL); + SetViewportExtEx(hdcDraw, lprcBounds->right-lprcBounds->left, + lprcBounds->bottom-lprcBounds->top, NULL); + + _p_instance->onDraw(ptd, hicTargetDev, hdcDraw, &bounds, lprcWBounds); + RestoreDC(hdcDraw, sdc); + + if( releaseDC ) + DeleteDC(hicTargetDev); + return S_OK; } return E_NOTIMPL; @@ -47,9 +70,6 @@ STDMETHODIMP VLCViewObject::Draw(DWORD dwAspect, LONG lindex, PVOID pvAspect, STDMETHODIMP VLCViewObject::Freeze(DWORD dwAspect, LONG lindex, PVOID pvAspect, LPDWORD pdwFreeze) { - if( NULL != pvAspect ) - return E_INVALIDARG; - return E_NOTIMPL; }; @@ -72,7 +92,7 @@ STDMETHODIMP VLCViewObject::GetAdvise(LPDWORD pdwAspect, LPDWORD padvf, return S_OK; }; -STDMETHODIMP VLCViewObject::GetColorSet(DWORD dwAspect, LONG lindex, +STDMETHODIMP VLCViewObject::GetColorSet(DWORD dwAspect, LONG lindex, PVOID pvAspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LPLOGPALETTE *ppColorSet) { return S_FALSE; @@ -81,7 +101,6 @@ STDMETHODIMP VLCViewObject::GetColorSet(DWORD dwAspect, LONG lindex, STDMETHODIMP VLCViewObject::SetAdvise(DWORD dwAspect, DWORD advf, LPADVISESINK pAdvSink) { - if( NULL != pAdvSink ) pAdvSink->AddRef();