View | Details | Raw Unified | Return to issue 103464
Collapse All | Expand All

(-)canvas/source/directx/dx_9rm.cxx (-5 / +38 lines)
Lines 53-58 Link Here
53
#include <canvas/debug.hxx>
53
#include <canvas/debug.hxx>
54
#include <canvas/verbosetrace.hxx>
54
#include <canvas/verbosetrace.hxx>
55
#include <tools/diagnose_ex.h>
55
#include <tools/diagnose_ex.h>
56
#include <osl/thread.h>
56
57
57
#include <canvas/elapsedtime.hxx>
58
#include <canvas/elapsedtime.hxx>
58
#include <canvas/canvastools.hxx>
59
#include <canvas/canvastools.hxx>
Lines 956-966 namespace dxcanvas Link Here
956
			{
957
			{
957
				if(hr != D3DERR_DEVICELOST)
958
				if(hr != D3DERR_DEVICELOST)
958
					return false;
959
					return false;
959
				hr = mpDevice->Reset(&mad3dpp);
960
960
				if(SUCCEEDED(hr))
961
                // interestingly enough, sometimes the Reset() below
961
					return true;
962
                // *still* causes DeviceLost errors. So, cycle until
962
				if(hr == D3DERR_DEVICELOST)
963
                // DX was kind enough to really reset the device...
963
					return true;
964
                do
965
                {
966
                    mpVertexBuffer.reset();
967
                    hr = mpDevice->Reset(&mad3dpp);
968
                    if(SUCCEEDED(hr))
969
                    {
970
                        IDirect3DVertexBuffer9 *pVB(NULL);
971
                        DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1);
972
                        if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices,
973
                                                                D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
974
                                                                aFVF,
975
                                                                D3DPOOL_DEFAULT,
976
                                                                &pVB,
977
                                                                NULL)) )
978
                        {
979
                            throw lang::NoSupportException(
980
                                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
981
                                                     "Could not create DirectX device - out of memory!")),NULL);
982
                        }
983
                        mpVertexBuffer=COMReference<IDirect3DVertexBuffer9>(pVB);
984
985
                        // retry after the restore
986
                        if(SUCCEEDED(mpSwapChain->Present(&aRect,&aRect,NULL,NULL,0)))
987
                            return true;
988
                    }
989
990
                    TimeValue aTimeout;
991
                    aTimeout.Seconds=1;
992
                    aTimeout.Nanosec=0;
993
                    osl_waitThread(&aTimeout);
994
                }
995
                while(hr == D3DERR_DEVICELOST);
996
964
				return false;
997
				return false;
965
			}
998
			}
966
999
(-)canvas/source/directx/dx_surfacegraphics.cxx (-1 / +4 lines)
Lines 34-39 Link Here
34
#include "dx_surfacegraphics.hxx"
34
#include "dx_surfacegraphics.hxx"
35
#include "dx_impltools.hxx"
35
#include "dx_impltools.hxx"
36
36
37
using namespace ::com::sun::star;
38
37
namespace dxcanvas
39
namespace dxcanvas
38
{
40
{
39
    namespace
41
    namespace
Lines 75-85 namespace dxcanvas Link Here
75
	            tools::setupGraphics( *pGraphics );
77
	            tools::setupGraphics( *pGraphics );
76
				pRet.reset(pGraphics,
78
				pRet.reset(pGraphics,
77
                           GraphicsDeleter(rSurface, aHDC));
79
                           GraphicsDeleter(rSurface, aHDC));
80
                return pRet;
78
			}
81
			}
79
            else
82
            else
80
                rSurface->ReleaseDC( aHDC );
83
                rSurface->ReleaseDC( aHDC );
81
		}
84
		}
82
85
83
        return pRet;
86
        throw uno::RuntimeException();
84
    }
87
    }
85
}
88
}

Return to issue 103464