2004-03-18 09:38:44 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 08:48:23 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:48:23 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:48:23 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:48:23 +00:00
|
|
|
* $RCSfile: canvascustomsprite.cxx,v $
|
2008-06-24 09:56:25 +00:00
|
|
|
* $Revision: 1.15 $
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:48:23 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:48:23 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:48:23 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
2008-04-11 08:48:23 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2004-03-18 09:38:44 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 02:29:54 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_canvas.hxx"
|
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
#include <canvas/debug.hxx>
|
2008-06-24 09:56:25 +00:00
|
|
|
#include <tools/diagnose_ex.h>
|
2004-11-26 16:11:13 +00:00
|
|
|
#include <canvas/verbosetrace.hxx>
|
|
|
|
|
2004-03-18 09:38:44 +00:00
|
|
|
#include <rtl/math.hxx>
|
|
|
|
|
|
|
|
#include <vcl/outdev.hxx>
|
|
|
|
#include <vcl/bitmap.hxx>
|
2004-11-26 16:11:13 +00:00
|
|
|
#include <vcl/alpha.hxx>
|
|
|
|
#include <vcl/bitmapex.hxx>
|
2004-03-18 09:38:44 +00:00
|
|
|
#include <vcl/canvastools.hxx>
|
|
|
|
|
|
|
|
#include <basegfx/matrix/b2dhommatrix.hxx>
|
|
|
|
#include <basegfx/point/b2dpoint.hxx>
|
|
|
|
#include <basegfx/tools/canvastools.hxx>
|
2005-03-10 10:57:53 +00:00
|
|
|
#include <basegfx/polygon/b2dpolygon.hxx>
|
|
|
|
#include <basegfx/polygon/b2dpolygontools.hxx>
|
2005-05-06 08:16:52 +00:00
|
|
|
#include <basegfx/polygon/b2dpolypolygontools.hxx>
|
2004-11-26 16:11:13 +00:00
|
|
|
#include <basegfx/numeric/ftools.hxx>
|
|
|
|
|
|
|
|
#include <canvas/canvastools.hxx>
|
|
|
|
|
|
|
|
#include "canvascustomsprite.hxx"
|
|
|
|
|
2004-03-18 09:38:44 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
|
2004-03-18 09:38:44 +00:00
|
|
|
namespace vclcanvas
|
|
|
|
{
|
|
|
|
|
2008-06-24 09:56:25 +00:00
|
|
|
CanvasCustomSprite::CanvasCustomSprite( const geometry::RealSize2D& rSpriteSize,
|
|
|
|
rendering::XGraphicDevice& rDevice,
|
|
|
|
const ::canvas::SpriteSurface::Reference& rOwningSpriteCanvas,
|
|
|
|
const OutDevProviderSharedPtr& rOutDevProvider,
|
|
|
|
bool bShowSpriteBounds )
|
2004-03-18 09:38:44 +00:00
|
|
|
{
|
2008-06-24 09:56:25 +00:00
|
|
|
ENSURE_OR_THROW( rOwningSpriteCanvas.get() &&
|
|
|
|
rOutDevProvider,
|
|
|
|
"CanvasCustomSprite::CanvasCustomSprite(): Invalid sprite canvas" );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
// setup back buffer
|
|
|
|
// -----------------
|
2004-03-18 09:38:44 +00:00
|
|
|
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
const ::Size aSize(
|
|
|
|
static_cast<sal_Int32>( ::std::max( 1.0,
|
|
|
|
ceil( rSpriteSize.Width ))), // round up to nearest int,
|
|
|
|
// enforce sprite to have at
|
|
|
|
// least (1,1) pixel size
|
|
|
|
static_cast<sal_Int32>( ::std::max( 1.0,
|
|
|
|
ceil( rSpriteSize.Height ))) );
|
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
// create content backbuffer in screen depth
|
2008-06-24 09:56:25 +00:00
|
|
|
BackBufferSharedPtr pBackBuffer( new BackBuffer( rOutDevProvider->getOutDev() ) );
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
pBackBuffer->setSize( aSize );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
// create mask backbuffer, with one bit color depth
|
2008-06-24 09:56:25 +00:00
|
|
|
BackBufferSharedPtr pBackBufferMask( new BackBuffer( rOutDevProvider->getOutDev(),
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
true ) );
|
|
|
|
pBackBufferMask->setSize( aSize );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
// TODO(F1): Implement alpha vdev (could prolly enable
|
|
|
|
// antialiasing again, then)
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
// disable font antialiasing (causes ugly shadows otherwise)
|
2008-06-24 09:56:25 +00:00
|
|
|
pBackBuffer->getOutDev().SetAntialiasing( ANTIALIASING_DISABLE_TEXT );
|
|
|
|
pBackBufferMask->getOutDev().SetAntialiasing( ANTIALIASING_DISABLE_TEXT );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
// set mask vdev drawmode, such that everything is painted
|
|
|
|
// black. That leaves us with a binary image, white for
|
|
|
|
// background, black for painted content
|
2008-06-24 09:56:25 +00:00
|
|
|
pBackBufferMask->getOutDev().SetDrawMode( DRAWMODE_BLACKLINE | DRAWMODE_BLACKFILL | DRAWMODE_BLACKTEXT |
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
DRAWMODE_BLACKGRADIENT | DRAWMODE_BLACKBITMAP );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
// setup canvas helper
|
|
|
|
// -------------------
|
2004-03-18 09:38:44 +00:00
|
|
|
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
// always render into back buffer, don't preserve state (it's
|
|
|
|
// our private VDev, after all), have notion of alpha
|
2008-06-24 09:56:25 +00:00
|
|
|
maCanvasHelper.init( rDevice,
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
pBackBuffer,
|
|
|
|
false,
|
|
|
|
true );
|
|
|
|
maCanvasHelper.setBackgroundOutDev( pBackBufferMask );
|
2004-03-18 09:38:44 +00:00
|
|
|
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
|
|
|
|
// setup sprite helper
|
|
|
|
// -------------------
|
|
|
|
|
|
|
|
maSpriteHelper.init( rSpriteSize,
|
2008-06-24 09:56:25 +00:00
|
|
|
rOwningSpriteCanvas,
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
pBackBuffer,
|
|
|
|
pBackBufferMask,
|
|
|
|
bShowSpriteBounds );
|
2007-07-17 13:25:27 +00:00
|
|
|
|
|
|
|
// clear sprite to 100% transparent
|
|
|
|
maCanvasHelper.clear();
|
2004-03-18 09:38:44 +00:00
|
|
|
}
|
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
void SAL_CALL CanvasCustomSprite::disposing()
|
2004-03-18 09:38:44 +00:00
|
|
|
{
|
2004-11-26 16:11:13 +00:00
|
|
|
tools::LocalGuard aGuard;
|
2004-03-18 09:38:44 +00:00
|
|
|
|
2004-11-26 16:11:13 +00:00
|
|
|
// forward to parent
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
CanvasCustomSpriteBaseT::disposing();
|
2004-03-18 09:38:44 +00:00
|
|
|
}
|
|
|
|
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
#define IMPLEMENTATION_NAME "VCLCanvas.CanvasCustomSprite"
|
2005-03-10 10:57:53 +00:00
|
|
|
#define SERVICE_NAME "com.sun.star.rendering.CanvasCustomSprite"
|
2004-03-18 09:38:44 +00:00
|
|
|
|
|
|
|
::rtl::OUString SAL_CALL CanvasCustomSprite::getImplementationName() throw( uno::RuntimeException )
|
|
|
|
{
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) );
|
2004-03-18 09:38:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL CanvasCustomSprite::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Sequence< ::rtl::OUString > SAL_CALL CanvasCustomSprite::getSupportedServiceNames() throw( uno::RuntimeException )
|
|
|
|
{
|
|
|
|
uno::Sequence< ::rtl::OUString > aRet(1);
|
|
|
|
aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sprite
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
void CanvasCustomSprite::redraw( OutputDevice& rOutDev,
|
|
|
|
bool bBufferedUpdate ) const
|
2004-03-18 09:38:44 +00:00
|
|
|
{
|
2004-11-26 16:11:13 +00:00
|
|
|
tools::LocalGuard aGuard;
|
|
|
|
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
redraw( rOutDev, maSpriteHelper.getPosPixel(), bBufferedUpdate );
|
2004-03-18 09:38:44 +00:00
|
|
|
}
|
|
|
|
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
void CanvasCustomSprite::redraw( OutputDevice& rOutDev,
|
|
|
|
const ::basegfx::B2DPoint& rOrigOutputPos,
|
|
|
|
bool bBufferedUpdate ) const
|
2004-03-18 09:38:44 +00:00
|
|
|
{
|
2004-11-26 16:11:13 +00:00
|
|
|
tools::LocalGuard aGuard;
|
|
|
|
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
maSpriteHelper.redraw( rOutDev,
|
|
|
|
rOrigOutputPos,
|
|
|
|
mbSurfaceDirty,
|
|
|
|
bBufferedUpdate );
|
2004-11-26 16:11:13 +00:00
|
|
|
|
INTEGRATION: CWS canvas02 (1.8.2); FILE MERGED
2005/10/08 12:53:51 thb 1.8.2.6: RESYNC: (1.8-1.9); FILE MERGED
2005/09/27 09:22:14 thb 1.8.2.5: #i48939# Removed alpha VDev option from BackBuffer (wasn't used since ages); correctly setting backbuffer size (rounded _up_, like the sprite size itself is calculated, too)
2005/09/22 21:00:53 thb 1.8.2.4: #i48939# Employing faster XOR masking for the special case nontransparent, non-alpha bitmap redraw in backbuffer (incidently, that matches the typical slide transition sprite update)
2005/07/21 14:52:47 thb 1.8.2.3: #i48939# Factored out round up/down to integer; removed backend specific methods from base Sprite interface; removed updateScreen overwrite from SpriteCanvasBase (too much backend specifics need to be passed to HW canvases); now passing the target OutputDevice directly via Sprite::redraw() method in VCL canvas; made XFont -> impl font conversion dynamic cast, too; removed the getSpriteTargetSurface crap from SpriteCanvas
2005/07/03 20:25:14 thb 1.8.2.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:49 thb 1.8.2.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
2005-11-02 11:59:14 +00:00
|
|
|
mbSurfaceDirty = false;
|
2004-11-26 16:11:13 +00:00
|
|
|
}
|
2005-03-30 06:36:15 +00:00
|
|
|
|
|
|
|
bool CanvasCustomSprite::repaint( const GraphicObjectSharedPtr& rGrf,
|
2007-11-01 13:41:02 +00:00
|
|
|
const rendering::ViewState& viewState,
|
|
|
|
const rendering::RenderState& renderState,
|
2005-03-30 06:36:15 +00:00
|
|
|
const ::Point& rPt,
|
|
|
|
const ::Size& rSz,
|
|
|
|
const GraphicAttr& rAttr ) const
|
|
|
|
{
|
|
|
|
tools::LocalGuard aGuard;
|
|
|
|
|
|
|
|
mbSurfaceDirty = true;
|
|
|
|
|
2007-11-01 13:41:02 +00:00
|
|
|
return maCanvasHelper.repaint( rGrf, viewState, renderState, rPt, rSz, rAttr );
|
2005-03-30 06:36:15 +00:00
|
|
|
}
|
2005-04-18 08:10:29 +00:00
|
|
|
|
2004-03-18 09:38:44 +00:00
|
|
|
}
|