diff options
Diffstat (limited to 'canvas/source/directx')
-rwxr-xr-x | canvas/source/directx/dx_9rm.cxx | 42 | ||||
-rwxr-xr-x | canvas/source/directx/dx_surfacegraphics.cxx | 5 | ||||
-rwxr-xr-x | canvas/source/directx/dx_textlayout_drawhelper.cxx | 3 | ||||
-rwxr-xr-x | canvas/source/directx/dx_winstuff.hxx | 25 | ||||
-rw-r--r-- | canvas/source/directx/makefile.mk | 4 |
5 files changed, 55 insertions, 24 deletions
diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index 932a15e1f5c1..acef323ddc1b 100755 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -956,11 +956,43 @@ namespace dxcanvas { if(hr != D3DERR_DEVICELOST) return false; - hr = mpDevice->Reset(&mad3dpp); - if(SUCCEEDED(hr)) - return true; - if(hr == D3DERR_DEVICELOST) - return true; + + // interestingly enough, sometimes the Reset() below + // *still* causes DeviceLost errors. So, cycle until + // DX was kind enough to really reset the device... + do + { + mpVertexBuffer.reset(); + hr = mpDevice->Reset(&mad3dpp); + if(SUCCEEDED(hr)) + { + IDirect3DVertexBuffer9 *pVB(NULL); + DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1); + if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices, + D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, + aFVF, + D3DPOOL_DEFAULT, + &pVB, + NULL)) ) + { + throw lang::NoSupportException( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "Could not create DirectX device - out of memory!")),NULL); + } + mpVertexBuffer=COMReference<IDirect3DVertexBuffer9>(pVB); + + // retry after the restore + if(SUCCEEDED(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0))) + return true; + } + + TimeValue aTimeout; + aTimeout.Seconds=1; + aTimeout.Nanosec=0; + osl_waitThread(&aTimeout); + } + while(hr == D3DERR_DEVICELOST); + return false; } diff --git a/canvas/source/directx/dx_surfacegraphics.cxx b/canvas/source/directx/dx_surfacegraphics.cxx index 128095c1315d..8b9af6be6827 100755 --- a/canvas/source/directx/dx_surfacegraphics.cxx +++ b/canvas/source/directx/dx_surfacegraphics.cxx @@ -34,6 +34,8 @@ #include "dx_surfacegraphics.hxx" #include "dx_impltools.hxx" +using namespace ::com::sun::star; + namespace dxcanvas { namespace @@ -75,11 +77,12 @@ namespace dxcanvas tools::setupGraphics( *pGraphics ); pRet.reset(pGraphics, GraphicsDeleter(rSurface, aHDC)); + return pRet; } else rSurface->ReleaseDC( aHDC ); } - return pRet; + throw uno::RuntimeException(); } } diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index f44d8aa4a518..358bd1e9d74f 100755 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -52,6 +52,7 @@ #include <canvas/debug.hxx> #include "dx_impltools.hxx" #include <vcl/sysdata.hxx> +#include <i18npool/mslangid.hxx> #include "dx_textlayout_drawhelper.hxx" #include "dx_bitmap.hxx" #include "dx_canvasfont.hxx" @@ -135,6 +136,8 @@ namespace dxcanvas aFont.SetWeight( static_cast<FontWeight>(rFontRequest.FontDescription.FontDescription.Weight) ); aFont.SetItalic( (rFontRequest.FontDescription.FontDescription.Letterform<=8) ? ITALIC_NONE : ITALIC_NORMAL ); + aFont.SetLanguage(MsLangId::convertLocaleToLanguage(rFontRequest.Locale)); + // setup font color aFont.SetColor( aColor ); aFont.SetFillColor( aColor ); diff --git a/canvas/source/directx/dx_winstuff.hxx b/canvas/source/directx/dx_winstuff.hxx index e5e7e4ffb4ae..1c64506c0f21 100755 --- a/canvas/source/directx/dx_winstuff.hxx +++ b/canvas/source/directx/dx_winstuff.hxx @@ -97,25 +97,18 @@ #undef DrawText -// Needed for #?$&/@ gdiplus header -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#define __WORKAROUND_MAX_DEFINED__ -#endif - -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#define __WORKAROUND_MIN_DEFINED__ -#endif - +#ifdef __MINGW32__
+using ::std::max;
+using ::std::min;
+#endif
+
#include <gdiplus.h> -#ifdef __WORKAROUND_MAX_DEFINED__ -#undef max +#ifdef min +# undef min #endif - -#ifdef __WORKAROUND_MIN_DEFINED__ -#undef min +#ifdef max +# undef max #endif namespace dxcanvas diff --git a/canvas/source/directx/makefile.mk b/canvas/source/directx/makefile.mk index c1d210dfcf64..1a9db2ec51c0 100644 --- a/canvas/source/directx/makefile.mk +++ b/canvas/source/directx/makefile.mk @@ -96,7 +96,7 @@ GDIPLUS_SLOFILES = \ $(SLO)$/dx_canvas.obj GDIPLUS_SLOFILES += $(SHARED_SLOFILES) -STDLIBS= $(CPPULIB) $(TKLIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB) $(VCLLIB) $(TOOLSLIB) $(UNOTOOLSLIB) +STDLIBS= $(CPPULIB) $(TKLIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB) $(VCLLIB) $(TOOLSLIB) $(UNOTOOLSLIB) $(I18NISOLANGLIB) ######################################################## @@ -194,7 +194,7 @@ LIB3OBJFILES = $(GDIPLUS_SLOFILES) SHL3TARGET=$(TARGET3).uno # Links import libraries. -SHL3STDLIBS= $(CPPULIB) $(TKLIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB) $(VCLLIB) $(TOOLSLIB) $(UNOTOOLSLIB) +SHL3STDLIBS= $(CPPULIB) $(TKLIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB) $(VCLLIB) $(TOOLSLIB) $(UNOTOOLSLIB) $(I18NISOLANGLIB) # Specifies an import library to create. For Win32 only. SHL3IMPLIB=i$(TARGET3).lib |