summaryrefslogtreecommitdiff
path: root/canvas/source/vcl
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2005-11-02 11:58:16 +0000
committerKurt Zenker <kz@openoffice.org>2005-11-02 11:58:16 +0000
commite11e9e595fcbd284d6bec667da90efc528a489ee (patch)
treecc1d6e13e004078bf2ec251ff271266cd91d01b9 /canvas/source/vcl
parentb6b5a7a015ce0830277da291a02bbaaf46a94269 (diff)
INTEGRATION: CWS canvas02 (1.5.8); FILE MERGED
2005/10/08 12:52:50 thb 1.5.8.3: RESYNC: (1.5-1.6); FILE MERGED 2005/07/03 20:25:14 thb 1.5.8.2: #i48939# Reworked ParametricPolyPolygon, to extract state in an atomic operation; added more state checking 'isXDirty()' methods to canvascustomspritehelper; added various comments and notes 2005/06/17 23:49:48 thb 1.5.8.1: #i48939# Huge refactoring of canvas; as much functionality as possible is now common in a bunch of shared base classes (input checking, locking, sprite redraw, etc.); added scroll update optimization, transparently to all canvas implementations
Diffstat (limited to 'canvas/source/vcl')
-rw-r--r--canvas/source/vcl/canvasbitmap.cxx72
1 files changed, 23 insertions, 49 deletions
diff --git a/canvas/source/vcl/canvasbitmap.cxx b/canvas/source/vcl/canvasbitmap.cxx
index c553a91de741..cb17998b59af 100644
--- a/canvas/source/vcl/canvasbitmap.cxx
+++ b/canvas/source/vcl/canvasbitmap.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: canvasbitmap.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: rt $ $Date: 2005-09-07 23:17:14 $
+ * last change: $Author: kz $ $Date: 2005-11-02 12:58:16 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -36,12 +36,7 @@
#include <canvas/debug.hxx>
#include "canvasbitmap.hxx"
-#ifndef _SV_BITMAPEX_HXX
-#include <vcl/bitmapex.hxx>
-#endif
-#ifndef _SV_BMPACC_HXX
#include <vcl/bmpacc.hxx>
-#endif
using namespace ::com::sun::star;
@@ -51,9 +46,10 @@ namespace vclcanvas
// Currently, the only way to generate an XBitmap is from
// XGraphicDevice.getCompatibleBitmap(). Therefore, we don't even
// take a bitmap here, but a VDev directly.
- CanvasBitmap::CanvasBitmap( const ::Size& rSize,
- bool bAlphaBitmap,
- const WindowGraphicDevice::ImplRef& rDevice )
+ CanvasBitmap::CanvasBitmap( const ::Size& rSize,
+ bool bAlphaBitmap,
+ const DeviceRef& rDevice ) :
+ mpDevice( rDevice )
{
ENSURE_AND_THROW( rDevice->getOutDev(),
"CanvasBitmap::CanvasBitmap(): Invalid reference outdev" );
@@ -66,30 +62,6 @@ namespace vclcanvas
const USHORT nBitCount( (USHORT)24U );
const BitmapPalette* pPalette = NULL;
-#if 0
- // TODO(P2): Seems like VCL doesn't handle palette bitmap with
- // alpha channel. Devise other ways to handle this, or fix VCL
- const USHORT nBitCount( ::std::min( (USHORT)24U,
- (USHORT)rOutDev.GetBitCount() ) );
-
- if( nBitCount <= 8 )
- {
- rOutDev.EnableMapMode( FALSE );
-
- // try to determine palette from output device (by
- // extracting a 1,1 bitmap, and querying it)
- const Point aEmptyPoint;
- const Size aSize(1,1);
- Bitmap aTmpBitmap( rOutDev.GetBitmap( aEmptyPoint,
- aSize ) );
-
- ScopedBitmapReadAccess pReadAccess( aTmpBitmap.AcquireReadAccess(),
- aTmpBitmap );
-
- pPalette = &pReadAccess->GetPalette();
- }
-#endif
-
Bitmap aBitmap( rSize, nBitCount, pPalette );
// only create alpha channel bitmap, if factory requested
@@ -100,43 +72,41 @@ namespace vclcanvas
{
AlphaMask aAlpha ( rSize );
- maCanvasHelper.setBitmap( BitmapEx( aBitmap, aAlpha ),
- rDevice );
+ maCanvasHelper.init( BitmapEx( aBitmap, aAlpha ),
+ *rDevice.get() );
}
else
{
- maCanvasHelper.setBitmap( BitmapEx( aBitmap ),
- rDevice );
+ maCanvasHelper.init( BitmapEx( aBitmap ),
+ *rDevice.get() );
}
}
- CanvasBitmap::CanvasBitmap( const BitmapEx& rBitmap,
- const WindowGraphicDevice::ImplRef& rDevice )
+ CanvasBitmap::CanvasBitmap( const BitmapEx& rBitmap,
+ const DeviceRef& rDevice ) :
+ mpDevice( rDevice )
{
ENSURE_AND_THROW( rDevice->getOutDev(),
"CanvasBitmap::CanvasBitmap(): Invalid reference outdev" );
- maCanvasHelper.setBitmap( rBitmap,
- rDevice );
- }
-
- CanvasBitmap::~CanvasBitmap()
- {
+ maCanvasHelper.init( rBitmap,
+ *rDevice.get() );
}
void SAL_CALL CanvasBitmap::disposing()
{
- tools::LocalGuard aGuard;
+ mpDevice.clear();
- // forward to parent
+ // forward to base
CanvasBitmap_Base::disposing();
}
+#define IMPLEMENTATION_NAME "VCLCanvas.CanvasBitmap"
#define SERVICE_NAME "com.sun.star.rendering.CanvasBitmap"
::rtl::OUString SAL_CALL CanvasBitmap::getImplementationName( ) throw (uno::RuntimeException)
{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CANVASBITMAP_IMPLEMENTATION_NAME ) );
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) );
}
sal_Bool SAL_CALL CanvasBitmap::supportsService( const ::rtl::OUString& ServiceName ) throw (uno::RuntimeException)
@@ -154,6 +124,10 @@ namespace vclcanvas
BitmapEx CanvasBitmap::getBitmap() const
{
+ tools::LocalGuard aGuard;
+
+ // TODO(T3): Rework to use shared_ptr all over the place for
+ // BmpEx. This is highly un-threadsafe
return maCanvasHelper.getBitmap();
}