INTEGRATION: CWS canvas05 (1.2.2); FILE MERGED

2008/06/03 11:11:24 thb 1.2.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:30:17 thb 1.2.2.3: RESYNC: (1.2-1.3); FILE MERGED
2008/01/22 00:25:23 thb 1.2.2.2: #i81092# Making gdiplus and dx canvas more independent
2007/12/20 22:18:57 thb 1.2.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
This commit is contained in:
Kurt Zenker
2008-06-24 09:37:25 +00:00
parent 77627c5756
commit e14b94ab84

View File

@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite * OpenOffice.org - a multi-platform office productivity suite
* *
* $RCSfile: dx_spritecanvashelper.cxx,v $ * $RCSfile: dx_spritecanvashelper.cxx,v $
* $Revision: 1.3 $ * $Revision: 1.4 $
* *
* This file is part of OpenOffice.org. * This file is part of OpenOffice.org.
* *
@@ -28,9 +28,13 @@
* *
************************************************************************/ ************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_canvas.hxx"
#include <canvas/debug.hxx> #include <canvas/debug.hxx>
#include <canvas/verbosetrace.hxx> #include <canvas/verbosetrace.hxx>
#include <canvas/canvastools.hxx> #include <canvas/canvastools.hxx>
#include <tools/diagnose_ex.h>
#include <comphelper/scopeguard.hxx> #include <comphelper/scopeguard.hxx>
@@ -42,6 +46,14 @@
#include "dx_spritecanvashelper.hxx" #include "dx_spritecanvashelper.hxx"
#include "dx_canvascustomsprite.hxx" #include "dx_canvascustomsprite.hxx"
#if defined(DX_DEBUG_IMAGES)
# if OSL_DEBUG_LEVEL > 0
# include <imdebug.h>
# undef min
# undef max
# endif
#endif
using namespace ::com::sun::star; using namespace ::com::sun::star;
namespace dxcanvas namespace dxcanvas
@@ -50,7 +62,7 @@ namespace dxcanvas
{ {
void repaintBackground( const ::basegfx::B2DRange& rUpdateArea, void repaintBackground( const ::basegfx::B2DRange& rUpdateArea,
const ::basegfx::B2IRange& rOutputArea, const ::basegfx::B2IRange& rOutputArea,
const DXBitmapSharedPtr& rBackBuffer ) const DXSurfaceBitmapSharedPtr& rBackBuffer )
{ {
// TODO(E1): Use numeric_cast to catch overflow here // TODO(E1): Use numeric_cast to catch overflow here
::basegfx::B2IRange aActualArea( 0, 0, ::basegfx::B2IRange aActualArea( 0, 0,
@@ -94,6 +106,7 @@ namespace dxcanvas
} }
SpriteCanvasHelper::SpriteCanvasHelper() : SpriteCanvasHelper::SpriteCanvasHelper() :
mpSpriteSurface( NULL ),
mpRedrawManager( NULL ), mpRedrawManager( NULL ),
mpRenderModule(), mpRenderModule(),
mpSurfaceProxy(), mpSurfaceProxy(),
@@ -108,19 +121,22 @@ namespace dxcanvas
#endif #endif
} }
void SpriteCanvasHelper::init( ::canvas::SpriteRedrawManager& rManager, void SpriteCanvasHelper::init( SpriteCanvas& rParent,
::canvas::SpriteRedrawManager& rManager,
const IDXRenderModuleSharedPtr& rRenderModule, const IDXRenderModuleSharedPtr& rRenderModule,
const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy, const ::canvas::ISurfaceProxyManagerSharedPtr& rSurfaceProxy,
const DXBitmapSharedPtr& rBackBuffer, const DXSurfaceBitmapSharedPtr& rBackBuffer,
const ::basegfx::B2ISize& rOutputOffset ) const ::basegfx::B2ISize& rOutputOffset )
{ {
// init base // init base
setDevice( rParent );
setTarget( rBackBuffer, rOutputOffset ); setTarget( rBackBuffer, rOutputOffset );
mpSpriteSurface = &rParent;
mpRedrawManager = &rManager; mpRedrawManager = &rManager;
mpRenderModule = rRenderModule; mpRenderModule = rRenderModule;
mpSurfaceProxy = rSurfaceProxy; mpSurfaceProxy = rSurfaceProxy;
mpBackBuffer = rBackBuffer; mpBackBuffer = rBackBuffer;
} }
void SpriteCanvasHelper::disposing() void SpriteCanvasHelper::disposing()
@@ -131,6 +147,7 @@ namespace dxcanvas
mpBackBuffer.reset(); mpBackBuffer.reset();
mpRenderModule.reset(); mpRenderModule.reset();
mpRedrawManager = NULL; mpRedrawManager = NULL;
mpSpriteSurface = NULL;
// forward to base // forward to base
CanvasHelper::disposing(); CanvasHelper::disposing();
@@ -156,7 +173,7 @@ namespace dxcanvas
return uno::Reference< rendering::XCustomSprite >( return uno::Reference< rendering::XCustomSprite >(
new CanvasCustomSprite( spriteSize, new CanvasCustomSprite( spriteSize,
mpDevice, mpSpriteSurface,
mpRenderModule, mpRenderModule,
mpSurfaceProxy, mpSurfaceProxy,
mbShowSpriteBounds ) ); mbShowSpriteBounds ) );
@@ -178,6 +195,12 @@ namespace dxcanvas
return sal_False; // disposed, or otherwise dysfunctional return sal_False; // disposed, or otherwise dysfunctional
} }
#if defined(DX_DEBUG_IMAGES)
# if OSL_DEBUG_LEVEL > 0
mpBackBuffer->imageDebugger();
# endif
#endif
// store current output area (need to tunnel that to the // store current output area (need to tunnel that to the
// background, scroll, opaque and general sprite repaint // background, scroll, opaque and general sprite repaint
// routines) // routines)
@@ -246,7 +269,7 @@ namespace dxcanvas
void SpriteCanvasHelper::backgroundPaint( const ::basegfx::B2DRange& rUpdateRect ) void SpriteCanvasHelper::backgroundPaint( const ::basegfx::B2DRange& rUpdateRect )
{ {
ENSURE_AND_THROW( mpRenderModule && ENSURE_OR_THROW( mpRenderModule &&
mpBackBuffer, mpBackBuffer,
"SpriteCanvasHelper::backgroundPaint(): NULL device pointer " ); "SpriteCanvasHelper::backgroundPaint(): NULL device pointer " );
@@ -259,7 +282,7 @@ namespace dxcanvas
const ::basegfx::B2DRange& rMoveEnd, const ::basegfx::B2DRange& rMoveEnd,
const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea ) const ::canvas::SpriteRedrawManager::UpdateArea& rUpdateArea )
{ {
ENSURE_AND_THROW( mpRenderModule && ENSURE_OR_THROW( mpRenderModule &&
mpBackBuffer, mpBackBuffer,
"SpriteCanvasHelper::scrollUpdate(): NULL device pointer " ); "SpriteCanvasHelper::scrollUpdate(): NULL device pointer " );
@@ -309,7 +332,7 @@ namespace dxcanvas
void SpriteCanvasHelper::opaqueUpdate( const ::basegfx::B2DRange& rTotalArea, void SpriteCanvasHelper::opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites ) const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites )
{ {
ENSURE_AND_THROW( mpRenderModule && ENSURE_OR_THROW( mpRenderModule &&
mpBackBuffer, mpBackBuffer,
"SpriteCanvasHelper::opaqueUpdate(): NULL device pointer " ); "SpriteCanvasHelper::opaqueUpdate(): NULL device pointer " );
@@ -333,7 +356,7 @@ namespace dxcanvas
void SpriteCanvasHelper::genericUpdate( const ::basegfx::B2DRange& rTotalArea, void SpriteCanvasHelper::genericUpdate( const ::basegfx::B2DRange& rTotalArea,
const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites ) const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites )
{ {
ENSURE_AND_THROW( mpRenderModule && ENSURE_OR_THROW( mpRenderModule &&
mpBackBuffer, mpBackBuffer,
"SpriteCanvasHelper::genericUpdate(): NULL device pointer " ); "SpriteCanvasHelper::genericUpdate(): NULL device pointer " );