diff options
Diffstat (limited to 'canvas/source/directx')
51 files changed, 950 insertions, 945 deletions
diff --git a/canvas/source/directx/dx_5rm.cxx b/canvas/source/directx/dx_5rm.cxx index 642ef7bd7db6..42cc316eabe4 100755 --- a/canvas/source/directx/dx_5rm.cxx +++ b/canvas/source/directx/dx_5rm.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -74,7 +74,7 @@ #include "dx_impltools.hxx" #include <malloc.h> -#if defined(DX_DEBUG_IMAGES) +#if defined(DX_DEBUG_IMAGES) # if OSL_DEBUG_LEVEL > 0 # include <imdebug.h> # undef min @@ -452,8 +452,8 @@ namespace dxcanvas return pDirectDraw2; } - HRESULT WINAPI EnumTextureFormatsCallback( LPDDSURFACEDESC pSurfaceDesc, - LPVOID pContext ) + HRESULT WINAPI EnumTextureFormatsCallback( LPDDSURFACEDESC pSurfaceDesc, + LPVOID pContext ) { // dirty cast of given context back to result ModeSelectContext DDPIXELFORMAT* pResult = (DDPIXELFORMAT*)pContext; @@ -586,7 +586,7 @@ namespace dxcanvas struct ModeSelectContext { DDSURFACEDESC selectedDesc; - ::basegfx::B2ISize requestedSize; + ::basegfx::B2ISize requestedSize; }; /** Query actual size of the device @@ -606,7 +606,7 @@ namespace dxcanvas @return the amount of free surface mem */ - std::size_t getAvailableSurfaceMem( bool bWithAGPMem=true ) const; + std::size_t getAvailableSurfaceMem( bool bWithAGPMem=true ) const; /** Query the amount of memory available for new textures @@ -642,15 +642,15 @@ namespace dxcanvas to serialize access to DirectX's global state, a global mutex is required. */ - static ::osl::Mutex maMutex; + static ::osl::Mutex maMutex; HWND mhWnd; - ::boost::scoped_ptr<SystemChildWindow> mpWindow; - ::basegfx::B2IVector maSize; - - ModeSelectContext maSelectedFullscreenMode; + ::boost::scoped_ptr<SystemChildWindow> mpWindow; + ::basegfx::B2IVector maSize; + + ModeSelectContext maSelectedFullscreenMode; DDPIXELFORMAT maTextureFormat; - + MONITORINFO maMonitorInfo; // monitor info for mpDirectDraw's monitor COMReference<IDirectDraw2> mpDirectDraw; COMReference<IDirectDrawSurface> mpPrimarySurface; @@ -659,23 +659,23 @@ namespace dxcanvas COMReference< IDirect3D2 > mpDirect3D; COMReference< IDirect3DDevice2 > mpDirect3DDevice; - mutable ::canvas::tools::ElapsedTime maLastUpdate; // for the frame counter + mutable ::canvas::tools::ElapsedTime maLastUpdate; // for the frame counter D3DDEVICEDESC maDeviceDesc; - typedef std::vector<canvas::Vertex> vertexCache_t; - vertexCache_t maVertexCache; - std::size_t mnCount; + typedef std::vector<canvas::Vertex> vertexCache_t; + vertexCache_t maVertexCache; + std::size_t mnCount; int mnBeginSceneCount; - - const bool mbPageFlipping; - bool mbHasNoTearingBlt; - bool mbError; - PrimitiveType meType; - - ::canvas::ISurfaceSharedPtr mpTexture; - ::basegfx::B2IVector maPageSize; + + const bool mbPageFlipping; + bool mbHasNoTearingBlt; + bool mbError; + PrimitiveType meType; + + ::canvas::ISurfaceSharedPtr mpTexture; + ::basegfx::B2IVector maPageSize; }; ::osl::Mutex DXRenderModule::maMutex; @@ -684,7 +684,7 @@ namespace dxcanvas // DXSurface::ImplRenderModuleGuard ////////////////////////////////////////////////////////////////////////////////// - inline DXSurface::ImplRenderModuleGuard::ImplRenderModuleGuard( + inline DXSurface::ImplRenderModuleGuard::ImplRenderModuleGuard( DXRenderModule& rRenderModule ) : mrRenderModule( rRenderModule ) { @@ -725,7 +725,7 @@ namespace dxcanvas ////////////////////////////////////////////////////////////////////////////////// DXSurface::DXSurface( DXRenderModule& rRenderModule, - const ::basegfx::B2ISize& rSize ) : + const ::basegfx::B2ISize& rSize ) : mrRenderModule(rRenderModule), mpTexture(NULL), mpSurface(NULL), @@ -746,7 +746,7 @@ namespace dxcanvas return; #endif - ENSURE_ARG_OR_THROW(rSize.getX() > 0 && rSize.getY() > 0, + ENSURE_ARG_OR_THROW(rSize.getX() > 0 && rSize.getY() > 0, "DXSurface::DXSurface(): request for zero-sized surface"); const D3DDEVICEDESC &deviceDesc = rRenderModule.getDeviceDesc(); @@ -838,7 +838,7 @@ namespace dxcanvas return false; } -#if defined(DX_DEBUG_IMAGES) +#if defined(DX_DEBUG_IMAGES) # if OSL_DEBUG_LEVEL > 0 if( mpSurface.is() ) { @@ -846,14 +846,14 @@ namespace dxcanvas rtl_fillMemory( &aSurfaceDesc,sizeof(DDSURFACEDESC),0 ); aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC); - if( SUCCEEDED(mpSurface->Lock( NULL, - &aSurfaceDesc, + if( SUCCEEDED(mpSurface->Lock( NULL, + &aSurfaceDesc, DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_READONLY, NULL)) ) { - imdebug( "rgba w=%d h=%d %p", - aSurfaceDesc.dwWidth, - aSurfaceDesc.dwHeight, + imdebug( "rgba w=%d h=%d %p", + aSurfaceDesc.dwWidth, + aSurfaceDesc.dwHeight, aSurfaceDesc.lpSurface ); mpSurface->Unlock(NULL); @@ -876,7 +876,7 @@ namespace dxcanvas if(!(mpSurface.is())) return false; - if(mpSurface->IsLost() == DDERR_SURFACELOST) + if(mpSurface->IsLost() == DDERR_SURFACELOST) { mpSurface->Restore(); return false; @@ -905,8 +905,8 @@ namespace dxcanvas aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC); // TODO(P2): only lock the region we want to update - if( FAILED(mpSurface->Lock( NULL, - &aSurfaceDesc, + if( FAILED(mpSurface->Lock( NULL, + &aSurfaceDesc, DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_WRITEONLY, NULL)) ) return false; @@ -924,7 +924,7 @@ namespace dxcanvas // calculate the destination memory address sal_uInt8 *pDst = ((sal_uInt8*)aSurfaceDesc.lpSurface+ - (rDestPos.getY()*aSurfaceDesc.lPitch) + + (rDestPos.getY()*aSurfaceDesc.lPitch) + (4*rDestPos.getX())); const sal_uInt32 nNumBytesToCopy( @@ -952,7 +952,7 @@ namespace dxcanvas // calculate the destination memory address sal_uInt8 *pDst = ((sal_uInt8*)aSurfaceDesc.lpSurface+ - (rDestPos.getY()*aSurfaceDesc.lPitch) + + (rDestPos.getY()*aSurfaceDesc.lPitch) + (4*rDestPos.getX())); const sal_uInt64 nNumColumns(rSourceRect.getWidth()); @@ -986,7 +986,7 @@ namespace dxcanvas // calculate the destination memory address sal_uInt8 *pDst = ((sal_uInt8*)aSurfaceDesc.lpSurface+ - (rDestPos.getY()*aSurfaceDesc.lPitch) + + (rDestPos.getY()*aSurfaceDesc.lPitch) + (4*rDestPos.getX())); const sal_uInt64 nNumLines(rSourceRect.getHeight()); @@ -1005,7 +1005,7 @@ namespace dxcanvas break; default: - ENSURE_OR_RETURN_FALSE(false, + ENSURE_OR_RETURN_FALSE(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } @@ -1019,7 +1019,7 @@ namespace dxcanvas ////////////////////////////////////////////////////////////////////////////////// // DXSurface::getSize ////////////////////////////////////////////////////////////////////////////////// - + ::basegfx::B2IVector DXSurface::getSize() { return maSize; @@ -1103,19 +1103,19 @@ namespace dxcanvas maVertexCache.reserve(1024); - mpWindow.reset( + mpWindow.reset( new SystemChildWindow( const_cast<Window *>(&rWindow), 0) ); // system child window must not receive mouse events mpWindow->SetMouseTransparent( TRUE ); - + // parent should receive paint messages as well // [PARENTCLIPMODE_NOCLIP], the argument is here // passed as plain numeric value since the stupid // define utilizes a USHORT cast. mpWindow->SetParentClipMode(0x0002); - + // the system child window must not clear its background mpWindow->EnableEraseBackground( FALSE ); @@ -1143,7 +1143,7 @@ namespace dxcanvas MonitorList aMonitorList; fillMonitorList( aMonitorList ); - + mpDirectDraw = COMReference<IDirectDraw2>( createDirectDraw(aMonitorList, maMonitorInfo, mhWnd)); @@ -1191,8 +1191,8 @@ namespace dxcanvas // check for supported primary surface formats... unsigned int nDisplayFormat = getDisplayFormat() & 0x00000FFF; - if(nDisplayFormat != 0x888 && nDisplayFormat != 0x565) - { + if(nDisplayFormat != 0x888 && nDisplayFormat != 0x565) + { // go defunct, and exit VERBOSE_TRACE( "Device::Device(): Unsupported DisplayFormat" ); mpDirectDraw.reset(); @@ -1200,7 +1200,7 @@ namespace dxcanvas } // create primary surface reference - DDSURFACEDESC aSurfaceDesc; + DDSURFACEDESC aSurfaceDesc; IDirectDrawSurface* pPrimarySurface; rtl_fillMemory( &aSurfaceDesc, @@ -1348,7 +1348,7 @@ namespace dxcanvas { // create and setup 3D device // ========================== - LPDIRECT3D2 pDirect3D; + LPDIRECT3D2 pDirect3D; if( FAILED( mpDirectDraw->QueryInterface( IID_IDirect3D2, (LPVOID*)&pDirect3D ) ) ) { // go defunct, and exit @@ -1360,8 +1360,8 @@ namespace dxcanvas LPDIRECT3DDEVICE2 pDirect3DDevice; // try HW-accelerated device first - if( FAILED(mpDirect3D->CreateDevice( IID_IDirect3DHALDevice, - mpBackBufferSurface.get(), + if( FAILED(mpDirect3D->CreateDevice( IID_IDirect3DHALDevice, + mpBackBufferSurface.get(), &pDirect3DDevice )) ) { // no HW 3D support - go defunct, and exit @@ -1375,7 +1375,7 @@ namespace dxcanvas rtl_fillMemory(&aHELDeviceDesc,sizeof(aHELDeviceDesc),0); maDeviceDesc.dwSize = sizeof(maDeviceDesc); aHELDeviceDesc.dwSize = sizeof(aHELDeviceDesc); - if(FAILED(pDirect3DDevice->GetCaps(&maDeviceDesc,&aHELDeviceDesc))) + if(FAILED(pDirect3DDevice->GetCaps(&maDeviceDesc,&aHELDeviceDesc))) { // go defunct, and exit VERBOSE_TRACE( "Device::setup3DDevice(): GetCaps() for Direct3DDevice failed" ); @@ -1403,7 +1403,7 @@ namespace dxcanvas else if(maTextureFormat.dwBBitMask != 0x000000FF) bSupportedFormat = false; - if(bSupportedFormat) + if(bSupportedFormat) { VERBOSE_TRACE( "Device::setup3DDevice(): chose texture format dwRGBBitCount %d, dwRBitMask %x, " "dwGBitMask %x, dwBBitMask %x and dwRGBAlphaBitMask %x. The texture uses %s alpha.", @@ -1413,11 +1413,11 @@ namespace dxcanvas maTextureFormat.dwBBitMask, maTextureFormat.dwRGBAlphaBitMask, maTextureFormat.dwFlags & DDPF_ALPHAPREMULT ? "premultiplied" : "non-premultiplied" ); - + // setup the device (with as much as we can possibly do here) // ========================================================== - LPDIRECT3DVIEWPORT2 pViewport; + LPDIRECT3DVIEWPORT2 pViewport; if( SUCCEEDED(mpDirect3D->CreateViewport( &pViewport, NULL )) ) { @@ -1499,8 +1499,8 @@ namespace dxcanvas bool DXRenderModule::queryCaps() { - DDCAPS aHWCaps; - DDCAPS aHELCaps; + DDCAPS aHWCaps; + DDCAPS aHELCaps; rtl_fillMemory( &aHWCaps, sizeof(aHWCaps), 0 ); @@ -1518,12 +1518,12 @@ namespace dxcanvas mbHasNoTearingBlt = aHWCaps.dwFXCaps & DDBLTFX_NOTEARING; VERBOSE_TRACE( "dxcanvas initialization: %d bytes VRAM free for surfaces (%d with AGP mem), " - "%d bytes VRAM free for textures (%d with AGP mem)", + "%d bytes VRAM free for textures (%d with AGP mem)", getAvailableSurfaceMem( false ), getAvailableSurfaceMem( true ), getAvailableTextureMem( false ), getAvailableTextureMem( true ) ); - + return true; } @@ -1559,7 +1559,7 @@ namespace dxcanvas // DXRenderModule::getDisplayFormat ////////////////////////////////////////////////////////////////////////////////// - unsigned int DXRenderModule::getDisplayFormat() const + unsigned int DXRenderModule::getDisplayFormat() const { unsigned int nFormat; nFormat = ::canvas::tools::bitcount32(maSelectedFullscreenMode.selectedDesc.ddpfPixelFormat.dwRGBAlphaBitMask)<<12; @@ -1581,7 +1581,7 @@ namespace dxcanvas std::size_t nRes( 0 ); DDSCAPS aSurfaceCaps; - DWORD nTotal, nFree; + DWORD nTotal, nFree; // real VRAM (const_cast, since GetAvailableVidMem is non-const) aSurfaceCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM; @@ -1596,7 +1596,7 @@ namespace dxcanvas aSurfaceCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY | DDSCAPS_NONLOCALVIDMEM; if( FAILED(const_cast<IDirectDraw2&>(*mpDirectDraw).GetAvailableVidMem( &aSurfaceCaps, &nTotal, &nFree )) ) return 0; - + nRes += nFree; } @@ -1615,7 +1615,7 @@ namespace dxcanvas std::size_t nRes( 0 ); DDSCAPS aSurfaceCaps; - DWORD nTotal, nFree; + DWORD nTotal, nFree; // TODO(F1): Check if flags are applicable @@ -1632,7 +1632,7 @@ namespace dxcanvas aSurfaceCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY | DDSCAPS_NONLOCALVIDMEM; if( FAILED(const_cast<IDirectDraw2&>(*mpDirectDraw).GetAvailableVidMem( &aSurfaceCaps, &nTotal, &nFree )) ) return 0; - + nRes += nFree; } @@ -1650,13 +1650,13 @@ namespace dxcanvas { POINT aPoint = { 0, 0 }; ClientToScreen( mhWnd, &aPoint ); - + // i52230 make sure given screen coordinate is relative to // this monitor's area (the device rendering is always // contained to a single monitor) aPoint.x -= maMonitorInfo.rcMonitor.left; aPoint.y -= maMonitorInfo.rcMonitor.top; - + io_rDestPos.setX( io_rDestPos.getX() + aPoint.x ); io_rDestPos.setY( io_rDestPos.getY() + aPoint.y ); @@ -1684,7 +1684,7 @@ namespace dxcanvas COMReference<IDirectDrawSurface> DXRenderModule::createSystemMemorySurface( const ::basegfx::B2IVector& rSize ) { - DDSURFACEDESC aSurfaceDesc; + DDSURFACEDESC aSurfaceDesc; IDirectDrawSurface* pSurface; aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC); @@ -1695,7 +1695,7 @@ namespace dxcanvas rtl_copyMemory( &aSurfaceDesc.ddpfPixelFormat, &maTextureFormat, sizeof(DDPIXELFORMAT) ); aSurfaceDesc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; - + HRESULT nRes = mpDirectDraw->CreateSurface(&aSurfaceDesc, &pSurface, NULL); if(FAILED(nRes)) return COMReference<IDirectDrawSurface>(NULL); @@ -1739,7 +1739,7 @@ namespace dxcanvas renderMemAvailable(); #endif VERBOSE_TRACE( "Device::flip(): Using true page flipping" ); - + // use true page flipping. Hopefully, the 3D hardware // is flushed on this flip call (rumours have it that // way), otherwise, perform the Lock hack as for the @@ -1774,7 +1774,7 @@ namespace dxcanvas // target (the backbuffer in this case). OTOH, I've // found that this tends to degrade performance // significantly on complying cards... - + // TODO(P1): Up until rev. 1.3, this method contained // code to make sure the blit will start _immediately_ // after the Blt call. If this is not warranted, wait @@ -1798,14 +1798,14 @@ namespace dxcanvas DDBLTFX* pBltFX = NULL; if( mbHasNoTearingBlt ) { - // Blt can internally schedule for no-tearing - // =========================================== - + // Blt can internally schedule for no-tearing + // =========================================== + rtl_fillMemory( &aBltFx, sizeof(aBltFx), 0 ); aBltFx.dwSize = sizeof(aBltFx); aBltFx.dwDDFX = DDBLTFX_NOTEARING; - + pBltFX = &aBltFx; } @@ -1863,7 +1863,7 @@ namespace dxcanvas // DXRenderModule::validateMainSurfaces ////////////////////////////////////////////////////////////////////////////////// - bool DXRenderModule::validateMainSurfaces() + bool DXRenderModule::validateMainSurfaces() { if(mpPrimarySurface.get()) { if(mpPrimarySurface->IsLost() == DDERR_SURFACELOST) { @@ -1873,20 +1873,20 @@ namespace dxcanvas } if(mpBackBufferSurface.get()) { - if(mpBackBufferSurface->IsLost() == DDERR_SURFACELOST) - { + if(mpBackBufferSurface->IsLost() == DDERR_SURFACELOST) + { // TODO(F1): simply restoring the backbuffer does not // work as expected, we need to re-create everything // from scratch. find out why... //if(SUCCEEDED(mpBackBufferSurface->Restore())) - // return setup3DDevice(); + // return setup3DDevice(); mpBackBufferSurface.reset(); // get us a backbuffer for simulated flipping IDirectDrawSurface* pSurface; - // TODO(P2): Strictly speaking, we don't need a full screen worth of + // TODO(P2): Strictly speaking, we don't need a full screen worth of // backbuffer here. We could also scale dynamically with the current // window size, but this will make it necessary to temporarily have two // buffers while copying from the old to the new one. YMMV. @@ -1949,16 +1949,16 @@ namespace dxcanvas if( mbPageFlipping ) { - // render on top of backbuffer. We have + // render on top of backbuffer. We have // page flipping, anyway, thus this will // cost us nothing. pGraphics = createSurfaceGraphics( mpBackBufferSurface ); } else { - // render FPS directly to front buffer. + // render FPS directly to front buffer. // That saves us another explicit blit, - // and for me, the FPS counter can blink, + // and for me, the FPS counter can blink, // if it likes to... pGraphics = createSurfaceGraphics( mpPrimarySurface ); } @@ -1968,16 +1968,16 @@ namespace dxcanvas // clear background. We might be doing optimized redraws, // and the background under the FPS count will then not be // cleared. - Gdiplus::SolidBrush aBrush( + Gdiplus::SolidBrush aBrush( Gdiplus::Color( 255, 255, 255 ) ); pGraphics->FillRectangle( &aBrush, rPos.X, rPos.Y, 80.0, 20.0 ); } - Gdiplus::SolidBrush aBrush( + Gdiplus::SolidBrush aBrush( Gdiplus::Color( 255, 0, 255 ) ); - Gdiplus::Font aFont( NULL, + Gdiplus::Font aFont( NULL, 16, Gdiplus::FontStyleRegular, Gdiplus::UnitWorld, @@ -1999,7 +1999,7 @@ namespace dxcanvas "DXRenderModule::renderMemAvailable(): within 3D scene" ); const double nSurfaceMem( getAvailableSurfaceMem()/1024 ); - + ::rtl::OUString text( ::rtl::math::doubleToUString( nSurfaceMem, rtl_math_StringFormat_F, 2,'.',NULL,' ') ); @@ -2028,7 +2028,7 @@ namespace dxcanvas renderInfoText( text, Gdiplus::PointF( 0.0, 40) ); - VERBOSE_TRACE( "dxcanvas: %f free surface mem, %f free texture mem", + VERBOSE_TRACE( "dxcanvas: %f free surface mem, %f free texture mem", nSurfaceMem, nTexMem ); } @@ -2043,7 +2043,7 @@ namespace dxcanvas const double denominator( maLastUpdate.getElapsedTime() ); maLastUpdate.reset(); - + ::rtl::OUString text( ::rtl::math::doubleToUString( denominator == 0.0 ? 100.0 : 1.0/denominator, rtl_math_StringFormat_F, 2,'.',NULL,' ') ); @@ -2055,9 +2055,9 @@ namespace dxcanvas text += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM (" fps")); renderInfoText( text, - Gdiplus::PointF() ); + Gdiplus::PointF() ); - VERBOSE_TRACE( "dxcanvas: %f FPS", + VERBOSE_TRACE( "dxcanvas: %f FPS", denominator == 0.0 ? 100.0 : 1.0/denominator ); } @@ -2111,7 +2111,7 @@ namespace dxcanvas if(mpTexture.use_count() == 1) return mpTexture; - return ::canvas::ISurfaceSharedPtr( + return ::canvas::ISurfaceSharedPtr( new DXSurface(*this, aSize) ); } @@ -2264,7 +2264,7 @@ namespace dxcanvas maVertexCache.clear(); - mbError |= FAILED(mpDirect3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, + mbError |= FAILED(mpDirect3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DVT_TLVERTEX, (LPVOID)vertices, size, diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index a0f485befa12..af520e90e537 100755 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -73,7 +73,7 @@ #include "dx_impltools.hxx" #include <vcl/sysdata.hxx> -#if defined(DX_DEBUG_IMAGES) +#if defined(DX_DEBUG_IMAGES) # if OSL_DEBUG_LEVEL > 0 # include <imdebug.h> # undef min @@ -171,7 +171,7 @@ namespace dxcanvas public: explicit inline ImplRenderModuleGuard( DXRenderModule& rRenderModule ); inline ~ImplRenderModuleGuard(); - + private: DXRenderModule& mrRenderModule; }; @@ -193,7 +193,7 @@ namespace dxcanvas public: explicit DXRenderModule( const ::Window& rWindow ); ~DXRenderModule(); - + virtual void lock() const { maMutex.acquire(); } virtual void unlock() const { maMutex.release(); } @@ -225,7 +225,7 @@ namespace dxcanvas bool createDevice(); bool verifyDevice( const UINT nAdapter ); UINT getAdapterFromWindow(); - + /** This object represents the DirectX state machine. In order to serialize access to DirectX's global state, a global mutex is required. @@ -259,7 +259,7 @@ namespace dxcanvas float u,v; }; - std::size_t maNumVertices; + std::size_t maNumVertices; std::size_t maWriteIndex; std::size_t maReadIndex; }; @@ -270,7 +270,7 @@ namespace dxcanvas // DXSurface::ImplRenderModuleGuard ////////////////////////////////////////////////////////////////////////////////// - inline DXSurface::ImplRenderModuleGuard::ImplRenderModuleGuard( + inline DXSurface::ImplRenderModuleGuard::ImplRenderModuleGuard( DXRenderModule& rRenderModule ) : mrRenderModule( rRenderModule ) { @@ -311,7 +311,7 @@ namespace dxcanvas ////////////////////////////////////////////////////////////////////////////////// DXSurface::DXSurface( DXRenderModule& rRenderModule, - const ::basegfx::B2ISize& rSize ) : + const ::basegfx::B2ISize& rSize ) : mrRenderModule(rRenderModule), mpTexture(NULL), maSize() @@ -331,7 +331,7 @@ namespace dxcanvas return; #endif - ENSURE_ARG_OR_THROW(rSize.getX() > 0 && rSize.getY() > 0, + ENSURE_ARG_OR_THROW(rSize.getX() > 0 && rSize.getY() > 0, "DXSurface::DXSurface(): request for zero-sized surface"); COMReference<IDirect3DDevice9> pDevice(rRenderModule.getDevice()); @@ -418,7 +418,7 @@ namespace dxcanvas rect.bottom = std::min(maSize.getY(), rect.top + sal_Int32(rSourceRect.getHeight()+1)); const bool bClearRightColumn( rect.right < maSize.getX() ); - const bool bClearBottomRow( rect.bottom < maSize.getY() ); + const bool bClearBottomRow( rect.bottom < maSize.getY() ); if(SUCCEEDED(mpTexture->LockRect(0,&aLockedRect,&rect,D3DLOCK_NOSYSLOCK))) { @@ -453,9 +453,9 @@ namespace dxcanvas // manager allocates one pixel gap // between them. Clear that to // transparent. - pDst[nNumBytesToCopy] = - pDst[nNumBytesToCopy+1] = - pDst[nNumBytesToCopy+2] = + pDst[nNumBytesToCopy] = + pDst[nNumBytesToCopy+1] = + pDst[nNumBytesToCopy+2] = pDst[nNumBytesToCopy+3] = 0x00; } pDst += aLockedRect.Pitch; @@ -541,7 +541,7 @@ namespace dxcanvas break; default: - ENSURE_OR_RETURN_FALSE(false, + ENSURE_OR_RETURN_FALSE(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } @@ -558,7 +558,7 @@ namespace dxcanvas ////////////////////////////////////////////////////////////////////////////////// // DXSurface::getSize ////////////////////////////////////////////////////////////////////////////////// - + ::basegfx::B2IVector DXSurface::getSize() { return maSize; @@ -625,7 +625,7 @@ namespace dxcanvas } } maPageSize=aPageSize; - + IDirect3DVertexBuffer9 *pVB(NULL); DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1); if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices, @@ -682,19 +682,19 @@ namespace dxcanvas maVertexCache.reserve(1024); - mpWindow.reset( + mpWindow.reset( new SystemChildWindow( const_cast<Window *>(&rWindow), 0) ); // system child window must not receive mouse events mpWindow->SetMouseTransparent( TRUE ); - + // parent should receive paint messages as well // [PARENTCLIPMODE_NOCLIP], the argument is here // passed as plain numeric value since the stupid // define utilizes a USHORT cast. mpWindow->SetParentClipMode(0x0002); - + // the system child window must not clear its background mpWindow->EnableEraseBackground( FALSE ); @@ -763,7 +763,7 @@ namespace dxcanvas D3DADAPTER_IDENTIFIER9 aIdent; if(FAILED(mpDirect3D9->GetAdapterIdentifier(nAdapter,0,&aIdent))) return false; - + DXCanvasItem aConfigItem; DXCanvasItem::DeviceInfo aInfo; aInfo.nVendorId = aIdent.VendorId; @@ -940,13 +940,13 @@ namespace dxcanvas flushVertexCache(); - // TODO(P2): Might be faster to actually pass update area here - RECT aRect = + // TODO(P2): Might be faster to actually pass update area here + RECT aRect = { rUpdateArea.getMinX(), rUpdateArea.getMinY(), rUpdateArea.getMaxX(), - rUpdateArea.getMaxY() + rUpdateArea.getMaxY() }; HRESULT hr(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0)); if(FAILED(hr)) @@ -1182,7 +1182,7 @@ namespace dxcanvas } default: - OSL_ENSURE(false, + OSL_ENSURE(false, "DXRenderModule::pushVertex(): unexpected primitive type"); break; } @@ -1217,7 +1217,7 @@ namespace dxcanvas ////////////////////////////////////////////////////////////////////////////////// // DXRenderModule::commitVertexCache ////////////////////////////////////////////////////////////////////////////////// - + void DXRenderModule::commitVertexCache() { if(maReadIndex != maWriteIndex) diff --git a/canvas/source/directx/dx_bitmap.cxx b/canvas/source/directx/dx_bitmap.cxx index d1468105a22b..f3fd7e3038aa 100755 --- a/canvas/source/directx/dx_bitmap.cxx +++ b/canvas/source/directx/dx_bitmap.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,7 +38,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/range/b2irange.hxx> -#if defined(DX_DEBUG_IMAGES) +#if defined(DX_DEBUG_IMAGES) # if OSL_DEBUG_LEVEL > 0 # include <imdebug.h> # undef min @@ -55,7 +55,7 @@ namespace dxcanvas ////////////////////////////////////////////////////////////////////////////////// DXBitmap::DXBitmap( const BitmapSharedPtr& rBitmap, - bool bWithAlpha ) : + bool bWithAlpha ) : mpGdiPlusUser( GDIPlusUser::createInstance() ), maSize(rBitmap->GetWidth(),rBitmap->GetHeight()), mpBitmap(rBitmap), @@ -65,7 +65,7 @@ namespace dxcanvas } DXBitmap::DXBitmap( const ::basegfx::B2IVector& rSize, - bool bWithAlpha ) : + bool bWithAlpha ) : mpGdiPlusUser( GDIPlusUser::createInstance() ), maSize(rSize), mpBitmap(), @@ -75,16 +75,16 @@ namespace dxcanvas // create container for pixel data if(mbAlpha) { - mpBitmap.reset( - new Gdiplus::Bitmap( + mpBitmap.reset( + new Gdiplus::Bitmap( maSize.getX(), maSize.getY(), PixelFormat32bppARGB)); } else { - mpBitmap.reset( - new Gdiplus::Bitmap( + mpBitmap.reset( + new Gdiplus::Bitmap( maSize.getX(), maSize.getY(), PixelFormat24bppRGB)); @@ -113,7 +113,7 @@ namespace dxcanvas return mbAlpha; } - uno::Sequence< sal_Int8 > DXBitmap::getData( rendering::IntegerBitmapLayout& /*bitmapLayout*/, + uno::Sequence< sal_Int8 > DXBitmap::getData( rendering::IntegerBitmapLayout& /*bitmapLayout*/, const geometry::IntegerRectangle2D& rect ) { uno::Sequence< sal_Int8 > aRes( (rect.X2-rect.X1)*(rect.Y2-rect.Y1)*4 ); // TODO(F1): Be format-agnostic here @@ -121,11 +121,11 @@ namespace dxcanvas const Gdiplus::Rect aRect( tools::gdiPlusRectFromIntegerRectangle2D( rect ) ); Gdiplus::BitmapData aBmpData; - aBmpData.Width = rect.X2-rect.X1; - aBmpData.Height = rect.Y2-rect.Y1; - aBmpData.Stride = 4*aBmpData.Width; + aBmpData.Width = rect.X2-rect.X1; + aBmpData.Height = rect.Y2-rect.Y1; + aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = aRes.getArray(); + aBmpData.Scan0 = aRes.getArray(); // TODO(F1): Support more pixel formats natively @@ -147,18 +147,18 @@ namespace dxcanvas return aRes; } - void DXBitmap::setData( const uno::Sequence< sal_Int8 >& data, - const rendering::IntegerBitmapLayout& /*bitmapLayout*/, - const geometry::IntegerRectangle2D& rect ) + void DXBitmap::setData( const uno::Sequence< sal_Int8 >& data, + const rendering::IntegerBitmapLayout& /*bitmapLayout*/, + const geometry::IntegerRectangle2D& rect ) { const Gdiplus::Rect aRect( tools::gdiPlusRectFromIntegerRectangle2D( rect ) ); Gdiplus::BitmapData aBmpData; - aBmpData.Width = rect.X2-rect.X1; - aBmpData.Height = rect.Y2-rect.Y1; - aBmpData.Stride = 4*aBmpData.Width; + aBmpData.Width = rect.X2-rect.X1; + aBmpData.Height = rect.Y2-rect.Y1; + aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = (void*)data.getConstArray(); + aBmpData.Scan0 = (void*)data.getConstArray(); // TODO(F1): Support more pixel formats natively @@ -178,40 +178,40 @@ namespace dxcanvas } void DXBitmap::setPixel( const uno::Sequence< sal_Int8 >& color, - const rendering::IntegerBitmapLayout& /*bitmapLayout*/, + const rendering::IntegerBitmapLayout& /*bitmapLayout*/, const geometry::IntegerPoint2D& pos ) { const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() ); - ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, + ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, "CanvasHelper::setPixel: X coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height, + ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height, "CanvasHelper::setPixel: Y coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( color.getLength() > 3, + ENSURE_ARG_OR_THROW( color.getLength() > 3, "CanvasHelper::setPixel: not enough color components" ); - if( Gdiplus::Ok != mpBitmap->SetPixel( pos.X, pos.Y, + if( Gdiplus::Ok != mpBitmap->SetPixel( pos.X, pos.Y, Gdiplus::Color( tools::sequenceToArgb( color )))) { throw uno::RuntimeException(); } } - uno::Sequence< sal_Int8 > DXBitmap::getPixel( rendering::IntegerBitmapLayout& /*bitmapLayout*/, + uno::Sequence< sal_Int8 > DXBitmap::getPixel( rendering::IntegerBitmapLayout& /*bitmapLayout*/, const geometry::IntegerPoint2D& pos ) { const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() ); - ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, + ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, "CanvasHelper::getPixel: X coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height, + ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height, "CanvasHelper::getPixel: Y coordinate out of bounds" ); Gdiplus::Color aColor; if( Gdiplus::Ok != mpBitmap->GetPixel( pos.X, pos.Y, &aColor ) ) return uno::Sequence< sal_Int8 >(); - + return tools::argbToIntSequence(aColor.GetValue()); } diff --git a/canvas/source/directx/dx_bitmap.hxx b/canvas/source/directx/dx_bitmap.hxx index 5e767994e16c..63feb769783b 100755 --- a/canvas/source/directx/dx_bitmap.hxx +++ b/canvas/source/directx/dx_bitmap.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -45,9 +45,9 @@ namespace dxcanvas { public: DXBitmap( const BitmapSharedPtr& rBitmap, - bool bWithAlpha ); + bool bWithAlpha ); DXBitmap( const ::basegfx::B2IVector& rSize, - bool bWithAlpha ); + bool bWithAlpha ); virtual GraphicsSharedPtr getGraphics(); @@ -56,22 +56,22 @@ namespace dxcanvas virtual bool hasAlpha() const; ::com::sun::star::uno::Sequence< sal_Int8 > getData( - ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerRectangle2D& rect ); + ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, + const ::com::sun::star::geometry::IntegerRectangle2D& rect ); void setData( - const ::com::sun::star::uno::Sequence< sal_Int8 >& data, + const ::com::sun::star::uno::Sequence< sal_Int8 >& data, const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerRectangle2D& rect ); + const ::com::sun::star::geometry::IntegerRectangle2D& rect ); void setPixel( - const ::com::sun::star::uno::Sequence< sal_Int8 >& color, + const ::com::sun::star::uno::Sequence< sal_Int8 >& color, const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerPoint2D& pos ); + const ::com::sun::star::geometry::IntegerPoint2D& pos ); ::com::sun::star::uno::Sequence< sal_Int8 > getPixel( - ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerPoint2D& pos ); + ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, + const ::com::sun::star::geometry::IntegerPoint2D& pos ); private: // Refcounted global GDI+ state container diff --git a/canvas/source/directx/dx_bitmapcanvashelper.cxx b/canvas/source/directx/dx_bitmapcanvashelper.cxx index 860b56401873..def7f222eddd 100755 --- a/canvas/source/directx/dx_bitmapcanvashelper.cxx +++ b/canvas/source/directx/dx_bitmapcanvashelper.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -99,11 +99,11 @@ namespace dxcanvas { GraphicsSharedPtr pGraphics( mpTarget->getGraphics() ); - Gdiplus::Color aClearColor = hasAlpha() ? + Gdiplus::Color aClearColor = hasAlpha() ? Gdiplus::Color( 0,255,255,255 ) : Gdiplus::Color((Gdiplus::ARGB)Gdiplus::Color::White); ENSURE_OR_THROW( - Gdiplus::Ok == pGraphics->SetCompositingMode( + Gdiplus::Ok == pGraphics->SetCompositingMode( Gdiplus::CompositingModeSourceCopy ), // force set, don't blend "BitmapCanvasHelper::clear(): GDI+ SetCompositingMode call failed" ); ENSURE_OR_THROW( @@ -112,26 +112,26 @@ namespace dxcanvas } } - uno::Reference< rendering::XCachedPrimitive > BitmapCanvasHelper::drawTextLayout( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XTextLayout >& xLayoutetText, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) + uno::Reference< rendering::XCachedPrimitive > BitmapCanvasHelper::drawTextLayout( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XTextLayout >& xLayoutetText, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState ) { - ENSURE_OR_THROW( xLayoutetText.is(), + ENSURE_OR_THROW( xLayoutetText.is(), "BitmapCanvasHelper::drawTextLayout: layout is NULL"); if( needOutput() ) { - TextLayout* pTextLayout = + TextLayout* pTextLayout = dynamic_cast< TextLayout* >( xLayoutetText.get() ); ENSURE_OR_THROW( pTextLayout, "BitmapCanvasHelper::drawTextLayout(): TextLayout not compatible with this canvas" ); pTextLayout->draw( mpTarget->getGraphics(), - viewState, - renderState, - maOutputOffset, + viewState, + renderState, + maOutputOffset, mpDevice, mpTarget->hasAlpha() ); } @@ -139,14 +139,14 @@ namespace dxcanvas return uno::Reference< rendering::XCachedPrimitive >(NULL); } - void BitmapCanvasHelper::copyRect( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XBitmapCanvas >& /*sourceCanvas*/, - const geometry::RealRectangle2D& /*sourceRect*/, - const rendering::ViewState& /*sourceViewState*/, - const rendering::RenderState& /*sourceRenderState*/, - const geometry::RealRectangle2D& /*destRect*/, - const rendering::ViewState& /*destViewState*/, - const rendering::RenderState& /*destRenderState*/ ) + void BitmapCanvasHelper::copyRect( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XBitmapCanvas >& /*sourceCanvas*/, + const geometry::RealRectangle2D& /*sourceRect*/, + const rendering::ViewState& /*sourceViewState*/, + const rendering::RenderState& /*sourceRenderState*/, + const geometry::RealRectangle2D& /*destRect*/, + const rendering::ViewState& /*destViewState*/, + const rendering::RenderState& /*destRenderState*/ ) { // TODO(F2): copyRect NYI } @@ -159,14 +159,14 @@ namespace dxcanvas return basegfx::unotools::integerSize2DFromB2ISize(mpTarget->getSize()); } - uno::Reference< rendering::XBitmap > BitmapCanvasHelper::getScaledBitmap( const geometry::RealSize2D& /*newSize*/, - sal_Bool /*beFast*/ ) + uno::Reference< rendering::XBitmap > BitmapCanvasHelper::getScaledBitmap( const geometry::RealSize2D& /*newSize*/, + sal_Bool /*beFast*/ ) { // TODO(F1): return uno::Reference< rendering::XBitmap >(); } - uno::Sequence< sal_Int8 > BitmapCanvasHelper::getData( rendering::IntegerBitmapLayout& bitmapLayout, + uno::Sequence< sal_Int8 > BitmapCanvasHelper::getData( rendering::IntegerBitmapLayout& bitmapLayout, const geometry::IntegerRectangle2D& rect ) { RTL_LOGFILE_CONTEXT( aLog, "::dxcanvas::BitmapCanvasHelper::getData()" ); @@ -176,14 +176,14 @@ namespace dxcanvas if( !mpTarget ) return uno::Sequence< sal_Int8 >(); - + bitmapLayout = getMemoryLayout(); return mpTarget->getData(bitmapLayout,rect); } - void BitmapCanvasHelper::setData( const uno::Sequence< sal_Int8 >& data, - const rendering::IntegerBitmapLayout& bitmapLayout, - const geometry::IntegerRectangle2D& rect ) + void BitmapCanvasHelper::setData( const uno::Sequence< sal_Int8 >& data, + const rendering::IntegerBitmapLayout& bitmapLayout, + const geometry::IntegerRectangle2D& rect ) { RTL_LOGFILE_CONTEXT( aLog, "::dxcanvas::BitmapCanvasHelper::setData()" ); @@ -196,8 +196,8 @@ namespace dxcanvas mpTarget->setData(data,bitmapLayout,rect); } - void BitmapCanvasHelper::setPixel( const uno::Sequence< sal_Int8 >& color, - const rendering::IntegerBitmapLayout& bitmapLayout, + void BitmapCanvasHelper::setPixel( const uno::Sequence< sal_Int8 >& color, + const rendering::IntegerBitmapLayout& bitmapLayout, const geometry::IntegerPoint2D& pos ) { RTL_LOGFILE_CONTEXT( aLog, "::dxcanvas::BitmapCanvasHelper::setPixel()" ); @@ -211,7 +211,7 @@ namespace dxcanvas mpTarget->setPixel(color,bitmapLayout,pos); } - uno::Sequence< sal_Int8 > BitmapCanvasHelper::getPixel( rendering::IntegerBitmapLayout& bitmapLayout, + uno::Sequence< sal_Int8 > BitmapCanvasHelper::getPixel( rendering::IntegerBitmapLayout& bitmapLayout, const geometry::IntegerPoint2D& pos ) { RTL_LOGFILE_CONTEXT( aLog, "::dxcanvas::BitmapCanvasHelper::getPixel()" ); diff --git a/canvas/source/directx/dx_bitmapcanvashelper.hxx b/canvas/source/directx/dx_bitmapcanvashelper.hxx index 411d8764dfc7..37dd0ebf2850 100755 --- a/canvas/source/directx/dx_bitmapcanvashelper.hxx +++ b/canvas/source/directx/dx_bitmapcanvashelper.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -80,33 +80,33 @@ namespace dxcanvas void clear(); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawTextLayout( const ::com::sun::star::rendering::XCanvas* pCanvas, + drawTextLayout( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout >& layoutetText, - const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::ViewState& viewState, const ::com::sun::star::rendering::RenderState& renderState ); // BitmapCanvasHelper functionality // ================================ - void copyRect( const ::com::sun::star::rendering::XCanvas* pCanvas, + void copyRect( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas, - const ::com::sun::star::geometry::RealRectangle2D& sourceRect, - const ::com::sun::star::rendering::ViewState& sourceViewState, - const ::com::sun::star::rendering::RenderState& sourceRenderState, - const ::com::sun::star::geometry::RealRectangle2D& destRect, - const ::com::sun::star::rendering::ViewState& destViewState, - const ::com::sun::star::rendering::RenderState& destRenderState ); + ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas, + const ::com::sun::star::geometry::RealRectangle2D& sourceRect, + const ::com::sun::star::rendering::ViewState& sourceViewState, + const ::com::sun::star::rendering::RenderState& sourceRenderState, + const ::com::sun::star::geometry::RealRectangle2D& destRect, + const ::com::sun::star::rendering::ViewState& destViewState, + const ::com::sun::star::rendering::RenderState& destRenderState ); ::com::sun::star::geometry::IntegerSize2D getSize(); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > - getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize, - sal_Bool beFast ); + getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize, + sal_Bool beFast ); ::com::sun::star::uno::Sequence< sal_Int8 > - getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, + getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, const ::com::sun::star::geometry::IntegerRectangle2D& rect ); void setData( const ::com::sun::star::uno::Sequence< sal_Int8 >& data, diff --git a/canvas/source/directx/dx_bitmapprovider.hxx b/canvas/source/directx/dx_bitmapprovider.hxx index 3eccf3c4939e..4e462218938f 100644 --- a/canvas/source/directx/dx_bitmapprovider.hxx +++ b/canvas/source/directx/dx_bitmapprovider.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/canvas/source/directx/dx_canvas.cxx b/canvas/source/directx/dx_canvas.cxx index f55467c1af50..d54e2141e026 100644 --- a/canvas/source/directx/dx_canvas.cxx +++ b/canvas/source/directx/dx_canvas.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -60,8 +60,8 @@ #include <vcl/sysdata.hxx> #define CANVAS_TECH "GDI+" -#define CANVAS_SERVICE_NAME "com.sun.star.rendering.Canvas." CANVAS_TECH -#define CANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.Canvas." CANVAS_TECH +#define CANVAS_SERVICE_NAME "com.sun.star.rendering.Canvas." CANVAS_TECH +#define CANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.Canvas." CANVAS_TECH #define BITMAPCANVAS_SERVICE_NAME "com.sun.star.rendering.BitmapCanvas." CANVAS_TECH #define BITMAPCANVAS_IMPLEMENTATION_NAME "com.sun.star.comp.rendering.BitmapCanvas." CANVAS_TECH @@ -98,7 +98,7 @@ namespace dxcanvas // pointer to a valid window, on which to output // At index 2, we expect the current window bound rect ENSURE_ARG_OR_THROW( maArguments.getLength() >= 6 && - maArguments[5].getValueTypeClass() == uno::TypeClass_SEQUENCE, + maArguments[5].getValueTypeClass() == uno::TypeClass_SEQUENCE, "SpriteCanvas::initialize: wrong number of arguments, or wrong types" ); uno::Sequence<sal_Int8> aSeq; @@ -109,15 +109,15 @@ namespace dxcanvas throw lang::NoSupportException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Passed SystemGraphicsData or HDC invalid!")), - NULL); - + NULL); + // setup helper maDeviceHelper.init( pSysData->hDC, *this ); maCanvasHelper.setDevice( *this ); - maCanvasHelper.setTarget( + maCanvasHelper.setTarget( GraphicsProviderSharedPtr( - new GraphicsProviderImpl( + new GraphicsProviderImpl( Gdiplus::Graphics::FromHDC(pSysData->hDC)))); maArguments.realloc(0); @@ -158,7 +158,7 @@ namespace dxcanvas // pointer to a valid window, on which to output // At index 2, we expect the current window bound rect ENSURE_ARG_OR_THROW( maArguments.getLength() >= 6 && - maArguments[5].getValueTypeClass() == uno::TypeClass_SEQUENCE, + maArguments[5].getValueTypeClass() == uno::TypeClass_SEQUENCE, "SpriteCanvas::initialize: wrong number of arguments, or wrong types" ); uno::Sequence<sal_Int8> aSeq; @@ -169,8 +169,8 @@ namespace dxcanvas throw lang::NoSupportException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Passed SystemGraphicsData or HDC invalid!")), - NULL); - + NULL); + // setup helper maDeviceHelper.init( pSysData->hDC, *this ); diff --git a/canvas/source/directx/dx_canvas.hxx b/canvas/source/directx/dx_canvas.hxx index be15b875c4b6..64d9a1f42b17 100644 --- a/canvas/source/directx/dx_canvas.hxx +++ b/canvas/source/directx/dx_canvas.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -61,15 +61,15 @@ namespace dxcanvas ::com::sun::star::lang::XMultiServiceFactory, ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, - ::com::sun::star::lang::XServiceName > GraphicDeviceBase1_Base; + ::com::sun::star::lang::XServiceName > GraphicDeviceBase1_Base; typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase1_Base >, DeviceHelper, ::osl::MutexGuard, - ::cppu::OWeakObject > CanvasBase1_Base; + ::cppu::OWeakObject > CanvasBase1_Base; typedef ::canvas::CanvasBase< CanvasBase1_Base, CanvasHelper, ::osl::MutexGuard, - ::cppu::OWeakObject > CanvasBaseT; + ::cppu::OWeakObject > CanvasBaseT; /** Product of this component's factory. @@ -118,15 +118,15 @@ namespace dxcanvas ::com::sun::star::lang::XMultiServiceFactory, ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, - ::com::sun::star::lang::XServiceName > GraphicDeviceBase2_Base; + ::com::sun::star::lang::XServiceName > GraphicDeviceBase2_Base; typedef ::canvas::GraphicDeviceBase< ::canvas::BaseMutexHelper< GraphicDeviceBase2_Base >, DeviceHelper, ::osl::MutexGuard, - ::cppu::OWeakObject > CanvasBase2_Base; + ::cppu::OWeakObject > CanvasBase2_Base; typedef ::canvas::IntegerBitmapBase< CanvasBase2_Base, BitmapCanvasHelper, ::osl::MutexGuard, - ::cppu::OWeakObject > BitmapCanvasBaseT; + ::cppu::OWeakObject > BitmapCanvasBaseT; /** Product of this component's factory. diff --git a/canvas/source/directx/dx_canvasbitmap.cxx b/canvas/source/directx/dx_canvasbitmap.cxx index f15af7745422..db1a5f93747a 100755 --- a/canvas/source/directx/dx_canvasbitmap.cxx +++ b/canvas/source/directx/dx_canvasbitmap.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -69,8 +69,8 @@ namespace dxcanvas } struct AlphaDIB - { - BITMAPINFOHEADER bmiHeader; + { + BITMAPINFOHEADER bmiHeader; RGBQUAD bmiColors[256]; }; @@ -80,15 +80,15 @@ namespace dxcanvas // 0 ... get BitmapEx // 1 ... get Pixbuf with bitmap RGB content // 2 ... get Pixbuf with bitmap alpha mask - switch( nHandle ) + switch( nHandle ) { // sorry, no BitmapEx here... case 0: aRes = ::com::sun::star::uno::Any( reinterpret_cast<sal_Int64>( (BitmapEx*) NULL ) ); break; - case 1: - { + case 1: + { if(!mpBitmap->hasAlpha()) { HBITMAP aHBmp; @@ -96,7 +96,7 @@ namespace dxcanvas uno::Sequence< uno::Any > args(1); args[0] = uno::Any( sal_Int64(aHBmp) ); - + aRes <<= args; } else @@ -105,12 +105,12 @@ namespace dxcanvas // canvas uses inline alpha channel HDC hScreenDC=GetDC(NULL); const basegfx::B2IVector aSize(mpBitmap->getSize()); - HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC, - aSize.getX(), + HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC, + aSize.getX(), aSize.getY() ); if( !hBmpBitmap ) return aRes; - + BITMAPINFOHEADER aBIH; aBIH.biSize = sizeof( BITMAPINFOHEADER ); @@ -128,11 +128,11 @@ namespace dxcanvas aBIH.biClrImportant = 0; Gdiplus::BitmapData aBmpData; - aBmpData.Width = aSize.getX(); - aBmpData.Height = aSize.getY(); - aBmpData.Stride = 4*aBmpData.Width; + aBmpData.Width = aSize.getX(); + aBmpData.Height = aSize.getY(); + aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = NULL; + aBmpData.Scan0 = NULL; const Gdiplus::Rect aRect( 0,0,aSize.getX(),aSize.getY() ); BitmapSharedPtr pGDIPlusBitmap=mpBitmap->getBitmap(); if( Gdiplus::Ok != pGDIPlusBitmap->LockBits( &aRect, @@ -140,7 +140,7 @@ namespace dxcanvas PixelFormat32bppARGB, // outputs ARGB (big endian) &aBmpData ) ) { - // failed to lock, bail out + // failed to lock, bail out return aRes; } @@ -152,13 +152,13 @@ namespace dxcanvas uno::Sequence< uno::Any > args(1); args[0] = uno::Any( sal_Int64(hBmpBitmap) ); - + aRes <<= args; } } break; - case 2: + case 2: { if(!mpBitmap->hasAlpha()) { @@ -188,7 +188,7 @@ namespace dxcanvas HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC, aSize.getX(), aSize.getY() ); if( !hBmpBitmap ) return aRes; - + aDIB.bmiHeader.biSize = sizeof( BITMAPINFOHEADER ); aDIB.bmiHeader.biWidth = aSize.getX(); aDIB.bmiHeader.biHeight = -aSize.getY(); @@ -202,11 +202,11 @@ namespace dxcanvas aDIB.bmiHeader.biClrImportant = 0; Gdiplus::BitmapData aBmpData; - aBmpData.Width = aSize.getX(); - aBmpData.Height = aSize.getY(); - aBmpData.Stride = 4*aBmpData.Width; + aBmpData.Width = aSize.getX(); + aBmpData.Height = aSize.getY(); + aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = NULL; + aBmpData.Scan0 = NULL; const Gdiplus::Rect aRect( 0,0,aSize.getX(),aSize.getY() ); BitmapSharedPtr pGDIPlusBitmap=mpBitmap->getBitmap(); if( Gdiplus::Ok != pGDIPlusBitmap->LockBits( &aRect, @@ -214,7 +214,7 @@ namespace dxcanvas PixelFormat32bppARGB, // outputs ARGB (big endian) &aBmpData ) ) { - // failed to lock, bail out + // failed to lock, bail out return aRes; } @@ -237,13 +237,13 @@ namespace dxcanvas pGDIPlusBitmap->UnlockBits( &aBmpData ); // set bits to newly create HBITMAP - SetDIBits( hScreenDC, hBmpBitmap, 0, - aSize.getY(), pAlphaBits.get(), + SetDIBits( hScreenDC, hBmpBitmap, 0, + aSize.getY(), pAlphaBits.get(), (PBITMAPINFO)&aDIB, DIB_RGB_COLORS ); uno::Sequence< uno::Any > args(1); args[0] = uno::Any( sal_Int64(hBmpBitmap) ); - + aRes <<= args; } } @@ -270,7 +270,7 @@ namespace dxcanvas { uno::Sequence< ::rtl::OUString > aRet(1); aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); - + return aRet; } diff --git a/canvas/source/directx/dx_canvasbitmap.hxx b/canvas/source/directx/dx_canvasbitmap.hxx index 75800f3c8abd..f3327909b817 100755 --- a/canvas/source/directx/dx_canvasbitmap.hxx +++ b/canvas/source/directx/dx_canvasbitmap.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -58,11 +58,11 @@ namespace dxcanvas typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XBitmapCanvas, ::com::sun::star::rendering::XIntegerBitmap, ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::beans::XFastPropertySet > CanvasBitmapBase_Base; + ::com::sun::star::beans::XFastPropertySet > CanvasBitmapBase_Base; typedef ::canvas::IntegerBitmapBase< ::canvas::BaseMutexHelper< CanvasBitmapBase_Base >, BitmapCanvasHelper, ::osl::MutexGuard, - ::cppu::OWeakObject > CanvasBitmap_Base; + ::cppu::OWeakObject > CanvasBitmap_Base; class CanvasBitmap : public CanvasBitmap_Base, public BitmapProvider { diff --git a/canvas/source/directx/dx_canvascustomsprite.cxx b/canvas/source/directx/dx_canvascustomsprite.cxx index 9c8309d5e39f..6a1de9f1aba5 100755 --- a/canvas/source/directx/dx_canvascustomsprite.cxx +++ b/canvas/source/directx/dx_canvascustomsprite.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,11 +49,11 @@ using namespace ::com::sun::star; namespace dxcanvas { - CanvasCustomSprite::CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, + CanvasCustomSprite::CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, const SpriteCanvasRef& rRefDevice, - const IDXRenderModuleSharedPtr& rRenderModule, - const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy, - bool bShowSpriteBounds ) : + const IDXRenderModuleSharedPtr& rRenderModule, + const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy, + bool bShowSpriteBounds ) : mpSpriteCanvas( rRefDevice ), mpSurface() { diff --git a/canvas/source/directx/dx_canvascustomsprite.hxx b/canvas/source/directx/dx_canvascustomsprite.hxx index be83b26e1b52..30226b043e40 100755 --- a/canvas/source/directx/dx_canvascustomsprite.hxx +++ b/canvas/source/directx/dx_canvascustomsprite.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -56,7 +56,7 @@ namespace dxcanvas typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XCustomSprite, ::com::sun::star::rendering::XBitmapCanvas, ::com::sun::star::rendering::XIntegerBitmap, - ::com::sun::star::lang::XServiceInfo > CanvasCustomSpriteBase_Base; + ::com::sun::star::lang::XServiceInfo > CanvasCustomSpriteBase_Base; /** Mixin Sprite Have to mixin the Sprite interface before deriving from @@ -83,7 +83,7 @@ namespace dxcanvas SpriteHelper, BitmapCanvasHelper, ::osl::MutexGuard, - ::cppu::OWeakObject > CanvasCustomSpriteBaseT; + ::cppu::OWeakObject > CanvasCustomSpriteBaseT; /* Definition of CanvasCustomSprite class */ @@ -104,11 +104,11 @@ namespace dxcanvas @param rDevice Target DX device */ - CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, + CanvasCustomSprite( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, const SpriteCanvasRef& rRefDevice, - const IDXRenderModuleSharedPtr& rRenderModule, - const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy, - bool bShowSpriteBounds ); + const IDXRenderModuleSharedPtr& rRenderModule, + const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy, + bool bShowSpriteBounds ); virtual void SAL_CALL disposing(); diff --git a/canvas/source/directx/dx_canvasfont.cxx b/canvas/source/directx/dx_canvasfont.cxx index d87079b34c0f..dce38d70e9ff 100755 --- a/canvas/source/directx/dx_canvasfont.cxx +++ b/canvas/source/directx/dx_canvasfont.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -54,9 +54,9 @@ namespace dxcanvas } } - CanvasFont::CanvasFont( const rendering::FontRequest& rFontRequest, - const uno::Sequence< beans::PropertyValue >& /*extraFontProperties*/, - const geometry::Matrix2D& fontMatrix ) : + CanvasFont::CanvasFont( const rendering::FontRequest& rFontRequest, + const uno::Sequence< beans::PropertyValue >& /*extraFontProperties*/, + const geometry::Matrix2D& fontMatrix ) : CanvasFont_Base( m_aMutex ), mpGdiPlusUser( GDIPlusUser::createInstance() ), // TODO(F1): extraFontProperties, fontMatrix @@ -90,8 +90,8 @@ namespace dxcanvas } uno::Reference< rendering::XTextLayout > SAL_CALL CanvasFont::createTextLayout( const rendering::StringContext& aText, - sal_Int8 nDirection, - sal_Int64 nRandomSeed ) throw (uno::RuntimeException) + sal_Int8 nDirection, + sal_Int64 nRandomSeed ) throw (uno::RuntimeException) { ::osl::MutexGuard aGuard( m_aMutex ); diff --git a/canvas/source/directx/dx_canvasfont.hxx b/canvas/source/directx/dx_canvasfont.hxx index 4a6c8b779ad0..8905da728b7a 100755 --- a/canvas/source/directx/dx_canvasfont.hxx +++ b/canvas/source/directx/dx_canvasfont.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -52,8 +52,8 @@ namespace dxcanvas { class SpriteCanvas; - typedef ::boost::shared_ptr< Gdiplus::Font > FontSharedPtr; - typedef ::boost::shared_ptr< Gdiplus::FontFamily > FontFamilySharedPtr; + typedef ::boost::shared_ptr< Gdiplus::Font > FontSharedPtr; + typedef ::boost::shared_ptr< Gdiplus::FontFamily > FontFamilySharedPtr; typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XCanvasFont, ::com::sun::star::lang::XServiceInfo > CanvasFont_Base; @@ -68,7 +68,7 @@ namespace dxcanvas ::com::sun::star::rendering::XCanvasFont > ImplRef; CanvasFont( const ::com::sun::star::rendering::FontRequest& fontRequest, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& extraFontProperties, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& extraFontProperties, const ::com::sun::star::geometry::Matrix2D& fontMatrix ); /// Dispose all internal references @@ -86,17 +86,17 @@ namespace dxcanvas virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); - double getCellAscent() const; - double getEmHeight() const; - FontSharedPtr getFont() const; + double getCellAscent() const; + double getEmHeight() const; + FontSharedPtr getFont() const; const ::com::sun::star::geometry::Matrix2D& getFontMatrix() const; private: - GDIPlusUserSharedPtr mpGdiPlusUser; - FontFamilySharedPtr mpFontFamily; - FontSharedPtr mpFont; - ::com::sun::star::rendering::FontRequest maFontRequest; - ::com::sun::star::geometry::Matrix2D maFontMatrix; + GDIPlusUserSharedPtr mpGdiPlusUser; + FontFamilySharedPtr mpFontFamily; + FontSharedPtr mpFont; + ::com::sun::star::rendering::FontRequest maFontRequest; + ::com::sun::star::geometry::Matrix2D maFontMatrix; }; } diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index 866cc0f03ec3..16c5efb71f56 100755 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -142,7 +142,7 @@ namespace dxcanvas } void CanvasHelper::setTarget( const GraphicsProviderSharedPtr& rTarget, - const ::basegfx::B2ISize& rOutputOffset ) + const ::basegfx::B2ISize& rOutputOffset ) { ENSURE_OR_THROW( rTarget, "CanvasHelper::setTarget(): invalid target" ); @@ -161,7 +161,7 @@ namespace dxcanvas Gdiplus::Color aClearColor = Gdiplus::Color((Gdiplus::ARGB)Gdiplus::Color::White); ENSURE_OR_THROW( - Gdiplus::Ok == pGraphics->SetCompositingMode( + Gdiplus::Ok == pGraphics->SetCompositingMode( Gdiplus::CompositingModeSourceCopy ), // force set, don't blend "CanvasHelper::clear(): GDI+ SetCompositingMode call failed" ); ENSURE_OR_THROW( @@ -170,19 +170,19 @@ namespace dxcanvas } } - void CanvasHelper::drawPoint( const rendering::XCanvas* /*pCanvas*/, - const geometry::RealPoint2D& aPoint, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) + void CanvasHelper::drawPoint( const rendering::XCanvas* /*pCanvas*/, + const geometry::RealPoint2D& aPoint, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState ) { if( needOutput() ) { GraphicsSharedPtr pGraphics( mpGraphicsProvider->getGraphics() ); setupGraphicsState( pGraphics, viewState, renderState ); - - Gdiplus::SolidBrush aBrush( - Gdiplus::Color( + + Gdiplus::SolidBrush aBrush( + Gdiplus::Color( tools::sequenceToArgb(renderState.DeviceColor)) ); // determine size of one-by-one device pixel ellipse @@ -198,27 +198,27 @@ namespace dxcanvas Gdiplus::Ok == pGraphics->FillEllipse( &aBrush, // disambiguate call Gdiplus::REAL(aPoint.X), - Gdiplus::REAL(aPoint.Y), - Gdiplus::REAL(vector.X), + Gdiplus::REAL(aPoint.Y), + Gdiplus::REAL(vector.X), Gdiplus::REAL(vector.Y) ), "CanvasHelper::drawPoint(): GDI+ call failed" ); } } - void CanvasHelper::drawLine( const rendering::XCanvas* /*pCanvas*/, - const geometry::RealPoint2D& aStartPoint, - const geometry::RealPoint2D& aEndPoint, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) + void CanvasHelper::drawLine( const rendering::XCanvas* /*pCanvas*/, + const geometry::RealPoint2D& aStartPoint, + const geometry::RealPoint2D& aEndPoint, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState ) { if( needOutput() ) { GraphicsSharedPtr pGraphics( mpGraphicsProvider->getGraphics() ); setupGraphicsState( pGraphics, viewState, renderState ); - - Gdiplus::Pen aPen( - Gdiplus::Color( + + Gdiplus::Pen aPen( + Gdiplus::Color( tools::sequenceToArgb(renderState.DeviceColor)), Gdiplus::REAL(0.0) ); @@ -231,10 +231,10 @@ namespace dxcanvas pGraphics->GetPixelOffsetMode() ); pGraphics->SetPixelOffsetMode( Gdiplus::PixelOffsetModeNone ); - Gdiplus::Status hr = pGraphics->DrawLine( &aPen, + Gdiplus::Status hr = pGraphics->DrawLine( &aPen, Gdiplus::REAL(aStartPoint.X), // disambiguate call - Gdiplus::REAL(aStartPoint.Y), - Gdiplus::REAL(aEndPoint.X), + Gdiplus::REAL(aStartPoint.Y), + Gdiplus::REAL(aEndPoint.X), Gdiplus::REAL(aEndPoint.Y) ); pGraphics->SetPixelOffsetMode( aOldMode ); @@ -244,20 +244,20 @@ namespace dxcanvas } } - void CanvasHelper::drawBezier( const rendering::XCanvas* /*pCanvas*/, - const geometry::RealBezierSegment2D& aBezierSegment, - const geometry::RealPoint2D& aEndPoint, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) + void CanvasHelper::drawBezier( const rendering::XCanvas* /*pCanvas*/, + const geometry::RealBezierSegment2D& aBezierSegment, + const geometry::RealPoint2D& aEndPoint, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState ) { if( needOutput() ) { GraphicsSharedPtr pGraphics( mpGraphicsProvider->getGraphics() ); setupGraphicsState( pGraphics, viewState, renderState ); - - Gdiplus::Pen aPen( - Gdiplus::Color( + + Gdiplus::Pen aPen( + Gdiplus::Color( tools::sequenceToArgb(renderState.DeviceColor)), Gdiplus::REAL(0.0) ); @@ -266,7 +266,7 @@ namespace dxcanvas // PixelOffsetModeNone to achieve visually pleasing // results, whereas all other operations (e.g. polygon // fills, bitmaps) look better with PixelOffsetModeHalf. - const Gdiplus::PixelOffsetMode aOldMode( + const Gdiplus::PixelOffsetMode aOldMode( pGraphics->GetPixelOffsetMode() ); pGraphics->SetPixelOffsetMode( Gdiplus::PixelOffsetModeNone ); @@ -288,12 +288,12 @@ namespace dxcanvas } } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawPolyPolygon( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState ) { - ENSURE_OR_THROW( xPolyPolygon.is(), + ENSURE_OR_THROW( xPolyPolygon.is(), "CanvasHelper::drawPolyPolygon: polygon is NULL"); if( needOutput() ) @@ -301,18 +301,18 @@ namespace dxcanvas GraphicsSharedPtr pGraphics( mpGraphicsProvider->getGraphics() ); setupGraphicsState( pGraphics, viewState, renderState ); - - Gdiplus::Pen aPen( - Gdiplus::Color( + + Gdiplus::Pen aPen( + Gdiplus::Color( tools::sequenceToArgb(renderState.DeviceColor)), Gdiplus::REAL(0.0) ); - + // #122683# Switched precedence of pixel offset // mode. Seemingly, polygon stroking needs // PixelOffsetModeNone to achieve visually pleasing // results, whereas all other operations (e.g. polygon // fills, bitmaps) look better with PixelOffsetModeHalf. - const Gdiplus::PixelOffsetMode aOldMode( + const Gdiplus::PixelOffsetMode aOldMode( pGraphics->GetPixelOffsetMode() ); pGraphics->SetPixelOffsetMode( Gdiplus::PixelOffsetModeNone ); @@ -332,13 +332,13 @@ namespace dxcanvas return uno::Reference< rendering::XCachedPrimitive >(NULL); } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokePolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState, - const rendering::StrokeAttributes& strokeAttributes ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokePolyPolygon( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState, + const rendering::StrokeAttributes& strokeAttributes ) { - ENSURE_OR_THROW( xPolyPolygon.is(), + ENSURE_OR_THROW( xPolyPolygon.is(), "CanvasHelper::drawPolyPolygon: polygon is NULL"); if( needOutput() ) @@ -346,13 +346,13 @@ namespace dxcanvas GraphicsSharedPtr pGraphics( mpGraphicsProvider->getGraphics() ); setupGraphicsState( pGraphics, viewState, renderState ); - + // Setup stroke pen // ---------------- - Gdiplus::Pen aPen( - Gdiplus::Color( + Gdiplus::Pen aPen( + Gdiplus::Color( tools::sequenceToArgb(renderState.DeviceColor)), static_cast< Gdiplus::REAL >(strokeAttributes.StrokeWidth) ); @@ -361,18 +361,18 @@ namespace dxcanvas // PixelOffsetModeNone to achieve visually pleasing // results, whereas all other operations (e.g. polygon // fills, bitmaps) look better with PixelOffsetModeHalf. - const Gdiplus::PixelOffsetMode aOldMode( + const Gdiplus::PixelOffsetMode aOldMode( pGraphics->GetPixelOffsetMode() ); pGraphics->SetPixelOffsetMode( Gdiplus::PixelOffsetModeNone ); const bool bIsMiter(rendering::PathJoinType::MITER == strokeAttributes.JoinType); const bool bIsNone(rendering::PathJoinType::NONE == strokeAttributes.JoinType); - + if(bIsMiter) aPen.SetMiterLimit( static_cast< Gdiplus::REAL >(strokeAttributes.MiterLimit) ); - const ::std::vector< Gdiplus::REAL >& rDashArray( - ::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL > >( + const ::std::vector< Gdiplus::REAL >& rDashArray( + ::comphelper::sequenceToContainer< ::std::vector< Gdiplus::REAL > >( strokeAttributes.DashArray ) ); if( !rDashArray.empty() ) { @@ -401,45 +401,45 @@ namespace dxcanvas return uno::Reference< rendering::XCachedPrimitive >(NULL); } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTexturedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - const uno::Sequence< rendering::Texture >& /*textures*/, - const rendering::StrokeAttributes& /*strokeAttributes*/ ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTexturedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, + const rendering::ViewState& /*viewState*/, + const rendering::RenderState& /*renderState*/, + const uno::Sequence< rendering::Texture >& /*textures*/, + const rendering::StrokeAttributes& /*strokeAttributes*/ ) { // TODO return uno::Reference< rendering::XCachedPrimitive >(NULL); } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTextureMappedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - const uno::Sequence< rendering::Texture >& /*textures*/, - const uno::Reference< geometry::XMapping2D >& /*xMapping*/, - const rendering::StrokeAttributes& /*strokeAttributes*/ ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::strokeTextureMappedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, + const rendering::ViewState& /*viewState*/, + const rendering::RenderState& /*renderState*/, + const uno::Sequence< rendering::Texture >& /*textures*/, + const uno::Reference< geometry::XMapping2D >& /*xMapping*/, + const rendering::StrokeAttributes& /*strokeAttributes*/ ) { // TODO return uno::Reference< rendering::XCachedPrimitive >(NULL); } - uno::Reference< rendering::XPolyPolygon2D > CanvasHelper::queryStrokeShapes( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - const rendering::StrokeAttributes& /*strokeAttributes*/ ) + uno::Reference< rendering::XPolyPolygon2D > CanvasHelper::queryStrokeShapes( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, + const rendering::ViewState& /*viewState*/, + const rendering::RenderState& /*renderState*/, + const rendering::StrokeAttributes& /*strokeAttributes*/ ) { // TODO return uno::Reference< rendering::XPolyPolygon2D >(NULL); } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillPolyPolygon( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState ) { - ENSURE_OR_THROW( xPolyPolygon.is(), + ENSURE_OR_THROW( xPolyPolygon.is(), "CanvasHelper::fillPolyPolygon: polygon is NULL"); if( needOutput() ) @@ -448,9 +448,9 @@ namespace dxcanvas setupGraphicsState( pGraphics, viewState, renderState ); - Gdiplus::SolidBrush aBrush( + Gdiplus::SolidBrush aBrush( tools::sequenceToArgb(renderState.DeviceColor)); - + GraphicsPathSharedPtr pPath( tools::graphicsPathFromXPolyPolygon2D( xPolyPolygon ) ); // TODO(F1): FillRule @@ -462,47 +462,47 @@ namespace dxcanvas return uno::Reference< rendering::XCachedPrimitive >(NULL); } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTextureMappedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, - const rendering::ViewState& /*viewState*/, - const rendering::RenderState& /*renderState*/, - const uno::Sequence< rendering::Texture >& /*textures*/, - const uno::Reference< geometry::XMapping2D >& /*xMapping*/ ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTextureMappedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XPolyPolygon2D >& /*xPolyPolygon*/, + const rendering::ViewState& /*viewState*/, + const rendering::RenderState& /*renderState*/, + const uno::Sequence< rendering::Texture >& /*textures*/, + const uno::Reference< geometry::XMapping2D >& /*xMapping*/ ) { // TODO return uno::Reference< rendering::XCachedPrimitive >(NULL); } - uno::Reference< rendering::XCanvasFont > CanvasHelper::createFont( const rendering::XCanvas* /*pCanvas*/, - const rendering::FontRequest& fontRequest, - const uno::Sequence< beans::PropertyValue >& extraFontProperties, - const geometry::Matrix2D& fontMatrix ) + uno::Reference< rendering::XCanvasFont > CanvasHelper::createFont( const rendering::XCanvas* /*pCanvas*/, + const rendering::FontRequest& fontRequest, + const uno::Sequence< beans::PropertyValue >& extraFontProperties, + const geometry::Matrix2D& fontMatrix ) { if( needOutput() ) { - return uno::Reference< rendering::XCanvasFont >( + return uno::Reference< rendering::XCanvasFont >( new CanvasFont(fontRequest, extraFontProperties, fontMatrix ) ); } return uno::Reference< rendering::XCanvasFont >(); } - uno::Sequence< rendering::FontInfo > CanvasHelper::queryAvailableFonts( const rendering::XCanvas* /*pCanvas*/, - const rendering::FontInfo& /*aFilter*/, - const uno::Sequence< beans::PropertyValue >& /*aFontProperties*/ ) + uno::Sequence< rendering::FontInfo > CanvasHelper::queryAvailableFonts( const rendering::XCanvas* /*pCanvas*/, + const rendering::FontInfo& /*aFilter*/, + const uno::Sequence< beans::PropertyValue >& /*aFontProperties*/ ) { // TODO return uno::Sequence< rendering::FontInfo >(); } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawText( const rendering::XCanvas* /*pCanvas*/, - const rendering::StringContext& text, - const uno::Reference< rendering::XCanvasFont >& xFont, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState, - sal_Int8 /*textDirection*/ ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawText( const rendering::XCanvas* /*pCanvas*/, + const rendering::StringContext& text, + const uno::Reference< rendering::XCanvasFont >& xFont, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState, + sal_Int8 /*textDirection*/ ) { - ENSURE_OR_THROW( xFont.is(), + ENSURE_OR_THROW( xFont.is(), "CanvasHelper::drawText: font is NULL"); if( needOutput() ) @@ -510,12 +510,12 @@ namespace dxcanvas GraphicsSharedPtr pGraphics( mpGraphicsProvider->getGraphics() ); setupGraphicsState( pGraphics, viewState, renderState ); - - Gdiplus::SolidBrush aBrush( - Gdiplus::Color( + + Gdiplus::SolidBrush aBrush( + Gdiplus::Color( tools::sequenceToArgb(renderState.DeviceColor))); - CanvasFont::ImplRef pFont( + CanvasFont::ImplRef pFont( tools::canvasFontFromXFont(xFont) ); // Move glyphs up, such that output happens at the font @@ -524,7 +524,7 @@ namespace dxcanvas static_cast<Gdiplus::REAL>(-(pFont->getFont()->GetSize()* pFont->getCellAscent() / pFont->getEmHeight())) ); - + // TODO(F1): According to // http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q307208, // we might have to revert to GDI and ExTextOut here, @@ -547,26 +547,26 @@ namespace dxcanvas return uno::Reference< rendering::XCachedPrimitive >(NULL); } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawTextLayout( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XTextLayout >& xLayoutetText, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawTextLayout( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XTextLayout >& xLayoutetText, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState ) { - ENSURE_OR_THROW( xLayoutetText.is(), + ENSURE_OR_THROW( xLayoutetText.is(), "CanvasHelper::drawTextLayout: layout is NULL"); if( needOutput() ) { - TextLayout* pTextLayout = + TextLayout* pTextLayout = dynamic_cast< TextLayout* >( xLayoutetText.get() ); ENSURE_OR_THROW( pTextLayout, "CanvasHelper::drawTextLayout(): TextLayout not compatible with this canvas" ); pTextLayout->draw( mpGraphicsProvider->getGraphics(), - viewState, - renderState, - maOutputOffset, + viewState, + renderState, + maOutputOffset, mpDevice, false ); } @@ -574,12 +574,12 @@ namespace dxcanvas return uno::Reference< rendering::XCachedPrimitive >(NULL); } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmap( const rendering::XCanvas* /*pCanvas*/, - const uno::Reference< rendering::XBitmap >& xBitmap, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmap( const rendering::XCanvas* /*pCanvas*/, + const uno::Reference< rendering::XBitmap >& xBitmap, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState ) { - ENSURE_OR_THROW( xBitmap.is(), + ENSURE_OR_THROW( xBitmap.is(), "CanvasHelper::drawBitmap: bitmap is NULL"); if( needOutput() ) @@ -611,12 +611,12 @@ namespace dxcanvas return uno::Reference< rendering::XCachedPrimitive >(NULL); } - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* pCanvas, - const uno::Reference< rendering::XBitmap >& xBitmap, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState ) + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::drawBitmapModulated( const rendering::XCanvas* pCanvas, + const uno::Reference< rendering::XBitmap >& xBitmap, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState ) { - ENSURE_OR_THROW( xBitmap.is(), + ENSURE_OR_THROW( xBitmap.is(), "CanvasHelper::drawBitmap: bitmap is NULL"); // no color set -> this is equivalent to a plain drawBitmap(), then @@ -624,13 +624,13 @@ namespace dxcanvas return drawBitmap( pCanvas, xBitmap, viewState, renderState ); if( needOutput() ) - { + { GraphicsSharedPtr pGraphics( mpGraphicsProvider->getGraphics() ); setupGraphicsState( pGraphics, viewState, renderState ); BitmapSharedPtr pBitmap( tools::bitmapFromXBitmap( xBitmap ) ); - Gdiplus::Rect aRect( 0, 0, + Gdiplus::Rect aRect( 0, 0, pBitmap->GetWidth(), pBitmap->GetHeight() ); @@ -646,8 +646,8 @@ namespace dxcanvas rARGBColor.Blue, rARGBColor.Alpha ); - ENSURE_OR_THROW( - Gdiplus::Ok == pGraphics->DrawImage( pBitmap.get(), + ENSURE_OR_THROW( + Gdiplus::Ok == pGraphics->DrawImage( pBitmap.get(), aRect, 0, 0, pBitmap->GetWidth(), @@ -711,7 +711,7 @@ namespace dxcanvas // TODO(F2): Problem, because GDI+ only knows about two compositing modes aRet = Gdiplus::CompositingModeSourceOver; break; - + default: ENSURE_OR_THROW( false, "CanvasHelper::calcCompositingMode: unexpected mode" ); break; @@ -721,10 +721,10 @@ namespace dxcanvas } void CanvasHelper::setupGraphicsState( GraphicsSharedPtr& rGraphics, - const rendering::ViewState& viewState, + const rendering::ViewState& viewState, const rendering::RenderState& renderState ) { - ENSURE_OR_THROW( needOutput(), + ENSURE_OR_THROW( needOutput(), "CanvasHelper::setupGraphicsState: primary graphics invalid" ); ENSURE_OR_THROW( mpDevice, "CanvasHelper::setupGraphicsState: reference device invalid" ); @@ -744,12 +744,12 @@ namespace dxcanvas Gdiplus::Matrix aMatrix; tools::gdiPlusMatrixFromB2DHomMatrix( aMatrix, aTransform ); - ENSURE_OR_THROW( + ENSURE_OR_THROW( Gdiplus::Ok == rGraphics->SetTransform( &aMatrix ), "CanvasHelper::setupGraphicsState(): Failed to set GDI+ transformation" ); // setup view and render state clipping - ENSURE_OR_THROW( + ENSURE_OR_THROW( Gdiplus::Ok == rGraphics->ResetClip(), "CanvasHelper::setupGraphicsState(): Failed to reset GDI+ clip" ); @@ -757,16 +757,16 @@ namespace dxcanvas { GraphicsPathSharedPtr aClipPath( tools::graphicsPathFromXPolyPolygon2D( viewState.Clip ) ); - // TODO(P3): Cache clip. SetClip( GraphicsPath ) performs abyssmally on GDI+. - // Try SetClip( Rect ) or similar for simple clip paths (need some support in + // TODO(P3): Cache clip. SetClip( GraphicsPath ) performs abyssmally on GDI+. + // Try SetClip( Rect ) or similar for simple clip paths (need some support in // LinePolyPolygon, then) - ENSURE_OR_THROW( - Gdiplus::Ok == rGraphics->SetClip( aClipPath.get(), + ENSURE_OR_THROW( + Gdiplus::Ok == rGraphics->SetClip( aClipPath.get(), Gdiplus::CombineModeIntersect ), "CanvasHelper::setupGraphicsState(): Cannot set GDI+ clip" ); } - // setup overall transform only now. View clip above was relative to + // setup overall transform only now. View clip above was relative to // view transform ::canvas::tools::mergeViewAndRenderTransform(aTransform, viewState, @@ -782,7 +782,7 @@ namespace dxcanvas tools::gdiPlusMatrixFromB2DHomMatrix( aMatrix, aTransform ); - ENSURE_OR_THROW( + ENSURE_OR_THROW( Gdiplus::Ok == rGraphics->SetTransform( &aMatrix ), "CanvasHelper::setupGraphicsState(): Cannot set GDI+ transformation" ); @@ -790,18 +790,18 @@ namespace dxcanvas { GraphicsPathSharedPtr aClipPath( tools::graphicsPathFromXPolyPolygon2D( renderState.Clip ) ); - // TODO(P3): Cache clip. SetClip( GraphicsPath ) performs abyssmally on GDI+. - // Try SetClip( Rect ) or similar for simple clip paths (need some support in + // TODO(P3): Cache clip. SetClip( GraphicsPath ) performs abyssmally on GDI+. + // Try SetClip( Rect ) or similar for simple clip paths (need some support in // LinePolyPolygon, then) - ENSURE_OR_THROW( - Gdiplus::Ok == rGraphics->SetClip( aClipPath.get(), + ENSURE_OR_THROW( + Gdiplus::Ok == rGraphics->SetClip( aClipPath.get(), Gdiplus::CombineModeIntersect ), "CanvasHelper::setupGraphicsState(): Cannot set GDI+ clip" ); } // setup compositing const Gdiplus::CompositingMode eCompositing( calcCompositingMode( renderState.CompositeOperation ) ); - ENSURE_OR_THROW( + ENSURE_OR_THROW( Gdiplus::Ok == rGraphics->SetCompositingMode( eCompositing ), "CanvasHelper::setupGraphicsState(): Cannot set GDI* compositing mode)" ); } diff --git a/canvas/source/directx/dx_canvashelper.hxx b/canvas/source/directx/dx_canvashelper.hxx index 2f175cce88e5..9536653f91b8 100755 --- a/canvas/source/directx/dx_canvashelper.hxx +++ b/canvas/source/directx/dx_canvashelper.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -86,7 +86,7 @@ namespace dxcanvas Output offset in pixel */ void setTarget( const GraphicsProviderSharedPtr& rTarget, - const ::basegfx::B2ISize& rOutputOffset ); + const ::basegfx::B2ISize& rOutputOffset ); // CanvasHelper functionality @@ -95,131 +95,131 @@ namespace dxcanvas // XCanvas (only providing, not implementing the // interface. Also note subtle method parameter differences) void clear(); - void drawPoint( const ::com::sun::star::rendering::XCanvas* pCanvas, - const ::com::sun::star::geometry::RealPoint2D& aPoint, - const ::com::sun::star::rendering::ViewState& viewState, + void drawPoint( const ::com::sun::star::rendering::XCanvas* pCanvas, + const ::com::sun::star::geometry::RealPoint2D& aPoint, + const ::com::sun::star::rendering::ViewState& viewState, const ::com::sun::star::rendering::RenderState& renderState ); - void drawLine( const ::com::sun::star::rendering::XCanvas* pCanvas, - const ::com::sun::star::geometry::RealPoint2D& aStartPoint, - const ::com::sun::star::geometry::RealPoint2D& aEndPoint, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); - void drawBezier( const ::com::sun::star::rendering::XCanvas* pCanvas, - const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment, - const ::com::sun::star::geometry::RealPoint2D& aEndPoint, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); + void drawLine( const ::com::sun::star::rendering::XCanvas* pCanvas, + const ::com::sun::star::geometry::RealPoint2D& aStartPoint, + const ::com::sun::star::geometry::RealPoint2D& aEndPoint, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState ); + void drawBezier( const ::com::sun::star::rendering::XCanvas* pCanvas, + const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment, + const ::com::sun::star::geometry::RealPoint2D& aEndPoint, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, + drawPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); + ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - strokePolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, + strokePolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, + ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState, const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - strokeTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, + strokeTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, + ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState, const ::com::sun::star::uno::Sequence< - ::com::sun::star::rendering::Texture >& textures, + ::com::sun::star::rendering::Texture >& textures, const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - strokeTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, + strokeTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, + ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState, const ::com::sun::star::uno::Sequence< - ::com::sun::star::rendering::Texture >& textures, + ::com::sun::star::rendering::Texture >& textures, const ::com::sun::star::uno::Reference< - ::com::sun::star::geometry::XMapping2D >& xMapping, - const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ); + ::com::sun::star::geometry::XMapping2D >& xMapping, + const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > - queryStrokeShapes( const ::com::sun::star::rendering::XCanvas* pCanvas, + queryStrokeShapes( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, + ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState, const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - fillPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, + fillPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); + ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - fillTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, + fillTexturedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, + ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState, const ::com::sun::star::uno::Sequence< - ::com::sun::star::rendering::Texture >& textures ); + ::com::sun::star::rendering::Texture >& textures ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - fillTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, + fillTextureMappedPolyPolygon( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, + ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState, const ::com::sun::star::uno::Sequence< - ::com::sun::star::rendering::Texture >& textures, + ::com::sun::star::rendering::Texture >& textures, const ::com::sun::star::uno::Reference< - ::com::sun::star::geometry::XMapping2D >& xMapping ); + ::com::sun::star::geometry::XMapping2D >& xMapping ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL - createFont( const ::com::sun::star::rendering::XCanvas* pCanvas, - const ::com::sun::star::rendering::FontRequest& fontRequest, + createFont( const ::com::sun::star::rendering::XCanvas* pCanvas, + const ::com::sun::star::rendering::FontRequest& fontRequest, const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::PropertyValue >& extraFontProperties, - const ::com::sun::star::geometry::Matrix2D& fontMatrix ); + ::com::sun::star::beans::PropertyValue >& extraFontProperties, + const ::com::sun::star::geometry::Matrix2D& fontMatrix ); ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::FontInfo > - queryAvailableFonts( const ::com::sun::star::rendering::XCanvas* pCanvas, - const ::com::sun::star::rendering::FontInfo& aFilter, + queryAvailableFonts( const ::com::sun::star::rendering::XCanvas* pCanvas, + const ::com::sun::star::rendering::FontInfo& aFilter, const ::com::sun::star::uno::Sequence< - ::com::sun::star::beans::PropertyValue >& aFontProperties ); + ::com::sun::star::beans::PropertyValue >& aFontProperties ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawText( const ::com::sun::star::rendering::XCanvas* pCanvas, - const ::com::sun::star::rendering::StringContext& text, + drawText( const ::com::sun::star::rendering::XCanvas* pCanvas, + const ::com::sun::star::rendering::StringContext& text, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XCanvasFont >& xFont, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState, - sal_Int8 textDirection ); + ::com::sun::star::rendering::XCanvasFont >& xFont, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState, + sal_Int8 textDirection ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawTextLayout( const ::com::sun::star::rendering::XCanvas* pCanvas, + drawTextLayout( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout >& layoutetText, - const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::ViewState& viewState, const ::com::sun::star::rendering::RenderState& renderState ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawBitmap( const ::com::sun::star::rendering::XCanvas* pCanvas, + drawBitmap( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap, - const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::ViewState& viewState, const ::com::sun::star::rendering::RenderState& renderState ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > - drawBitmapModulated( const ::com::sun::star::rendering::XCanvas* pCanvas, + drawBitmapModulated( const ::com::sun::star::rendering::XCanvas* pCanvas, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XBitmap >& xBitmap, - const ::com::sun::star::rendering::ViewState& viewState, - const ::com::sun::star::rendering::RenderState& renderState ); + ::com::sun::star::rendering::XBitmap >& xBitmap, + const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::RenderState& renderState ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice > getDevice(); // Flush drawing queue to screen - void flush() const; + void flush() const; /** Called from XCanvas base classes, to notify that content is _about_ to change @@ -228,7 +228,7 @@ namespace dxcanvas protected: /// Refcounted global GDI+ state container - GDIPlusUserSharedPtr mpGdiPlusUser; + GDIPlusUserSharedPtr mpGdiPlusUser; /** Phyical output device @@ -244,13 +244,13 @@ namespace dxcanvas // returns transparency of color void setupGraphicsState( GraphicsSharedPtr& rGraphics, - const ::com::sun::star::rendering::ViewState& viewState, + const ::com::sun::star::rendering::ViewState& viewState, const ::com::sun::star::rendering::RenderState& renderState ); - Gdiplus::CompositingMode calcCompositingMode( sal_Int8 nMode ); + Gdiplus::CompositingMode calcCompositingMode( sal_Int8 nMode ); /// Current (transformation-independent) output buffer offset - ::basegfx::B2ISize maOutputOffset; + ::basegfx::B2ISize maOutputOffset; }; } diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx index 60d62dad338a..794cb03ad8b9 100755 --- a/canvas/source/directx/dx_canvashelper_texturefill.cxx +++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -62,7 +62,7 @@ namespace dxcanvas { namespace { - typedef ::boost::shared_ptr< Gdiplus::PathGradientBrush > PathGradientBrushSharedPtr; + typedef ::boost::shared_ptr< Gdiplus::PathGradientBrush > PathGradientBrushSharedPtr; bool fillLinearGradient( GraphicsSharedPtr& rGraphics, const ::canvas::ParametricPolyPolygon::Values& /*rValues*/, @@ -106,9 +106,9 @@ namespace dxcanvas ::basegfx::B2DPoint aRightTop( 1.0, 0.0 ); ::basegfx::B2DPoint aRightBottom( 1.0, 1.0 ); - aLeftTop *= aTextureTransform; + aLeftTop *= aTextureTransform; aLeftBottom *= aTextureTransform; - aRightTop *= aTextureTransform; + aRightTop *= aTextureTransform; aRightBottom*= aTextureTransform; Gdiplus::RectF aBounds; @@ -200,9 +200,9 @@ namespace dxcanvas int numColorSteps( const Gdiplus::Color& rColor1, const Gdiplus::Color& rColor2 ) { - return ::std::max( + return ::std::max( labs( rColor1.GetRed() - rColor2.GetRed() ), - ::std::max( + ::std::max( labs( rColor1.GetGreen() - rColor2.GetGreen() ), labs( rColor1.GetBlue() - rColor2.GetBlue() ) ) ); } @@ -212,8 +212,8 @@ namespace dxcanvas const std::vector< Gdiplus::REAL >& rStops, GraphicsSharedPtr& rGraphics, const GraphicsPathSharedPtr& rPath, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState, const rendering::Texture& texture ) { // copy original fill path object, might have to change it @@ -274,7 +274,7 @@ namespace dxcanvas nColorSteps); ::basegfx::B2DHomMatrix aTextureTransform; - ::basegfx::unotools::homMatrixFromAffineMatrix( aTextureTransform, + ::basegfx::unotools::homMatrixFromAffineMatrix( aTextureTransform, texture.AffineTransform ); // determine overall transformation for inner polygon (might // have to be prefixed by anisotrophic scaling) @@ -284,8 +284,8 @@ namespace dxcanvas // here, keep it all the way and only change the vertex values // in the loop below (as ::Polygon is a pimpl class, creating // one every loop turn would really stress the mem allocator) - ::basegfx::B2DPolygon aOuterPoly( rGradientPoly ); - ::basegfx::B2DPolygon aInnerPoly; + ::basegfx::B2DPolygon aOuterPoly( rGradientPoly ); + ::basegfx::B2DPolygon aInnerPoly; // subdivide polygon _before_ rendering, would otherwise have // to be performed on every loop turn. @@ -314,7 +314,7 @@ namespace dxcanvas else if( nAspectRatio < 1.0 ) { // width < height case - aInnerPolygonTransformMatrix.scale( 0.0, + aInnerPolygonTransformMatrix.scale( 0.0, 1.0 - nAspectRatio ); } else @@ -337,7 +337,7 @@ namespace dxcanvas { std::ptrdiff_t nIndex; double fAlpha; - const double fT( i/double(nStepCount) ); + const double fT( i/double(nStepCount) ); boost::tuples::tie(nIndex,fAlpha)=aLerper.lerp(fT); const Gdiplus::Color aFillColor( @@ -440,8 +440,8 @@ namespace dxcanvas const std::vector< Gdiplus::REAL >& rStops, GraphicsSharedPtr& rGraphics, const GraphicsPathSharedPtr& rPath, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState, + const rendering::ViewState& viewState, + const rendering::RenderState& renderState, const rendering::Texture& texture ) { switch( rValues.meType ) @@ -554,11 +554,11 @@ namespace dxcanvas // ------------------------------------------------------------- - uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTexturedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, + uno::Reference< rendering::XCachedPrimitive > CanvasHelper::fillTexturedPolyPolygon( const rendering::XCanvas* /*pCanvas*/, const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon, - const rendering::ViewState& viewState, - const rendering::RenderState& renderState, - const uno::Sequence< rendering::Texture >& textures ) + const rendering::ViewState& viewState, + const rendering::RenderState& renderState, + const uno::Sequence< rendering::Texture >& textures ) { ENSURE_OR_THROW( xPolyPolygon.is(), "CanvasHelper::fillTexturedPolyPolygon: polygon is NULL"); @@ -584,7 +584,7 @@ namespace dxcanvas const ::canvas::ParametricPolyPolygon::Values& rValues( pGradient->getValues() ); - OSL_ASSERT(rValues.maColors.getLength() == rValues.maStops.getLength() + OSL_ASSERT(rValues.maColors.getLength() == rValues.maStops.getLength() && rValues.maColors.getLength() > 1); std::vector< Gdiplus::Color > aColors(rValues.maColors.getLength()); diff --git a/canvas/source/directx/dx_config.cxx b/canvas/source/directx/dx_config.cxx index bfbb46a42d09..6638891e127e 100755 --- a/canvas/source/directx/dx_config.cxx +++ b/canvas/source/directx/dx_config.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,8 +41,8 @@ using namespace com::sun::star; namespace dxcanvas { DXCanvasItem::DXCanvasItem() : - ConfigItem( - ::rtl::OUString( + ConfigItem( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Canvas/DXCanvas" )), CONFIG_MODE_IMMEDIATE_UPDATE ), maValues(), diff --git a/canvas/source/directx/dx_config.hxx b/canvas/source/directx/dx_config.hxx index a1499a64f44f..b9dfa6408c7b 100644 --- a/canvas/source/directx/dx_config.hxx +++ b/canvas/source/directx/dx_config.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -75,8 +75,8 @@ namespace dxcanvas void blacklistDevice( const DeviceInfo& rDeviceInfo ); void adaptMaxTextureSize( basegfx::B2IVector& io_maxTextureSize ) const; virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames); - virtual void Commit(); - + virtual void Commit(); + private: typedef std::set< DeviceInfo > ValueSet; ValueSet maValues; diff --git a/canvas/source/directx/dx_devicehelper.cxx b/canvas/source/directx/dx_devicehelper.cxx index 731e28e2700f..61d3bd73ea7d 100755 --- a/canvas/source/directx/dx_devicehelper.cxx +++ b/canvas/source/directx/dx_devicehelper.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -116,8 +116,8 @@ namespace dxcanvas } uno::Reference< rendering::XLinePolyPolygon2D > DeviceHelper::createCompatibleLinePolyPolygon( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points ) + const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, + const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points ) { if( !mpDevice ) return uno::Reference< rendering::XLinePolyPolygon2D >(); // we're disposed @@ -128,8 +128,8 @@ namespace dxcanvas } uno::Reference< rendering::XBezierPolyPolygon2D > DeviceHelper::createCompatibleBezierPolyPolygon( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& points ) + const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, + const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& points ) { if( !mpDevice ) return uno::Reference< rendering::XBezierPolyPolygon2D >(); // we're disposed @@ -140,8 +140,8 @@ namespace dxcanvas } uno::Reference< rendering::XBitmap > DeviceHelper::createCompatibleBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& size ) + const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, + const geometry::IntegerSize2D& size ) { if( !mpDevice ) return uno::Reference< rendering::XBitmap >(); // we're disposed @@ -156,15 +156,15 @@ namespace dxcanvas } uno::Reference< rendering::XVolatileBitmap > DeviceHelper::createVolatileBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& /*size*/ ) + const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, + const geometry::IntegerSize2D& /*size*/ ) { return uno::Reference< rendering::XVolatileBitmap >(); } uno::Reference< rendering::XBitmap > DeviceHelper::createCompatibleAlphaBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& size ) + const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, + const geometry::IntegerSize2D& size ) { if( !mpDevice ) return uno::Reference< rendering::XBitmap >(); // we're disposed @@ -179,8 +179,8 @@ namespace dxcanvas } uno::Reference< rendering::XVolatileBitmap > DeviceHelper::createVolatileAlphaBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& /*size*/ ) + const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, + const geometry::IntegerSize2D& /*size*/ ) { return uno::Reference< rendering::XVolatileBitmap >(); } @@ -216,18 +216,18 @@ namespace dxcanvas return uno::Any(); } - namespace - { + namespace + { struct DeviceColorSpace: public rtl::StaticWithInit<uno::Reference<rendering::XColorSpace>, - DeviceColorSpace> + DeviceColorSpace> { uno::Reference<rendering::XColorSpace> operator()() { return vcl::unotools::createStandardColorSpace(); } - }; + }; } - + uno::Reference<rendering::XColorSpace> DeviceHelper::getColorSpace() const { // always the same diff --git a/canvas/source/directx/dx_devicehelper.hxx b/canvas/source/directx/dx_devicehelper.hxx index 7c85f7a8f8de..625160d0a0d9 100755 --- a/canvas/source/directx/dx_devicehelper.hxx +++ b/canvas/source/directx/dx_devicehelper.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,7 +50,7 @@ namespace dxcanvas DeviceHelper(); /** Init the device helper - + @param hdc private or class dc of the output device. is only stored, not release @@ -68,23 +68,23 @@ namespace dxcanvas ::com::sun::star::geometry::RealSize2D getPhysicalResolution(); ::com::sun::star::geometry::RealSize2D getPhysicalSize(); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > createCompatibleLinePolyPolygon( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > createCompatibleBezierPolyPolygon( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::geometry::IntegerSize2D& size ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::geometry::IntegerSize2D& size ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::geometry::IntegerSize2D& size ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::geometry::IntegerSize2D& size ); sal_Bool hasFullScreenMode(); sal_Bool enterFullScreenMode( sal_Bool bEnter ); @@ -92,7 +92,7 @@ namespace dxcanvas ::com::sun::star::uno::Any isAccelerated() const; ::com::sun::star::uno::Any getDeviceHandle() const; ::com::sun::star::uno::Any getSurfaceHandle() const; - ::com::sun::star::uno::Reference< + ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace > getColorSpace() const; /** called when DumpScreenContent property is enabled on diff --git a/canvas/source/directx/dx_gdiplususer.cxx b/canvas/source/directx/dx_gdiplususer.cxx index f11965ac6860..317f908a78b7 100755 --- a/canvas/source/directx/dx_gdiplususer.cxx +++ b/canvas/source/directx/dx_gdiplususer.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -38,10 +38,10 @@ namespace dxcanvas { namespace { - ::osl::Mutex* p_gdiPlusUsageCountMutex( osl::Mutex::getGlobalMutex() ); - int n_gdiPlusUsageCount( 0 ); + ::osl::Mutex* p_gdiPlusUsageCountMutex( osl::Mutex::getGlobalMutex() ); + int n_gdiPlusUsageCount( 0 ); - ULONG_PTR a_GdiPlusToken; // GDI+ handle. Owned by this object + ULONG_PTR a_GdiPlusToken; // GDI+ handle. Owned by this object } GDIPlusUserSharedPtr GDIPlusUser::createInstance() @@ -51,7 +51,7 @@ namespace dxcanvas GDIPlusUser::~GDIPlusUser() { - ::osl::MutexGuard aGuard( *p_gdiPlusUsageCountMutex ); + ::osl::MutexGuard aGuard( *p_gdiPlusUsageCountMutex ); --n_gdiPlusUsageCount; @@ -61,7 +61,7 @@ namespace dxcanvas GDIPlusUser::GDIPlusUser() { - ::osl::MutexGuard aGuard( *p_gdiPlusUsageCountMutex ); + ::osl::MutexGuard aGuard( *p_gdiPlusUsageCountMutex ); if( n_gdiPlusUsageCount == 0 ) { @@ -71,8 +71,8 @@ namespace dxcanvas // default constructor Gdiplus::GdiplusStartupInput gdiPlusStartupInput; - Gdiplus::GdiplusStartup( &a_GdiPlusToken, - &gdiPlusStartupInput, + Gdiplus::GdiplusStartup( &a_GdiPlusToken, + &gdiPlusStartupInput, NULL ); } diff --git a/canvas/source/directx/dx_gdiplususer.hxx b/canvas/source/directx/dx_gdiplususer.hxx index 409449aab954..f65e2b59196c 100755 --- a/canvas/source/directx/dx_gdiplususer.hxx +++ b/canvas/source/directx/dx_gdiplususer.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/canvas/source/directx/dx_graphicsprovider.hxx b/canvas/source/directx/dx_graphicsprovider.hxx index 74c47e26a99a..c5fb62f50529 100644 --- a/canvas/source/directx/dx_graphicsprovider.hxx +++ b/canvas/source/directx/dx_graphicsprovider.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/canvas/source/directx/dx_ibitmap.hxx b/canvas/source/directx/dx_ibitmap.hxx index 6419d5a198fc..b5f4b486ca8d 100644 --- a/canvas/source/directx/dx_ibitmap.hxx +++ b/canvas/source/directx/dx_ibitmap.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,22 +46,22 @@ namespace dxcanvas virtual bool hasAlpha() const = 0; virtual ::com::sun::star::uno::Sequence< sal_Int8 > getData( - ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerRectangle2D& rect ) = 0; + ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, + const ::com::sun::star::geometry::IntegerRectangle2D& rect ) = 0; virtual void setData( - const ::com::sun::star::uno::Sequence< sal_Int8 >& data, + const ::com::sun::star::uno::Sequence< sal_Int8 >& data, const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerRectangle2D& rect ) = 0; + const ::com::sun::star::geometry::IntegerRectangle2D& rect ) = 0; virtual void setPixel( - const ::com::sun::star::uno::Sequence< sal_Int8 >& color, + const ::com::sun::star::uno::Sequence< sal_Int8 >& color, const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerPoint2D& pos ) = 0; + const ::com::sun::star::geometry::IntegerPoint2D& pos ) = 0; virtual ::com::sun::star::uno::Sequence< sal_Int8 > getPixel( - ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerPoint2D& pos ) = 0; + ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, + const ::com::sun::star::geometry::IntegerPoint2D& pos ) = 0; }; typedef boost::shared_ptr<IBitmap> IBitmapSharedPtr; diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx index c298fb9238f9..a24105474a58 100755 --- a/canvas/source/directx/dx_impltools.cxx +++ b/canvas/source/directx/dx_impltools.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -72,7 +72,7 @@ namespace dxcanvas namespace tools { ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly ) - { + { LinePolyPolygon* pPolyImpl = dynamic_cast< LinePolyPolygon* >( xPoly.get() ); if( pPolyImpl ) @@ -168,8 +168,8 @@ namespace dxcanvas static_cast<Gdiplus::REAL>(rMatrix.get(1,2)) ); } - void gdiPlusMatrixFromAffineMatrix2D( Gdiplus::Matrix& rGdiplusMatrix, - const geometry::AffineMatrix2D& rMatrix ) + void gdiPlusMatrixFromAffineMatrix2D( Gdiplus::Matrix& rGdiplusMatrix, + const geometry::AffineMatrix2D& rMatrix ) { rGdiplusMatrix.SetElements( static_cast<Gdiplus::REAL>(rMatrix.m00), static_cast<Gdiplus::REAL>(rMatrix.m10), @@ -185,7 +185,7 @@ namespace dxcanvas // out of it inline Gdiplus::PointF implGdiPlusPointFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& rPoint ) { - return Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.X), + return Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.X), static_cast<Gdiplus::REAL>(rPoint.Y) ); } @@ -193,7 +193,7 @@ namespace dxcanvas ::std::vector< Gdiplus::PointF >& rPoints, const ::basegfx::B2DPolygon& rPoly, bool bNoLineJoin) - { + { const sal_uInt32 nPoints( rPoly.count() ); if( nPoints < 2 ) @@ -218,15 +218,15 @@ namespace dxcanvas for( sal_uInt32 nCurrPoint=0; nCurrPoint<nPoints; ++nCurrPoint ) { const ::basegfx::B2DPoint& rPoint( rPoly.getB2DPoint( nCurrPoint ) ); - rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.getX()), + rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.getX()), static_cast<Gdiplus::REAL>(rPoint.getY()) ); const ::basegfx::B2DPoint& rControlPointA( rPoly.getNextControlPoint( nCurrPoint ) ); - rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rControlPointA.getX()), + rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rControlPointA.getX()), static_cast<Gdiplus::REAL>(rControlPointA.getY()) ); const ::basegfx::B2DPoint& rControlPointB( rPoly.getPrevControlPoint( (nCurrPoint + 1) % nPoints) ); - rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rControlPointB.getX()), + rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rControlPointB.getX()), static_cast<Gdiplus::REAL>(rControlPointB.getY()) ); } @@ -236,7 +236,7 @@ namespace dxcanvas // control points for the last point, see // above) const ::basegfx::B2DPoint& rPoint( rPoly.getB2DPoint(0) ); - rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.getX()), + rPoints[nCurrOutput++] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.getX()), static_cast<Gdiplus::REAL>(rPoint.getY()) ); if(bNoLineJoin && nCurrOutput > 7) @@ -285,7 +285,7 @@ namespace dxcanvas for( sal_uInt32 nCurrPoint=0; nCurrPoint<nPoints; ++nCurrPoint ) { const ::basegfx::B2DPoint& rPoint( rPoly.getB2DPoint( nCurrPoint ) ); - rPoints[nCurrPoint] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.getX()), + rPoints[nCurrPoint] = Gdiplus::PointF( static_cast<Gdiplus::REAL>(rPoint.getX()), static_cast<Gdiplus::REAL>(rPoint.getY()) ); } @@ -321,17 +321,17 @@ namespace dxcanvas Gdiplus::Rect gdiPlusRectFromIntegerRectangle2D( const geometry::IntegerRectangle2D& rRect ) { - return Gdiplus::Rect( rRect.X1, - rRect.Y1, - rRect.X2 - rRect.X1, + return Gdiplus::Rect( rRect.X1, + rRect.Y1, + rRect.X2 - rRect.X1, rRect.Y2 - rRect.Y1 ); } Gdiplus::RectF gdiPlusRectFFromRectangle2D( const geometry::RealRectangle2D& rRect ) { - return Gdiplus::RectF( static_cast<Gdiplus::REAL>(rRect.X1), - static_cast<Gdiplus::REAL>(rRect.Y1), - static_cast<Gdiplus::REAL>(rRect.X2 - rRect.X1), + return Gdiplus::RectF( static_cast<Gdiplus::REAL>(rRect.X1), + static_cast<Gdiplus::REAL>(rRect.Y1), + static_cast<Gdiplus::REAL>(rRect.X2 - rRect.X1), static_cast<Gdiplus::REAL>(rRect.Y2 - rRect.Y1) ); } @@ -353,19 +353,19 @@ namespace dxcanvas geometry::RealRectangle2D realRectangle2DFromGdiPlusRectF( const Gdiplus::RectF& rRect ) { return geometry::RealRectangle2D( rRect.X, rRect.Y, - rRect.X + rRect.Width, + rRect.X + rRect.Width, rRect.Y + rRect.Height ); } - ::basegfx::B2DPoint b2dPointFromGdiPlusPointF( const Gdiplus::PointF& rPoint ) + ::basegfx::B2DPoint b2dPointFromGdiPlusPointF( const Gdiplus::PointF& rPoint ) { return ::basegfx::B2DPoint( rPoint.X, rPoint.Y ); } - ::basegfx::B2DRange b2dRangeFromGdiPlusRectF( const Gdiplus::RectF& rRect ) + ::basegfx::B2DRange b2dRangeFromGdiPlusRectF( const Gdiplus::RectF& rRect ) { return ::basegfx::B2DRange( rRect.X, rRect.Y, - rRect.X + rRect.Width, + rRect.X + rRect.Width, rRect.Y + rRect.Height ); } @@ -374,10 +374,10 @@ namespace dxcanvas // TODO(F1): handle color space conversions, when defined on canvas/graphicDevice uno::Sequence< double > aRet(4); - aRet[0] = ((rColor >> 16) & 0xFF) / 255.0; // red - aRet[1] = ((rColor >> 8) & 0xFF) / 255.0; // green - aRet[2] = (rColor & 0xFF) / 255.0; // blue - aRet[3] = ((rColor >> 24) & 0xFF) / 255.0; // alpha + aRet[0] = ((rColor >> 16) & 0xFF) / 255.0; // red + aRet[1] = ((rColor >> 8) & 0xFF) / 255.0; // green + aRet[2] = (rColor & 0xFF) / 255.0; // blue + aRet[3] = ((rColor >> 24) & 0xFF) / 255.0; // alpha return aRet; } @@ -387,17 +387,17 @@ namespace dxcanvas // TODO(F1): handle color space conversions, when defined on canvas/graphicDevice uno::Sequence< sal_Int8 > aRet(4); - aRet[0] = static_cast<sal_Int8>((rColor >> 16) & 0xFF); // red - aRet[1] = static_cast<sal_Int8>((rColor >> 8) & 0xFF); // green - aRet[2] = static_cast<sal_Int8>(rColor & 0xFF); // blue - aRet[3] = static_cast<sal_Int8>((rColor >> 24) & 0xFF); // alpha + aRet[0] = static_cast<sal_Int8>((rColor >> 16) & 0xFF); // red + aRet[1] = static_cast<sal_Int8>((rColor >> 8) & 0xFF); // green + aRet[2] = static_cast<sal_Int8>(rColor & 0xFF); // blue + aRet[3] = static_cast<sal_Int8>((rColor >> 24) & 0xFF); // alpha return aRet; } Gdiplus::ARGB sequenceToArgb( const uno::Sequence< sal_Int8 >& rColor ) { - ENSURE_OR_THROW( rColor.getLength() > 2, + ENSURE_OR_THROW( rColor.getLength() > 2, "sequenceToArgb: need at least three channels" ); // TODO(F1): handle color space conversions, when defined on canvas/graphicDevice @@ -413,7 +413,7 @@ namespace dxcanvas Gdiplus::ARGB sequenceToArgb( const uno::Sequence< double >& rColor ) { - ENSURE_OR_THROW( rColor.getLength() > 2, + ENSURE_OR_THROW( rColor.getLength() > 2, "sequenceToColor: need at least three channels" ); // TODO(F1): handle color space conversions, when defined on canvas/graphicDevice @@ -423,9 +423,9 @@ namespace dxcanvas ::canvas::tools::verifyRange(rColor[1],0.0,1.0); ::canvas::tools::verifyRange(rColor[2],0.0,1.0); - aColor = - (static_cast<sal_uInt8>( ::basegfx::fround( 255*rColor[0] ) ) << 16) | - (static_cast<sal_uInt8>( ::basegfx::fround( 255*rColor[1] ) ) << 8) | + aColor = + (static_cast<sal_uInt8>( ::basegfx::fround( 255*rColor[0] ) ) << 16) | + (static_cast<sal_uInt8>( ::basegfx::fround( 255*rColor[1] ) ) << 8) | static_cast<sal_uInt8>( ::basegfx::fround( 255*rColor[2] ) ); if( rColor.getLength() > 3 ) @@ -453,9 +453,9 @@ namespace dxcanvas // TODO(F1): Closed/open polygons // convert from RealPoint2D array to Gdiplus::PointF array - ::std::transform( const_cast< uno::Sequence< geometry::RealPoint2D >& >(points[nCurrPoly]).getArray(), - const_cast< uno::Sequence< geometry::RealPoint2D >& >(points[nCurrPoly]).getArray()+nCurrSize, - aPoints.begin(), + ::std::transform( const_cast< uno::Sequence< geometry::RealPoint2D >& >(points[nCurrPoly]).getArray(), + const_cast< uno::Sequence< geometry::RealPoint2D >& >(points[nCurrPoly]).getArray()+nCurrSize, + aPoints.begin(), implGdiPlusPointFromRealPoint2D ); pRes->AddLines( &aPoints[0], nCurrSize ); @@ -467,8 +467,8 @@ namespace dxcanvas GraphicsPathSharedPtr graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly, bool bNoLineJoin ) { - GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); - ::std::vector< Gdiplus::PointF > aPoints; + GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); + ::std::vector< Gdiplus::PointF > aPoints; graphicsPathFromB2DPolygon( pRes, aPoints, rPoly, bNoLineJoin ); @@ -477,14 +477,14 @@ namespace dxcanvas GraphicsPathSharedPtr graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly, bool bNoLineJoin ) { - GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); - ::std::vector< Gdiplus::PointF > aPoints; + GraphicsPathSharedPtr pRes( new Gdiplus::GraphicsPath() ); + ::std::vector< Gdiplus::PointF > aPoints; const sal_uInt32 nPolies( rPoly.count() ); for( sal_uInt32 nCurrPoly=0; nCurrPoly<nPolies; ++nCurrPoly ) { - graphicsPathFromB2DPolygon( pRes, - aPoints, + graphicsPathFromB2DPolygon( pRes, + aPoints, rPoly.getB2DPolygon( nCurrPoly ), bNoLineJoin); } @@ -508,38 +508,38 @@ namespace dxcanvas } bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics, - const BitmapSharedPtr& rBitmap ) + const BitmapSharedPtr& rBitmap ) { - Gdiplus::PointF aPoint; + Gdiplus::PointF aPoint; return (Gdiplus::Ok == rGraphics->DrawImage( rBitmap.get(), aPoint ) ); } bool drawDIBits( const GraphicsSharedPtr& rGraphics, - const BITMAPINFO& rBI, - const void* pBits ) + const BITMAPINFO& rBI, + const void* pBits ) { - BitmapSharedPtr pBitmap( - Gdiplus::Bitmap::FromBITMAPINFO( &rBI, + BitmapSharedPtr pBitmap( + Gdiplus::Bitmap::FromBITMAPINFO( &rBI, (void*)pBits ) ); return drawGdiPlusBitmap( rGraphics, pBitmap ); } - + bool drawRGBABits( const GraphicsSharedPtr& rGraphics, - const RawRGBABitmap& rRawRGBAData ) + const RawRGBABitmap& rRawRGBAData ) { - BitmapSharedPtr pBitmap( new Gdiplus::Bitmap( rRawRGBAData.mnWidth, + BitmapSharedPtr pBitmap( new Gdiplus::Bitmap( rRawRGBAData.mnWidth, rRawRGBAData.mnHeight, PixelFormat32bppARGB ) ); - + Gdiplus::BitmapData aBmpData; - aBmpData.Width = rRawRGBAData.mnWidth; - aBmpData.Height = rRawRGBAData.mnHeight; - aBmpData.Stride = 4*aBmpData.Width; // bottom-up format + aBmpData.Width = rRawRGBAData.mnWidth; + aBmpData.Height = rRawRGBAData.mnHeight; + aBmpData.Stride = 4*aBmpData.Width; // bottom-up format aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = rRawRGBAData.mpBitmapData.get(); + aBmpData.Scan0 = rRawRGBAData.mpBitmapData.get(); const Gdiplus::Rect aRect( 0,0,aBmpData.Width,aBmpData.Height ); if( Gdiplus::Ok != pBitmap->LockBits( &aRect, @@ -549,7 +549,7 @@ namespace dxcanvas { return false; } - + // commit data to bitmap pBitmap->UnlockBits( &aBmpData ); @@ -573,8 +573,8 @@ namespace dxcanvas // ================================================= const geometry::IntegerSize2D aBmpSize( xBitmap->getSize() ); - BitmapSharedPtr pBitmap; - + BitmapSharedPtr pBitmap; + if( xBitmap->hasAlpha() ) { // TODO(P2): At least for the alpha bitmap case, it @@ -594,10 +594,10 @@ namespace dxcanvas aBmpSize.Height, PixelFormat24bppRGB ) ); } - + GraphicsSharedPtr pGraphics(createGraphicsFromBitmap(pBitmap)); tools::setupGraphics(*pGraphics); - if( !drawVCLBitmapFromXBitmap( + if( !drawVCLBitmapFromXBitmap( pGraphics, xBitmap) ) { @@ -608,7 +608,7 @@ namespace dxcanvas } } - CanvasFont::ImplRef canvasFontFromXFont( const uno::Reference< rendering::XCanvasFont >& xFont ) + CanvasFont::ImplRef canvasFontFromXFont( const uno::Reference< rendering::XCanvasFont >& xFont ) { CanvasFont* pCanvasFont = dynamic_cast< CanvasFont* >(xFont.get()); @@ -619,15 +619,15 @@ namespace dxcanvas } void setModulateImageAttributes( Gdiplus::ImageAttributes& o_rAttr, - double nRedModulation, - double nGreenModulation, - double nBlueModulation, - double nAlphaModulation ) + double nRedModulation, + double nGreenModulation, + double nBlueModulation, + double nAlphaModulation ) { - // This gets rather verbose, but we have to setup a color + // This gets rather verbose, but we have to setup a color // transformation matrix, in order to incorporate the global // alpha value mfAlpha into the bitmap rendering. - Gdiplus::ColorMatrix aColorMatrix; + Gdiplus::ColorMatrix aColorMatrix; aColorMatrix.m[0][0] = static_cast<Gdiplus::REAL>(nRedModulation); aColorMatrix.m[0][1] = 0.0; @@ -660,7 +660,7 @@ namespace dxcanvas aColorMatrix.m[4][4] = 1.0; o_rAttr.SetColorMatrix( &aColorMatrix, - Gdiplus::ColorMatrixFlagsDefault, + Gdiplus::ColorMatrixFlagsDefault, Gdiplus::ColorAdjustTypeDefault ); } diff --git a/canvas/source/directx/dx_impltools.hxx b/canvas/source/directx/dx_impltools.hxx index 6eb0bc415ea5..358e7858015c 100755 --- a/canvas/source/directx/dx_impltools.hxx +++ b/canvas/source/directx/dx_impltools.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -80,21 +80,21 @@ namespace dxcanvas void setupGraphics( Gdiplus::Graphics& rGraphics ); - void gdiPlusMatrixFromB2DHomMatrix( Gdiplus::Matrix& rGdiplusMatrix, - const ::basegfx::B2DHomMatrix& rMatrix ); - void gdiPlusMatrixFromAffineMatrix2D( Gdiplus::Matrix& rGdiplusMatrix, + void gdiPlusMatrixFromB2DHomMatrix( Gdiplus::Matrix& rGdiplusMatrix, + const ::basegfx::B2DHomMatrix& rMatrix ); + void gdiPlusMatrixFromAffineMatrix2D( Gdiplus::Matrix& rGdiplusMatrix, const ::com::sun::star::geometry::AffineMatrix2D& rMatrix ); Gdiplus::PointF gdiPlusPointFFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& ); - Gdiplus::RectF gdiPlusRectFFromRectangle2D( const ::com::sun::star::geometry::RealRectangle2D& ); - Gdiplus::Rect gdiPlusRectFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& ); - RECT gdiRectFromB2IRect( const ::basegfx::B2IRange& ); + Gdiplus::RectF gdiPlusRectFFromRectangle2D( const ::com::sun::star::geometry::RealRectangle2D& ); + Gdiplus::Rect gdiPlusRectFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& ); + RECT gdiRectFromB2IRect( const ::basegfx::B2IRange& ); - ::com::sun::star::geometry::RealPoint2D realPoint2DFromGdiPlusPointF( const Gdiplus::PointF& ); - ::com::sun::star::geometry::RealRectangle2D realRectangle2DFromGdiPlusRectF( const Gdiplus::RectF& ); + ::com::sun::star::geometry::RealPoint2D realPoint2DFromGdiPlusPointF( const Gdiplus::PointF& ); + ::com::sun::star::geometry::RealRectangle2D realRectangle2DFromGdiPlusRectF( const Gdiplus::RectF& ); - ::basegfx::B2DPoint b2dPointFromGdiPlusPointF( const Gdiplus::PointF& ); - ::basegfx::B2DRange b2dRangeFromGdiPlusRectF( const Gdiplus::RectF& ); + ::basegfx::B2DPoint b2dPointFromGdiPlusPointF( const Gdiplus::PointF& ); + ::basegfx::B2DRange b2dRangeFromGdiPlusRectF( const Gdiplus::RectF& ); ::com::sun::star::uno::Sequence< double > argbToDoubleSequence( const Gdiplus::ARGB& rColor ); ::com::sun::star::uno::Sequence< sal_Int8 > argbToIntSequence( const Gdiplus::ARGB& rColor ); @@ -113,22 +113,22 @@ namespace dxcanvas bool bNoLineJoin = false); GraphicsPathSharedPtr graphicsPathFromXPolyPolygon2D( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >&, + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >&, bool bNoLineJoin = false ); bool drawGdiPlusBitmap( const GraphicsSharedPtr& rGraphics, - const BitmapSharedPtr& rBitmap ); + const BitmapSharedPtr& rBitmap ); bool drawDIBits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, const BITMAPINFO& rBI, const void* pBits ); bool drawRGBABits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, - const RawRGBABitmap& rRawRGBAData ); + const RawRGBABitmap& rRawRGBAData ); BitmapSharedPtr bitmapFromXBitmap( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XBitmap >& xBitmap ); + ::com::sun::star::rendering::XBitmap >& xBitmap ); - CanvasFont::ImplRef canvasFontFromXFont( const ::com::sun::star::uno::Reference< + CanvasFont::ImplRef canvasFontFromXFont( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont >& xFont ); void setModulateImageAttributes( Gdiplus::ImageAttributes& o_rAttr, diff --git a/canvas/source/directx/dx_linepolypolygon.cxx b/canvas/source/directx/dx_linepolypolygon.cxx index 12bd4e98ae31..3ef4db927544 100755 --- a/canvas/source/directx/dx_linepolypolygon.cxx +++ b/canvas/source/directx/dx_linepolypolygon.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -57,7 +57,7 @@ namespace dxcanvas return mpPath; } - + void LinePolyPolygon::modifying() const { mpPath.reset(); diff --git a/canvas/source/directx/dx_linepolypolygon.hxx b/canvas/source/directx/dx_linepolypolygon.hxx index cb2d76587169..b7813e95d1ed 100755 --- a/canvas/source/directx/dx_linepolypolygon.hxx +++ b/canvas/source/directx/dx_linepolypolygon.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -48,8 +48,8 @@ namespace dxcanvas // overridden, to clear mpPath virtual void modifying() const; - GDIPlusUserSharedPtr mpGdiPlusUser; - mutable GraphicsPathSharedPtr mpPath; + GDIPlusUserSharedPtr mpGdiPlusUser; + mutable GraphicsPathSharedPtr mpPath; }; } diff --git a/canvas/source/directx/dx_rendermodule.hxx b/canvas/source/directx/dx_rendermodule.hxx index e6bd8a7b5701..7dd6fa3bc1b9 100755 --- a/canvas/source/directx/dx_rendermodule.hxx +++ b/canvas/source/directx/dx_rendermodule.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/canvas/source/directx/dx_sprite.hxx b/canvas/source/directx/dx_sprite.hxx index 56c984439f45..f37fb4519610 100755 --- a/canvas/source/directx/dx_sprite.hxx +++ b/canvas/source/directx/dx_sprite.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/canvas/source/directx/dx_spritecanvas.cxx b/canvas/source/directx/dx_spritecanvas.cxx index 43350287d92a..e9f43c8b1cac 100755 --- a/canvas/source/directx/dx_spritecanvas.cxx +++ b/canvas/source/directx/dx_spritecanvas.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -93,7 +93,7 @@ namespace dxcanvas 5: SystemGraphicsData as a streamed Any */ ENSURE_ARG_OR_THROW( maArguments.getLength() >= 5 && - maArguments[4].getValueTypeClass() == uno::TypeClass_INTERFACE, + maArguments[4].getValueTypeClass() == uno::TypeClass_INTERFACE, "VCLSpriteCanvas::initialize: wrong number of arguments, or wrong types" ); uno::Reference< awt::XWindow > xParentWindow; @@ -103,7 +103,7 @@ namespace dxcanvas throw lang::NoSupportException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Parent window not VCL window, or canvas out-of-process!")), - NULL); + NULL); awt::Rectangle aRect; maArguments[2] >>= aRect; @@ -177,9 +177,9 @@ namespace dxcanvas { ::osl::MutexGuard aGuard( m_aMutex ); - return maDeviceHelper.getRenderModule(); + return maDeviceHelper.getRenderModule(); } - + const DXSurfaceBitmapSharedPtr& SpriteCanvas::getBackBuffer() const { ::osl::MutexGuard aGuard( m_aMutex ); diff --git a/canvas/source/directx/dx_spritecanvas.hxx b/canvas/source/directx/dx_spritecanvas.hxx index b14d79050ccf..dee7513e45b0 100755 --- a/canvas/source/directx/dx_spritecanvas.hxx +++ b/canvas/source/directx/dx_spritecanvas.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -64,11 +64,11 @@ namespace dxcanvas ::com::sun::star::awt::XWindowListener, ::com::sun::star::util::XUpdatable, ::com::sun::star::beans::XPropertySet, - ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base; + ::com::sun::star::lang::XServiceName > WindowGraphicDeviceBase_Base; typedef ::canvas::BufferedGraphicDeviceBase< ::canvas::BaseMutexHelper< WindowGraphicDeviceBase_Base >, SpriteDeviceHelper, ::osl::MutexGuard, - ::cppu::OWeakObject > SpriteCanvasBase_Base; + ::cppu::OWeakObject > SpriteCanvasBase_Base; /** Mixin SpriteSurface Have to mixin the SpriteSurface before deriving from @@ -94,7 +94,7 @@ namespace dxcanvas typedef ::canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base, SpriteCanvasHelper, ::osl::MutexGuard, - ::cppu::OWeakObject > SpriteCanvasBaseT; + ::cppu::OWeakObject > SpriteCanvasBaseT; /** Product of this component's factory. diff --git a/canvas/source/directx/dx_spritecanvashelper.cxx b/canvas/source/directx/dx_spritecanvashelper.cxx index 211fd5502919..9b93a8e1060b 100755 --- a/canvas/source/directx/dx_spritecanvashelper.cxx +++ b/canvas/source/directx/dx_spritecanvashelper.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -33,7 +33,7 @@ #include <canvas/canvastools.hxx> #include <tools/diagnose_ex.h> -#include <comphelper/scopeguard.hxx> +#include <comphelper/scopeguard.hxx> #include <basegfx/range/b2drectangle.hxx> #include <basegfx/tools/canvastools.hxx> @@ -43,7 +43,7 @@ #include "dx_spritecanvashelper.hxx" #include "dx_canvascustomsprite.hxx" -#if defined(DX_DEBUG_IMAGES) +#if defined(DX_DEBUG_IMAGES) # if OSL_DEBUG_LEVEL > 0 # include <imdebug.h> # undef min @@ -57,9 +57,9 @@ namespace dxcanvas { namespace { - void repaintBackground( const ::basegfx::B2DRange& rUpdateArea, - const ::basegfx::B2IRange& rOutputArea, - const DXSurfaceBitmapSharedPtr& rBackBuffer ) + void repaintBackground( const ::basegfx::B2DRange& rUpdateArea, + const ::basegfx::B2IRange& rOutputArea, + const DXSurfaceBitmapSharedPtr& rBackBuffer ) { // TODO(E1): Use numeric_cast to catch overflow here ::basegfx::B2IRange aActualArea( 0, 0, @@ -119,11 +119,11 @@ namespace dxcanvas } void SpriteCanvasHelper::init( SpriteCanvas& rParent, - ::canvas::SpriteRedrawManager& rManager, - const IDXRenderModuleSharedPtr& rRenderModule, - const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy, - const DXSurfaceBitmapSharedPtr& rBackBuffer, - const ::basegfx::B2ISize& rOutputOffset ) + ::canvas::SpriteRedrawManager& rManager, + const IDXRenderModuleSharedPtr& rRenderModule, + const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy, + const DXSurfaceBitmapSharedPtr& rBackBuffer, + const ::basegfx::B2ISize& rOutputOffset ) { // init base setDevice( rParent ); @@ -135,7 +135,7 @@ namespace dxcanvas mpSurfaceProxy = rSurfaceProxy; mpBackBuffer = rBackBuffer; } - + void SpriteCanvasHelper::disposing() { if(mpRenderModule) @@ -147,17 +147,17 @@ namespace dxcanvas mpSpriteSurface = NULL; // forward to base - CanvasHelper::disposing(); + CanvasHelper::disposing(); } - uno::Reference< rendering::XAnimatedSprite > SpriteCanvasHelper::createSpriteFromAnimation( + uno::Reference< rendering::XAnimatedSprite > SpriteCanvasHelper::createSpriteFromAnimation( const uno::Reference< rendering::XAnimation >& /*animation*/ ) { return uno::Reference< rendering::XAnimatedSprite >(); } - uno::Reference< rendering::XAnimatedSprite > SpriteCanvasHelper::createSpriteFromBitmaps( - const uno::Sequence< uno::Reference< rendering::XBitmap > >& /*animationBitmaps*/, + uno::Reference< rendering::XAnimatedSprite > SpriteCanvasHelper::createSpriteFromBitmaps( + const uno::Sequence< uno::Reference< rendering::XBitmap > >& /*animationBitmaps*/, sal_Int8 /*interpolationMode*/ ) { return uno::Reference< rendering::XAnimatedSprite >(); @@ -168,8 +168,8 @@ namespace dxcanvas if( !mpRedrawManager ) return uno::Reference< rendering::XCustomSprite >(); // we're disposed - return uno::Reference< rendering::XCustomSprite >( - new CanvasCustomSprite( spriteSize, + return uno::Reference< rendering::XCustomSprite >( + new CanvasCustomSprite( spriteSize, mpSpriteSurface, mpRenderModule, mpSurfaceProxy, @@ -185,7 +185,7 @@ namespace dxcanvas sal_Bool bUpdateAll, bool& io_bSurfaceDirty ) { - if( !mpRedrawManager || + if( !mpRedrawManager || !mpRenderModule || !mpBackBuffer ) { @@ -196,7 +196,7 @@ namespace dxcanvas # if OSL_DEBUG_LEVEL > 0 mpBackBuffer->imageDebugger(); # endif -#endif +#endif // store current output area (need to tunnel that to the // background, scroll, opaque and general sprite repaint @@ -207,8 +207,8 @@ namespace dxcanvas maUpdateRect.reset(); // TODO(P1): Might be worthwile to track areas of background - // changes, too. - + // changes, too. + // TODO(P2): Might be worthwhile to use page-flipping only if // a certain percentage of screen area has changed - and // compose directly to the front buffer otherwise. @@ -258,7 +258,7 @@ namespace dxcanvas // change record vector must be cleared, for the next turn of // rendering and sprite changing mpRedrawManager->clearChangeRecords(); - + io_bSurfaceDirty = false; return sal_True; @@ -275,8 +275,8 @@ namespace dxcanvas mpBackBuffer ); } - void SpriteCanvasHelper::scrollUpdate( const ::basegfx::B2DRange& /*rMoveStart*/, - const ::basegfx::B2DRange& rMoveEnd, + void SpriteCanvasHelper::scrollUpdate( const ::basegfx::B2DRange& /*rMoveStart*/, + const ::basegfx::B2DRange& rMoveEnd, const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea ) { ENSURE_OR_THROW( mpRenderModule && @@ -321,11 +321,11 @@ namespace dxcanvas static_cast<sal_Int32>(maScrapRect.getWidth()), static_cast<sal_Int32>(maScrapRect.getHeight()) ); aActualArea.intersect( fround( rUpdateArea.maTotalBounds ) ); - + // add given update area to the 'blit to foreground' rect maUpdateRect.expand( aActualArea ); } - + void SpriteCanvasHelper::opaqueUpdate( const ::basegfx::B2DRange& rTotalArea, const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites ) { @@ -344,12 +344,12 @@ namespace dxcanvas ::basegfx::B2IRange aActualArea( 0, 0, static_cast<sal_Int32>(maScrapRect.getWidth()), static_cast<sal_Int32>(maScrapRect.getHeight()) ); - aActualArea.intersect( fround( rTotalArea ) ); - + aActualArea.intersect( fround( rTotalArea ) ); + // add given update area to the 'blit to foreground' rect maUpdateRect.expand( aActualArea ); } - + void SpriteCanvasHelper::genericUpdate( const ::basegfx::B2DRange& rTotalArea, const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites ) { @@ -375,7 +375,7 @@ namespace dxcanvas ::std::for_each( rSortedUpdateSprites.begin(), rSortedUpdateSprites.end(), ::std::ptr_fun( &spriteRedrawStub ) ); - + // add given update area to the 'blit to foreground' rect maUpdateRect.expand( aActualArea ); } diff --git a/canvas/source/directx/dx_spritecanvashelper.hxx b/canvas/source/directx/dx_spritecanvashelper.hxx index 5015818e0c77..79300a87fa0b 100755 --- a/canvas/source/directx/dx_spritecanvashelper.hxx +++ b/canvas/source/directx/dx_spritecanvashelper.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -52,33 +52,33 @@ namespace dxcanvas SpriteCanvasHelper(); void init( SpriteCanvas& rParent, - ::canvas::SpriteRedrawManager& rManager, - const IDXRenderModuleSharedPtr& rRenderModule, - const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy, - const DXSurfaceBitmapSharedPtr& rBackBuffer, - const ::basegfx::B2ISize& rOutputOffset ); + ::canvas::SpriteRedrawManager& rManager, + const IDXRenderModuleSharedPtr& rRenderModule, + const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy, + const DXSurfaceBitmapSharedPtr& rBackBuffer, + const ::basegfx::B2ISize& rOutputOffset ); /// Dispose all internal references void disposing(); // XSpriteCanvas ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromAnimation( + ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromAnimation( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation ); ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromBitmaps( + ::com::sun::star::rendering::XAnimatedSprite > createSpriteFromBitmaps( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > >& animationBitmaps, sal_Int8 interpolationMode ); ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XCustomSprite > createCustomSprite( + ::com::sun::star::rendering::XCustomSprite > createCustomSprite( const ::com::sun::star::geometry::RealSize2D& spriteSize ); ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XSprite > createClonedSprite( + ::com::sun::star::rendering::XSprite > createClonedSprite( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original ); /** Actually perform the screen update @@ -122,9 +122,9 @@ namespace dxcanvas All info necessary, should rMoveStart be partially or fully outside the outdev */ - void scrollUpdate( const ::basegfx::B2DRange& rMoveStart, - const ::basegfx::B2DRange& rMoveEnd, - const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea ); + void scrollUpdate( const ::basegfx::B2DRange& rMoveStart, + const ::basegfx::B2DRange& rMoveEnd, + const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea ); void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea, const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites ); @@ -137,15 +137,15 @@ namespace dxcanvas SpriteCanvas* mpSpriteSurface; /// Set from the SpriteCanvas: instance coordinating sprite redraw - ::canvas::SpriteRedrawManager* mpRedrawManager; + ::canvas::SpriteRedrawManager* mpRedrawManager; /// DX device, handling all low-level rendering - IDXRenderModuleSharedPtr mpRenderModule; + IDXRenderModuleSharedPtr mpRenderModule; - ::canvas::ISurfaceProxyManagerSharedPtr mpSurfaceProxy; + ::canvas::ISurfaceProxyManagerSharedPtr mpSurfaceProxy; /// Backbuffer, contains the static canvas render output - DXSurfaceBitmapSharedPtr mpBackBuffer; + DXSurfaceBitmapSharedPtr mpBackBuffer; /// Completely temporary rect storage (used by sprite repaint) mutable ::basegfx::B2IRange maUpdateRect; diff --git a/canvas/source/directx/dx_spritedevicehelper.cxx b/canvas/source/directx/dx_spritedevicehelper.cxx index 0437634a8d1e..6f2999475131 100644 --- a/canvas/source/directx/dx_spritedevicehelper.cxx +++ b/canvas/source/directx/dx_spritedevicehelper.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -65,7 +65,7 @@ namespace dxcanvas } void SpriteDeviceHelper::init( Window& rWindow, - SpriteCanvas& rSpriteCanvas, + SpriteCanvas& rSpriteCanvas, const awt::Rectangle& rRect, bool /*bFullscreen*/ ) { @@ -128,8 +128,8 @@ namespace dxcanvas } uno::Reference< rendering::XBitmap > SpriteDeviceHelper::createCompatibleBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& size ) + const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, + const geometry::IntegerSize2D& size ) { if( !getDevice() ) return uno::Reference< rendering::XBitmap >(); // we're disposed @@ -146,15 +146,15 @@ namespace dxcanvas } uno::Reference< rendering::XVolatileBitmap > SpriteDeviceHelper::createVolatileBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& /*size*/ ) + const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, + const geometry::IntegerSize2D& /*size*/ ) { return uno::Reference< rendering::XVolatileBitmap >(); } uno::Reference< rendering::XBitmap > SpriteDeviceHelper::createCompatibleAlphaBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& size ) + const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, + const geometry::IntegerSize2D& size ) { if( !getDevice() ) return uno::Reference< rendering::XBitmap >(); // we're disposed @@ -171,8 +171,8 @@ namespace dxcanvas } uno::Reference< rendering::XVolatileBitmap > SpriteDeviceHelper::createVolatileAlphaBitmap( - const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, - const geometry::IntegerSize2D& /*size*/ ) + const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/, + const geometry::IntegerSize2D& /*size*/ ) { return uno::Reference< rendering::XVolatileBitmap >(); } diff --git a/canvas/source/directx/dx_spritedevicehelper.hxx b/canvas/source/directx/dx_spritedevicehelper.hxx index f697b246929e..235e01bb8c12 100644 --- a/canvas/source/directx/dx_spritedevicehelper.hxx +++ b/canvas/source/directx/dx_spritedevicehelper.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -53,7 +53,7 @@ namespace dxcanvas void init( Window& rWindow, SpriteCanvas& rSpriteCanvas, - const ::com::sun::star::awt::Rectangle& rRect, + const ::com::sun::star::awt::Rectangle& rRect, bool bFullscreen ); /// Dispose all internal references @@ -61,28 +61,28 @@ namespace dxcanvas // partial override XWindowGraphicDevice ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::geometry::IntegerSize2D& size ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::geometry::IntegerSize2D& size ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > createCompatibleAlphaBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::geometry::IntegerSize2D& size ); ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > createVolatileAlphaBitmap( - const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, - const ::com::sun::star::geometry::IntegerSize2D& size ); + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice, + const ::com::sun::star::geometry::IntegerSize2D& size ); sal_Bool hasFullScreenMode( ); sal_Bool enterFullScreenMode( sal_Bool bEnter ); ::sal_Int32 createBuffers( ::sal_Int32 nBuffers ); - void destroyBuffers( ); + void destroyBuffers( ); ::sal_Bool showBuffer( bool bIsVisible, ::sal_Bool bUpdateAll ); ::sal_Bool switchBuffer( bool bIsVisible, ::sal_Bool bUpdateAll ); const IDXRenderModuleSharedPtr& getRenderModule() const { return mpRenderModule; } - const DXSurfaceBitmapSharedPtr& getBackBuffer() const { return mpBackBuffer; } + const DXSurfaceBitmapSharedPtr& getBackBuffer() const { return mpBackBuffer; } const ::canvas::ISurfaceProxyManagerSharedPtr &getSurfaceProxy() const { return mpSurfaceProxyManager; } ::com::sun::star::uno::Any isAccelerated() const; diff --git a/canvas/source/directx/dx_spritehelper.cxx b/canvas/source/directx/dx_spritehelper.cxx index d0b0c3e2101e..74ab14ec8d9d 100755 --- a/canvas/source/directx/dx_spritehelper.cxx +++ b/canvas/source/directx/dx_spritehelper.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -65,15 +65,15 @@ namespace dxcanvas mbShowSpriteBounds( false ) { } - - void SpriteHelper::init( const geometry::RealSize2D& rSpriteSize, - const SpriteCanvasRef& rSpriteCanvas, + + void SpriteHelper::init( const geometry::RealSize2D& rSpriteSize, + const SpriteCanvasRef& rSpriteCanvas, const IDXRenderModuleSharedPtr& rRenderModule, - const DXSurfaceBitmapSharedPtr rBitmap, - bool bShowSpriteBounds ) + const DXSurfaceBitmapSharedPtr rBitmap, + bool bShowSpriteBounds ) { - ENSURE_OR_THROW( rSpriteCanvas.get() && - rRenderModule && + ENSURE_OR_THROW( rSpriteCanvas.get() && + rRenderModule && rBitmap, "SpriteHelper::init(): Invalid device, sprite canvas or surface" ); @@ -138,7 +138,7 @@ namespace dxcanvas // background buffer. // log output pos in device pixel - VERBOSE_TRACE( "SpriteHelper::redraw(): output pos is (%f, %f)", + VERBOSE_TRACE( "SpriteHelper::redraw(): output pos is (%f, %f)", rPos.getX(), rPos.getY() ); @@ -150,8 +150,8 @@ namespace dxcanvas mbTextureDirty = false; io_bSurfaceDirty = false; // state taken, and processed. - ::basegfx::B2DPolyPolygon aClipPath; // empty for no clip - bool bIsClipRectangular( false ); // false, if no + ::basegfx::B2DPolyPolygon aClipPath; // empty for no clip + bool bIsClipRectangular( false ); // false, if no // clip, or clip // is complex @@ -190,10 +190,10 @@ namespace dxcanvas // apply a simple rect clip // ======================== - ::basegfx::B2DRectangle aClipBounds( + ::basegfx::B2DRectangle aClipBounds( ::basegfx::tools::getRange( aClipPath ) ); aClipBounds.intersect( aSourceRect ); - + mpBitmap->draw(fAlpha,rPos,aClipBounds,rTransform); } else diff --git a/canvas/source/directx/dx_spritehelper.hxx b/canvas/source/directx/dx_spritehelper.hxx index b83b8b6a988c..213d68c45a99 100755 --- a/canvas/source/directx/dx_spritehelper.hxx +++ b/canvas/source/directx/dx_spritehelper.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -75,9 +75,9 @@ namespace dxcanvas @param bShowSpriteBounds When true, little debug bound rects for sprites are shown */ - void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, - const SpriteCanvasRef& rSpriteCanvas, - const IDXRenderModuleSharedPtr& rRenderModule, + void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize, + const SpriteCanvasRef& rSpriteCanvas, + const IDXRenderModuleSharedPtr& rRenderModule, const DXSurfaceBitmapSharedPtr rBitmap, bool bShowSpriteBounds ); @@ -94,13 +94,13 @@ namespace dxcanvas void redraw( bool& io_bSurfaceDirty ) const; private: - virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D( + virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D( ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPoly ) const; /// Returns true, if the sprite _really_ needs redraw bool needRedraw() const; - SpriteCanvasRef mpSpriteCanvas; + SpriteCanvasRef mpSpriteCanvas; DXSurfaceBitmapSharedPtr mpBitmap; mutable bool mbTextureDirty; // when true, texture needs update diff --git a/canvas/source/directx/dx_surfacebitmap.cxx b/canvas/source/directx/dx_surfacebitmap.cxx index 258c10c4dd5c..85b8ab693cfe 100644 --- a/canvas/source/directx/dx_surfacebitmap.cxx +++ b/canvas/source/directx/dx_surfacebitmap.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -39,7 +39,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/range/b2irange.hxx> -#if defined(DX_DEBUG_IMAGES) +#if defined(DX_DEBUG_IMAGES) # if OSL_DEBUG_LEVEL > 0 # include <imdebug.h> # undef min @@ -135,7 +135,7 @@ namespace dxcanvas canvas::IColorBuffer::Format DXColorBuffer::getFormat() const { - return canvas::IColorBuffer::FMT_X8R8G8B8; + return canvas::IColorBuffer::FMT_X8R8G8B8; } ////////////////////////////////////////////////////////////////////////////////// @@ -146,7 +146,7 @@ namespace dxcanvas { public: - GDIColorBuffer( const BitmapSharedPtr& rSurface, + GDIColorBuffer( const BitmapSharedPtr& rSurface, const ::basegfx::B2IVector& rSize ) : mpGDIPlusBitmap(rSurface), maSize(rSize), @@ -187,7 +187,7 @@ namespace dxcanvas { return NULL; } - + return static_cast<sal_uInt8*>(aBmpData.Scan0); } @@ -221,10 +221,10 @@ namespace dxcanvas // DXSurfaceBitmap::DXSurfaceBitmap ////////////////////////////////////////////////////////////////////////////////// - DXSurfaceBitmap::DXSurfaceBitmap( const ::basegfx::B2IVector& rSize, - const canvas::ISurfaceProxyManagerSharedPtr& rMgr, - const IDXRenderModuleSharedPtr& rRenderModule, - bool bWithAlpha ) : + DXSurfaceBitmap::DXSurfaceBitmap( const ::basegfx::B2IVector& rSize, + const canvas::ISurfaceProxyManagerSharedPtr& rMgr, + const IDXRenderModuleSharedPtr& rRenderModule, + bool bWithAlpha ) : mpGdiPlusUser( GDIPlusUser::createInstance() ), maSize(rSize), mpRenderModule(rRenderModule), @@ -258,11 +258,11 @@ namespace dxcanvas // create container for pixel data if(mbAlpha) { - mpGDIPlusBitmap.reset( - new Gdiplus::Bitmap( + mpGDIPlusBitmap.reset( + new Gdiplus::Bitmap( maSize.getX(), maSize.getY(), - PixelFormat32bppARGB + PixelFormat32bppARGB )); mpGraphics.reset( tools::createGraphicsFromBitmap(mpGDIPlusBitmap) ); @@ -359,18 +359,18 @@ namespace dxcanvas const DWORD dwFlags = DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_READONLY; // lock the directx surface to receive the pointer to the surface memory. - if(SUCCEEDED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL))) + if(SUCCEEDED(mpSurface->Lock(NULL,&aSurfaceDesc,dwFlags,NULL))) { // decide about the format we pass the gdi+, the directx surface is always // 32bit, either with or without alpha component. Gdiplus::PixelFormat nFormat = hasAlpha() ? PixelFormat32bppARGB : PixelFormat32bppRGB; - // construct a gdi+ bitmap from the raw pixel data. + // construct a gdi+ bitmap from the raw pixel data. pResult.reset(new Gdiplus::Bitmap( maSize.getX(),maSize.getY(), aSurfaceDesc.lPitch, nFormat, (BYTE *)aSurfaceDesc.lpSurface )); - + // unlock the directx surface mpSurface->Unlock(NULL); } @@ -382,7 +382,7 @@ namespace dxcanvas // 32bit, either with or without alpha component. Gdiplus::PixelFormat nFormat = hasAlpha() ? PixelFormat32bppARGB : PixelFormat32bppRGB; - // construct a gdi+ bitmap from the raw pixel data. + // construct a gdi+ bitmap from the raw pixel data. pResult.reset(new Gdiplus::Bitmap( maSize.getX(),maSize.getY(), aLockedRect.Pitch, nFormat, @@ -481,8 +481,8 @@ namespace dxcanvas rtl_fillMemory( &aSurfaceDesc,sizeof(DDSURFACEDESC),0 ); aSurfaceDesc.dwSize = sizeof(DDSURFACEDESC); - if( FAILED(mpSurface->Lock( NULL, - &aSurfaceDesc, + if( FAILED(mpSurface->Lock( NULL, + &aSurfaceDesc, DDLOCK_NOSYSLOCK|DDLOCK_SURFACEMEMORYPTR|DDLOCK_WAIT|DDLOCK_READONLY, NULL)) ) return; @@ -495,7 +495,7 @@ namespace dxcanvas if( FAILED(mpSurface->LockRect(&aLockedRect,NULL,D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY)) ) return; - imdebug("bgra w=%d h=%d %p", maSize.getX(), + imdebug("bgra w=%d h=%d %p", maSize.getX(), maSize.getY(), aLockedRect.pBits); mpSurface->UnlockRect(); #endif @@ -507,7 +507,7 @@ namespace dxcanvas // DXSurfaceBitmap::getData ////////////////////////////////////////////////////////////////////////////////// - uno::Sequence< sal_Int8 > DXSurfaceBitmap::getData( rendering::IntegerBitmapLayout& /*bitmapLayout*/, + uno::Sequence< sal_Int8 > DXSurfaceBitmap::getData( rendering::IntegerBitmapLayout& /*bitmapLayout*/, const geometry::IntegerRectangle2D& rect ) { if(hasAlpha()) @@ -517,11 +517,11 @@ namespace dxcanvas const Gdiplus::Rect aRect( tools::gdiPlusRectFromIntegerRectangle2D( rect ) ); Gdiplus::BitmapData aBmpData; - aBmpData.Width = rect.X2-rect.X1; - aBmpData.Height = rect.Y2-rect.Y1; - aBmpData.Stride = 4*aBmpData.Width; + aBmpData.Width = rect.X2-rect.X1; + aBmpData.Height = rect.Y2-rect.Y1; + aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = aRes.getArray(); + aBmpData.Scan0 = aRes.getArray(); // TODO(F1): Support more pixel formats natively @@ -562,7 +562,7 @@ namespace dxcanvas sal_uInt8 *pSrc = (sal_uInt8 *)((((BYTE *)aSurfaceDesc.lpSurface)+(rect.Y1*aSurfaceDesc.lPitch))+rect.X1); sal_uInt8 *pDst = (sal_uInt8 *)aRes.getArray(); sal_uInt32 nSegmentSizeInBytes = nWidth<<4; - for(sal_uInt32 y=0; y<nHeight; ++y) + for(sal_uInt32 y=0; y<nHeight; ++y) { rtl_copyMemory(pDst,pSrc,nSegmentSizeInBytes); pDst += nSegmentSizeInBytes; @@ -578,7 +578,7 @@ namespace dxcanvas sal_uInt8 *pSrc = (sal_uInt8 *)((((BYTE *)aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1); sal_uInt8 *pDst = (sal_uInt8 *)aRes.getArray(); sal_uInt32 nSegmentSizeInBytes = nWidth<<4; - for(sal_uInt32 y=0; y<nHeight; ++y) + for(sal_uInt32 y=0; y<nHeight; ++y) { rtl_copyMemory(pDst,pSrc,nSegmentSizeInBytes); pDst += nSegmentSizeInBytes; @@ -595,20 +595,20 @@ namespace dxcanvas // DXSurfaceBitmap::setData ////////////////////////////////////////////////////////////////////////////////// - void DXSurfaceBitmap::setData( const uno::Sequence< sal_Int8 >& data, - const rendering::IntegerBitmapLayout& /*bitmapLayout*/, - const geometry::IntegerRectangle2D& rect ) + void DXSurfaceBitmap::setData( const uno::Sequence< sal_Int8 >& data, + const rendering::IntegerBitmapLayout& /*bitmapLayout*/, + const geometry::IntegerRectangle2D& rect ) { if(hasAlpha()) { const Gdiplus::Rect aRect( tools::gdiPlusRectFromIntegerRectangle2D( rect ) ); Gdiplus::BitmapData aBmpData; - aBmpData.Width = rect.X2-rect.X1; - aBmpData.Height = rect.Y2-rect.Y1; - aBmpData.Stride = 4*aBmpData.Width; + aBmpData.Width = rect.X2-rect.X1; + aBmpData.Height = rect.Y2-rect.Y1; + aBmpData.Stride = 4*aBmpData.Width; aBmpData.PixelFormat = PixelFormat32bppARGB; - aBmpData.Scan0 = (void*)data.getConstArray(); + aBmpData.Scan0 = (void*)data.getConstArray(); // TODO(F1): Support more pixel formats natively @@ -644,7 +644,7 @@ namespace dxcanvas sal_uInt8 *pSrc = (sal_uInt8 *)data.getConstArray(); sal_uInt8 *pDst = (sal_uInt8 *)((((BYTE *)aSurfaceDesc.lpSurface)+(rect.Y1*aSurfaceDesc.lPitch))+rect.X1); sal_uInt32 nSegmentSizeInBytes = nWidth<<4; - for(sal_uInt32 y=0; y<nHeight; ++y) + for(sal_uInt32 y=0; y<nHeight; ++y) { rtl_copyMemory(pDst,pSrc,nSegmentSizeInBytes); pSrc += nSegmentSizeInBytes; @@ -661,7 +661,7 @@ namespace dxcanvas sal_uInt8 *pSrc = (sal_uInt8 *)data.getConstArray(); sal_uInt8 *pDst = (sal_uInt8 *)((((BYTE *)aLockedRect.pBits)+(rect.Y1*aLockedRect.Pitch))+rect.X1); sal_uInt32 nSegmentSizeInBytes = nWidth<<4; - for(sal_uInt32 y=0; y<nHeight; ++y) + for(sal_uInt32 y=0; y<nHeight; ++y) { rtl_copyMemory(pDst,pSrc,nSegmentSizeInBytes); pSrc += nSegmentSizeInBytes; @@ -679,22 +679,22 @@ namespace dxcanvas // DXSurfaceBitmap::setPixel ////////////////////////////////////////////////////////////////////////////////// - void DXSurfaceBitmap::setPixel( const uno::Sequence< sal_Int8 >& color, - const rendering::IntegerBitmapLayout& /*bitmapLayout*/, + void DXSurfaceBitmap::setPixel( const uno::Sequence< sal_Int8 >& color, + const rendering::IntegerBitmapLayout& /*bitmapLayout*/, const geometry::IntegerPoint2D& pos ) { if(hasAlpha()) { const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() ); - ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, + ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, "CanvasHelper::setPixel: X coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height, + ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height, "CanvasHelper::setPixel: Y coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( color.getLength() > 3, + ENSURE_ARG_OR_THROW( color.getLength() > 3, "CanvasHelper::setPixel: not enough color components" ); - if( Gdiplus::Ok != mpGDIPlusBitmap->SetPixel( pos.X, pos.Y, + if( Gdiplus::Ok != mpGDIPlusBitmap->SetPixel( pos.X, pos.Y, Gdiplus::Color( tools::sequenceToArgb( color )))) { throw uno::RuntimeException(); @@ -702,11 +702,11 @@ namespace dxcanvas } else { - ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getX(), + ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getX(), "CanvasHelper::setPixel: X coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getY(), + ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getY(), "CanvasHelper::setPixel: Y coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( color.getLength() > 3, + ENSURE_ARG_OR_THROW( color.getLength() > 3, "CanvasHelper::setPixel: not enough color components" ); Gdiplus::Color aColor(tools::sequenceToArgb(color)); @@ -743,30 +743,30 @@ namespace dxcanvas // DXSurfaceBitmap::getPixel ////////////////////////////////////////////////////////////////////////////////// - uno::Sequence< sal_Int8 > DXSurfaceBitmap::getPixel( rendering::IntegerBitmapLayout& /*bitmapLayout*/, + uno::Sequence< sal_Int8 > DXSurfaceBitmap::getPixel( rendering::IntegerBitmapLayout& /*bitmapLayout*/, const geometry::IntegerPoint2D& pos ) { if(hasAlpha()) { const geometry::IntegerSize2D aSize( maSize.getX(),maSize.getY() ); - ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, + ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < aSize.Width, "CanvasHelper::getPixel: X coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height, + ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < aSize.Height, "CanvasHelper::getPixel: Y coordinate out of bounds" ); Gdiplus::Color aColor; if( Gdiplus::Ok != mpGDIPlusBitmap->GetPixel( pos.X, pos.Y, &aColor ) ) return uno::Sequence< sal_Int8 >(); - + return tools::argbToIntSequence(aColor.GetValue()); } else { - ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getX(), + ENSURE_ARG_OR_THROW( pos.X >= 0 && pos.X < maSize.getX(), "CanvasHelper::getPixel: X coordinate out of bounds" ); - ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getY(), + ENSURE_ARG_OR_THROW( pos.Y >= 0 && pos.Y < maSize.getY(), "CanvasHelper::getPixel: Y coordinate out of bounds" ); #if DIRECTX_VERSION < 0x0900 @@ -792,7 +792,7 @@ namespace dxcanvas Gdiplus::Color aColor(*pDst); mpSurface->UnlockRect(); #endif - + return tools::argbToIntSequence(aColor.GetValue()); } } diff --git a/canvas/source/directx/dx_surfacebitmap.hxx b/canvas/source/directx/dx_surfacebitmap.hxx index c3f1f9ed9074..ac7f403ad17f 100644 --- a/canvas/source/directx/dx_surfacebitmap.hxx +++ b/canvas/source/directx/dx_surfacebitmap.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -40,10 +40,10 @@ namespace dxcanvas class DXSurfaceBitmap : public IBitmap { public: - DXSurfaceBitmap( const ::basegfx::B2IVector& rSize, - const canvas::ISurfaceProxyManagerSharedPtr& rMgr, - const IDXRenderModuleSharedPtr& rRenderModule, - bool bWithAlpha ); + DXSurfaceBitmap( const ::basegfx::B2IVector& rSize, + const canvas::ISurfaceProxyManagerSharedPtr& rMgr, + const IDXRenderModuleSharedPtr& rRenderModule, + bool bWithAlpha ); bool resize( const ::basegfx::B2IVector& rSize ); void clear(); @@ -54,41 +54,41 @@ namespace dxcanvas virtual ::basegfx::B2IVector getSize() const; virtual bool hasAlpha() const; - COMReference<surface_type> getSurface() const { return mpSurface; } + COMReference<surface_type> getSurface() const { return mpSurface; } - bool draw( double fAlpha, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DHomMatrix& rTransform ); + bool draw( double fAlpha, + const ::basegfx::B2DPoint& rPos, + const ::basegfx::B2DHomMatrix& rTransform ); - bool draw( const ::basegfx::B2IRange& rArea ); + bool draw( const ::basegfx::B2IRange& rArea ); - bool draw( double fAlpha, - const ::basegfx::B2DPoint& rPos, - const ::basegfx::B2DRange& rArea, - const ::basegfx::B2DHomMatrix& rTransform ); + bool draw( double fAlpha, + const ::basegfx::B2DPoint& rPos, + const ::basegfx::B2DRange& rArea, + const ::basegfx::B2DHomMatrix& rTransform ); - bool draw( double fAlpha, + bool draw( double fAlpha, const ::basegfx::B2DPoint& rPos, const ::basegfx::B2DPolyPolygon& rClipPoly, const ::basegfx::B2DHomMatrix& rTransform ); virtual ::com::sun::star::uno::Sequence< sal_Int8 > getData( - ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerRectangle2D& rect ); + ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, + const ::com::sun::star::geometry::IntegerRectangle2D& rect ); virtual void setData( - const ::com::sun::star::uno::Sequence< sal_Int8 >& data, + const ::com::sun::star::uno::Sequence< sal_Int8 >& data, const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerRectangle2D& rect ); + const ::com::sun::star::geometry::IntegerRectangle2D& rect ); virtual void setPixel( - const ::com::sun::star::uno::Sequence< sal_Int8 >& color, + const ::com::sun::star::uno::Sequence< sal_Int8 >& color, const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerPoint2D& pos ); + const ::com::sun::star::geometry::IntegerPoint2D& pos ); virtual ::com::sun::star::uno::Sequence< sal_Int8 > getPixel( - ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, - const ::com::sun::star::geometry::IntegerPoint2D& pos ); + ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout, + const ::com::sun::star::geometry::IntegerPoint2D& pos ); #ifdef DX_DEBUG_IMAGES void imageDebugger(); diff --git a/canvas/source/directx/dx_surfacegraphics.cxx b/canvas/source/directx/dx_surfacegraphics.cxx index 97a89b7e66cf..b6a487b3bbb9 100755 --- a/canvas/source/directx/dx_surfacegraphics.cxx +++ b/canvas/source/directx/dx_surfacegraphics.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,7 +41,7 @@ namespace dxcanvas { COMReference<surface_type> mpSurface; HDC maHDC; - + GraphicsDeleter(const COMReference<surface_type>& rSurface, HDC hdc) : mpSurface(rSurface), maHDC(hdc) @@ -57,7 +57,7 @@ namespace dxcanvas if(mpSurface.is()) mpSurface->ReleaseDC( maHDC ); - } + } }; } diff --git a/canvas/source/directx/dx_surfacegraphics.hxx b/canvas/source/directx/dx_surfacegraphics.hxx index 29b84ed81670..94fda28870f7 100755 --- a/canvas/source/directx/dx_surfacegraphics.hxx +++ b/canvas/source/directx/dx_surfacegraphics.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/canvas/source/directx/dx_textlayout.cxx b/canvas/source/directx/dx_textlayout.cxx index 1516b49d1620..4293b4c7144f 100755 --- a/canvas/source/directx/dx_textlayout.cxx +++ b/canvas/source/directx/dx_textlayout.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -44,10 +44,10 @@ using namespace ::com::sun::star; namespace dxcanvas { - TextLayout::TextLayout( const rendering::StringContext& aText, - sal_Int8 nDirection, - sal_Int64 /*nRandomSeed*/, - const CanvasFont::ImplRef& rFont ) : + TextLayout::TextLayout( const rendering::StringContext& aText, + sal_Int8 nDirection, + sal_Int64 /*nRandomSeed*/, + const CanvasFont::ImplRef& rFont ) : TextLayout_Base( m_aMutex ), maText( aText ), maLogicalAdvancements(), @@ -231,9 +231,9 @@ namespace dxcanvas } bool TextLayout::draw( const GraphicsSharedPtr& rGraphics, - const rendering::ViewState& rViewState, - const rendering::RenderState& rRenderState, - const ::basegfx::B2ISize& rOutputOffset, + const rendering::ViewState& rViewState, + const rendering::RenderState& rRenderState, + const ::basegfx::B2ISize& rOutputOffset, const uno::Reference< rendering::XGraphicDevice >& xGraphicDevice, bool bAlphaSurface ) const { diff --git a/canvas/source/directx/dx_textlayout.hxx b/canvas/source/directx/dx_textlayout.hxx index ca8c6793fe87..3ca6dd96faf4 100755 --- a/canvas/source/directx/dx_textlayout.hxx +++ b/canvas/source/directx/dx_textlayout.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index 56ec00e9a648..88f5a5c87fc1 100755 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -74,16 +74,16 @@ namespace dxcanvas { } - void TextLayoutDrawHelper::drawText( + void TextLayoutDrawHelper::drawText( const GraphicsSharedPtr& rGraphics, - const ::com::sun::star::rendering::ViewState& rViewState, - const ::com::sun::star::rendering::RenderState& rRenderState, - const ::basegfx::B2ISize& rOutputOffset, - const ::com::sun::star::rendering::StringContext& rText, - const ::com::sun::star::uno::Sequence< double >& rLogicalAdvancements, + const ::com::sun::star::rendering::ViewState& rViewState, + const ::com::sun::star::rendering::RenderState& rRenderState, + const ::basegfx::B2ISize& rOutputOffset, + const ::com::sun::star::rendering::StringContext& rText, + const ::com::sun::star::uno::Sequence< double >& rLogicalAdvancements, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XCanvasFont >& rCanvasFont, - const ::com::sun::star::geometry::Matrix2D& rFontMatrix, + ::com::sun::star::rendering::XCanvasFont >& rCanvasFont, + const ::com::sun::star::geometry::Matrix2D& rFontMatrix, bool bAlphaSurface ) { HDC hdc = rGraphics->GetHDC(); @@ -237,10 +237,10 @@ namespace dxcanvas } } - geometry::RealRectangle2D TextLayoutDrawHelper::queryTextBounds( const rendering::StringContext& rText, - const uno::Sequence< double >& rLogicalAdvancements, - const uno::Reference< rendering::XCanvasFont >& rCanvasFont, - const geometry::Matrix2D& rFontMatrix ) + geometry::RealRectangle2D TextLayoutDrawHelper::queryTextBounds( const rendering::StringContext& rText, + const uno::Sequence< double >& rLogicalAdvancements, + const uno::Reference< rendering::XCanvasFont >& rCanvasFont, + const geometry::Matrix2D& rFontMatrix ) { if(!(rText.Length)) return geometry::RealRectangle2D(); diff --git a/canvas/source/directx/dx_textlayout_drawhelper.hxx b/canvas/source/directx/dx_textlayout_drawhelper.hxx index c484867055af..474ffacc0e59 100755 --- a/canvas/source/directx/dx_textlayout_drawhelper.hxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -55,22 +55,22 @@ namespace dxcanvas // draw text void drawText( const boost::shared_ptr<Gdiplus::Graphics>& rGraphics, - const ::com::sun::star::rendering::ViewState& rViewState, - const ::com::sun::star::rendering::RenderState& rRenderState, - const ::basegfx::B2ISize& rOutputOffset, - const ::com::sun::star::rendering::StringContext& rText, - const ::com::sun::star::uno::Sequence< double >& rLogicalAdvancements, + const ::com::sun::star::rendering::ViewState& rViewState, + const ::com::sun::star::rendering::RenderState& rRenderState, + const ::basegfx::B2ISize& rOutputOffset, + const ::com::sun::star::rendering::StringContext& rText, + const ::com::sun::star::uno::Sequence< double >& rLogicalAdvancements, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XCanvasFont >& rCanvasFont, - const ::com::sun::star::geometry::Matrix2D& rFontMatrix, + ::com::sun::star::rendering::XCanvasFont >& rCanvasFont, + const ::com::sun::star::geometry::Matrix2D& rFontMatrix, bool bAlphaSurface ); ::com::sun::star::geometry::RealRectangle2D queryTextBounds( - const ::com::sun::star::rendering::StringContext& rText, - const ::com::sun::star::uno::Sequence< double >& rLogicalAdvancements, + const ::com::sun::star::rendering::StringContext& rText, + const ::com::sun::star::uno::Sequence< double >& rLogicalAdvancements, const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XCanvasFont >& rCanvasFont, - const ::com::sun::star::geometry::Matrix2D& rFontMatrix ); + ::com::sun::star::rendering::XCanvasFont >& rCanvasFont, + const ::com::sun::star::geometry::Matrix2D& rFontMatrix ); #ifdef DBG_UTIL void test(); @@ -78,7 +78,7 @@ namespace dxcanvas protected: ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice > mxGraphicDevice; + ::com::sun::star::rendering::XGraphicDevice > mxGraphicDevice; }; } diff --git a/canvas/source/directx/dx_vcltools.cxx b/canvas/source/directx/dx_vcltools.cxx index c48931b87eae..ef6e9e2ce2f2 100755 --- a/canvas/source/directx/dx_vcltools.cxx +++ b/canvas/source/directx/dx_vcltools.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -69,30 +69,30 @@ namespace dxcanvas return 1L << rBIH.biBitCount; } } - else + else { BITMAPCOREHEADER* pCoreHeader = (BITMAPCOREHEADER*)&rBIH; if( pCoreHeader->bcBitCount <= 8 ) return 1L << pCoreHeader->bcBitCount; } - + return 0; // nothing known } /// Draw DI bits to given Graphics - bool drawDIBits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, - const void* hDIB ) + bool drawDIBits( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, + const void* hDIB ) { - bool bRet( false ); + bool bRet( false ); BitmapSharedPtr pBitmap; const BITMAPINFO* pBI = (BITMAPINFO*)GlobalLock( (HGLOBAL)hDIB ); if( pBI ) { - const BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*)pBI; - const BYTE* pBits = (BYTE*) pBI + *(DWORD*)pBI + + const BITMAPINFOHEADER* pBIH = (BITMAPINFOHEADER*)pBI; + const BYTE* pBits = (BYTE*) pBI + *(DWORD*)pBI + calcDIBColorCount( *pBIH ) * sizeof( RGBQUAD ); // forward to outsourced GDI+ rendering method @@ -111,8 +111,8 @@ namespace dxcanvas Reference to bitmap. Might get modified, in such a way that it will hold a DIB after a successful function call. */ - bool drawVCLBitmap( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, - ::Bitmap& rBmp ) + bool drawVCLBitmap( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, + ::Bitmap& rBmp ) { BitmapSystemData aBmpSysData; @@ -171,15 +171,15 @@ namespace dxcanvas const ::Size aBmpSize( rBmpEx.GetSizePixel() ); RawRGBABitmap aBmpData; - aBmpData.mnWidth = aBmpSize.Width(); - aBmpData.mnHeight = aBmpSize.Height(); + aBmpData.mnWidth = aBmpSize.Width(); + aBmpData.mnHeight = aBmpSize.Height(); aBmpData.mpBitmapData.reset( new sal_uInt8[ 4*aBmpData.mnWidth*aBmpData.mnHeight ] ); Bitmap aBitmap( rBmpEx.GetBitmap() ); ScopedBitmapReadAccess pReadAccess( aBitmap.AcquireReadAccess(), aBitmap ); - + const sal_Int32 nWidth( aBmpSize.Width() ); const sal_Int32 nHeight( aBmpSize.Height() ); @@ -196,14 +196,14 @@ namespace dxcanvas // By convention, the access buffer always has // one of the following formats: - // + // // BMP_FORMAT_1BIT_MSB_PAL - // BMP_FORMAT_4BIT_MSN_PAL - // BMP_FORMAT_8BIT_PAL - // BMP_FORMAT_16BIT_TC_LSB_MASK - // BMP_FORMAT_24BIT_TC_BGR - // BMP_FORMAT_32BIT_TC_MASK - // + // BMP_FORMAT_4BIT_MSN_PAL + // BMP_FORMAT_8BIT_PAL + // BMP_FORMAT_16BIT_TC_LSB_MASK + // BMP_FORMAT_24BIT_TC_BGR + // BMP_FORMAT_32BIT_TC_MASK + // // and is always BMP_FORMAT_BOTTOM_UP // // This is the way @@ -219,11 +219,11 @@ namespace dxcanvas "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "Unsupported alpha scanline format" ); - BitmapColor aCol; + BitmapColor aCol; const sal_Int32 nWidth( aBmpSize.Width() ); const sal_Int32 nHeight( aBmpSize.Height() ); - sal_uInt8* pCurrOutput( aBmpData.mpBitmapData.get() ); - int x, y; + sal_uInt8* pCurrOutput( aBmpData.mpBitmapData.get() ); + int x, y; for( y=0; y<nHeight; ++y ) { @@ -339,14 +339,14 @@ namespace dxcanvas // By convention, the access buffer always has // one of the following formats: - // + // // BMP_FORMAT_1BIT_MSB_PAL - // BMP_FORMAT_4BIT_MSN_PAL - // BMP_FORMAT_8BIT_PAL - // BMP_FORMAT_16BIT_TC_LSB_MASK - // BMP_FORMAT_24BIT_TC_BGR - // BMP_FORMAT_32BIT_TC_MASK - // + // BMP_FORMAT_4BIT_MSN_PAL + // BMP_FORMAT_8BIT_PAL + // BMP_FORMAT_16BIT_TC_LSB_MASK + // BMP_FORMAT_24BIT_TC_BGR + // BMP_FORMAT_32BIT_TC_MASK + // // and is always BMP_FORMAT_BOTTOM_UP // // This is the way @@ -361,12 +361,12 @@ namespace dxcanvas "::dxcanvas::tools::bitmapFromVCLBitmapEx(): " "Unsupported mask scanline format" ); - BitmapColor aCol; - int nCurrBit; - const int nMask( 1L ); - const int nInitialBit(7); - sal_uInt8* pCurrOutput( aBmpData.mpBitmapData.get() ); - int x, y; + BitmapColor aCol; + int nCurrBit; + const int nMask( 1L ); + const int nInitialBit(7); + sal_uInt8* pCurrOutput( aBmpData.mpBitmapData.get() ); + int x, y; // mapping table, to get from mask index color to // alpha value (which depends on the mask's palette) @@ -442,7 +442,7 @@ namespace dxcanvas for( x=0, nCurrBit=nInitialBit; x<nWidth; ++x ) { // yes. x and y are swapped on Get/SetPixel - aCol = pReadAccess->GetColor(y,x); + aCol = pReadAccess->GetColor(y,x); // store as RGBA *pCurrOutput++ = aCol.GetBlue(); @@ -487,10 +487,10 @@ namespace dxcanvas return aBmpData; } - bool drawVCLBitmapEx( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, - const ::BitmapEx& rBmpEx ) + bool drawVCLBitmapEx( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, + const ::BitmapEx& rBmpEx ) { - if( !rBmpEx.IsTransparent() ) + if( !rBmpEx.IsTransparent() ) { Bitmap aBmp( rBmpEx.GetBitmap() ); return drawVCLBitmap( rGraphics, aBmp ); @@ -503,11 +503,11 @@ namespace dxcanvas } } - bool drawVCLBitmapFromXBitmap( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, - const uno::Reference< rendering::XBitmap >& xBitmap ) + bool drawVCLBitmapFromXBitmap( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, + const uno::Reference< rendering::XBitmap >& xBitmap ) { // TODO(F2): add support for floating point bitmap formats - uno::Reference< rendering::XIntegerReadOnlyBitmap > xIntBmp( + uno::Reference< rendering::XIntegerReadOnlyBitmap > xIntBmp( xBitmap, uno::UNO_QUERY ); if( !xIntBmp.is() ) diff --git a/canvas/source/directx/dx_vcltools.hxx b/canvas/source/directx/dx_vcltools.hxx index fab96cb79e5a..2c479873bb70 100755 --- a/canvas/source/directx/dx_vcltools.hxx +++ b/canvas/source/directx/dx_vcltools.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -50,13 +50,13 @@ namespace dxcanvas */ struct RawRGBABitmap { - sal_Int32 mnWidth; - sal_Int32 mnHeight; - ::boost::shared_ptr< sal_uInt8 > mpBitmapData; + sal_Int32 mnWidth; + sal_Int32 mnHeight; + ::boost::shared_ptr< sal_uInt8 > mpBitmapData; }; - bool drawVCLBitmapFromXBitmap( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, - const ::com::sun::star::uno::Reference< + bool drawVCLBitmapFromXBitmap( const ::boost::shared_ptr< Gdiplus::Graphics >& rGraphics, + const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap ); } } diff --git a/canvas/source/directx/dx_winstuff.hxx b/canvas/source/directx/dx_winstuff.hxx index d1718b07f3d1..1c3841bdae09 100755 --- a/canvas/source/directx/dx_winstuff.hxx +++ b/canvas/source/directx/dx_winstuff.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -84,9 +84,14 @@ #else + #include <dxsdkver.h> #include <d3d9.h> #include <d3dx9.h> -// #include <dxerr9.h> #i107614# removing include, it has been changed in the latest sdk fron August2009 from dxerr9.h into dxerr.h + #if _DXSDK_BUILD_MAJOR < 1734 /* Earlier than the August 2009 DXSDK */ + #include <dxerr9.h> + #else + #include <dxerr.h> + #endif typedef IDirect3DSurface9 surface_type; @@ -111,13 +116,13 @@ using ::std::min; namespace dxcanvas { // some shared pointer typedefs to Gdiplus objects - typedef ::boost::shared_ptr< Gdiplus::Graphics > GraphicsSharedPtr; - typedef ::boost::shared_ptr< Gdiplus::GraphicsPath > GraphicsPathSharedPtr; - typedef ::boost::shared_ptr< Gdiplus::Bitmap > BitmapSharedPtr; - typedef ::boost::shared_ptr< Gdiplus::CachedBitmap > CachedBitmapSharedPtr; - typedef ::boost::shared_ptr< Gdiplus::Font > FontSharedPtr; - typedef ::boost::shared_ptr< Gdiplus::Brush > BrushSharedPtr; - typedef ::boost::shared_ptr< Gdiplus::TextureBrush > TextureBrushSharedPtr; + typedef ::boost::shared_ptr< Gdiplus::Graphics > GraphicsSharedPtr; + typedef ::boost::shared_ptr< Gdiplus::GraphicsPath > GraphicsPathSharedPtr; + typedef ::boost::shared_ptr< Gdiplus::Bitmap > BitmapSharedPtr; + typedef ::boost::shared_ptr< Gdiplus::CachedBitmap > CachedBitmapSharedPtr; + typedef ::boost::shared_ptr< Gdiplus::Font > FontSharedPtr; + typedef ::boost::shared_ptr< Gdiplus::Brush > BrushSharedPtr; + typedef ::boost::shared_ptr< Gdiplus::TextureBrush > TextureBrushSharedPtr; /** COM object RAII wrapper @@ -190,13 +195,13 @@ namespace dxcanvas return refcount; } - bool is() const { return mp != NULL; } + bool is() const { return mp != NULL; } T* get() const { return mp; } T* operator->() const { return mp; } T& operator*() const { return *mp; } private: - T* mp; + T* mp; }; // get_pointer() enables boost::mem_fn to recognize COMReference |