From 534e63e54e6be4da6340205c6b070dcebcf65a89 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Tue, 24 Jun 2008 09:30:05 +0000 Subject: [PATCH] INTEGRATION: CWS canvas05 (1.3.2); FILE MERGED 2008/06/03 23:52:23 thb 1.3.2.5: Removed extra level of indirection for getting a graphics for a surface; removed some unused code 2008/06/03 11:11:24 thb 1.3.2.4: Cleaned up image debugging stuff; fixed a few d3d debug warnings; fixed one deadlock rendering a bitmap from the same surface to itself; fixed premature ReleaseDC call in GraphicsProvider::getGraphics() 2008/04/21 07:29:36 thb 1.3.2.3: RESYNC: (1.3-1.4); FILE MERGED 2008/01/22 00:25:22 thb 1.3.2.2: #i81092# Making gdiplus and dx canvas more independent 2007/12/20 22:18:57 thb 1.3.2.1: #i81092# #i78888# #i78925# #i79258# #i79437# #i84784# Large canvas rework, completing various areas such as color spaces, bitmap data access, true sprite and non-sprite implementations, and upstreaming the canvas parts of rodos emf+ rendering --- canvas/source/directx/dx_9rm.cxx | 33 +++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx index 43a32449e8cb..932a15e1f5c1 100755 --- a/canvas/source/directx/dx_9rm.cxx +++ b/canvas/source/directx/dx_9rm.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dx_9rm.cxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.5 $ * * This file is part of OpenOffice.org. * @@ -28,6 +28,9 @@ * ************************************************************************/ +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_canvas.hxx" + #if DIRECTX_VERSION == 0x0900 #define MAX_TEXTURE_SIZE (2048) @@ -49,6 +52,8 @@ #include #include +#include + #include #include #include @@ -64,7 +69,6 @@ #include "dx_rendermodule.hxx" #include "dx_config.hxx" -#include "dx_surfacegraphics.hxx" #undef WB_LEFT #undef WB_RIGHT @@ -73,9 +77,11 @@ #include #if defined(DX_DEBUG_IMAGES) -# include -# undef min -# undef max +# if OSL_DEBUG_LEVEL > 0 +# include +# undef min +# undef max +# endif #endif using namespace ::com::sun::star; @@ -328,7 +334,7 @@ namespace dxcanvas return; #endif - CHECK_AND_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 pDevice(rRenderModule.getDevice()); @@ -538,7 +544,7 @@ namespace dxcanvas break; default: - ENSURE_AND_RETURN(false, + ENSURE_OR_RETURN(false, "DXSurface::update(): Unknown/unimplemented buffer format" ); break; } @@ -626,7 +632,7 @@ namespace dxcanvas IDirect3DVertexBuffer9 *pVB(NULL); DWORD aFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1); if( FAILED(mpDevice->CreateVertexBuffer(sizeof(dxvertex)*maNumVertices, - D3DUSAGE_DYNAMIC, + D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY, aFVF, D3DPOOL_DEFAULT, &pVB, @@ -703,7 +709,7 @@ namespace dxcanvas const HWND hwnd(reinterpret_cast(pData->hWnd)); mhWnd = const_cast(hwnd); - ENSURE_AND_THROW( IsWindow( reinterpret_cast(mhWnd) ), + ENSURE_OR_THROW( IsWindow( reinterpret_cast(mhWnd) ), "DXRenderModule::create() No valid HWND given." ); // retrieve position and size of the parent window @@ -740,7 +746,7 @@ namespace dxcanvas bool DXRenderModule::verifyDevice( const UINT nAdapter ) { - ENSURE_AND_THROW( mpDirect3D9.is(), + ENSURE_OR_THROW( mpDirect3D9.is(), "DXRenderModule::verifyDevice() No valid device." ); // ask direct3d9 about the capabilities of hardware devices on a specific adapter. @@ -797,11 +803,11 @@ namespace dxcanvas bool DXRenderModule::createDevice() { // we expect that the caller provides us with a valid HWND - ENSURE_AND_THROW( IsWindow(mhWnd), + ENSURE_OR_THROW( IsWindow(mhWnd), "DXRenderModule::createDevice() No valid HWND given." ); // we expect that the caller already created the direct3d9 object. - ENSURE_AND_THROW( mpDirect3D9.is(), + ENSURE_OR_THROW( mpDirect3D9.is(), "DXRenderModule::createDevice() no direct3d?." ); // find the adapter identifier from the window. @@ -841,6 +847,7 @@ namespace dxcanvas sal_Int32(d3ddm.Width)); mad3dpp.BackBufferHeight = std::max(sal_Int32(maSize.getY()), sal_Int32(d3ddm.Height)); + mad3dpp.BackBufferCount = 1; mad3dpp.Windowed = TRUE; mad3dpp.SwapEffect = D3DSWAPEFFECT_COPY; mad3dpp.BackBufferFormat = d3ddm.Format; @@ -1078,7 +1085,7 @@ namespace dxcanvas if(isDisposed()) return; - ENSURE_AND_THROW( !mnBeginSceneCount, + ENSURE_OR_THROW( !mnBeginSceneCount, "DXRenderModule::beginPrimitive(): nested call" ); ++mnBeginSceneCount;