Files
libreoffice/canvas/source/vcl/canvascustomsprite.cxx

911 lines
37 KiB
C++
Raw Normal View History

/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: canvascustomsprite.cxx,v $
*
* $Revision: 1.9 $
*
* last change: $Author: rt $ $Date: 2005-09-07 23:18:26 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
#include <canvas/debug.hxx>
#include <canvas/verbosetrace.hxx>
#ifndef INCLUDED_RTL_MATH_HXX
#include <rtl/math.hxx>
#endif
#ifndef _SV_OUTDEV_HXX
#include <vcl/outdev.hxx>
#endif
#ifndef _SV_BITMAP_HXX
#include <vcl/bitmap.hxx>
#endif
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
#ifndef _SV_ALPHA_HXX
#include <vcl/alpha.hxx>
#endif
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
#ifndef _SV_BITMAPEX_HXX
#include <vcl/bitmapex.hxx>
#endif
#ifndef _VCL_CANVASTOOLS_HXX
#include <vcl/canvastools.hxx>
#endif
#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
#include <basegfx/matrix/b2dhommatrix.hxx>
#endif
#ifndef _BGFX_POINT_B2DPOINT_HXX
#include <basegfx/point/b2dpoint.hxx>
#endif
#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
#include <basegfx/tools/canvastools.hxx>
#endif
#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
#include <basegfx/polygon/b2dpolygon.hxx>
#endif
#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
#include <basegfx/polygon/b2dpolygontools.hxx>
#endif
#ifndef _BGFX_POLYGON_B2DPOLYPOLYGONTOOLS_HXX
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#endif
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
#ifndef _BGFX_NUMERIC_FTOOLS_HXX
#include <basegfx/numeric/ftools.hxx>
#endif
#include <canvas/canvastools.hxx>
#include "canvascustomsprite.hxx"
using namespace ::com::sun::star;
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
namespace vclcanvas
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
CanvasCustomSprite::CanvasCustomSprite( const geometry::RealSize2D& rSpriteSize,
const WindowGraphicDevice::ImplRef& rDevice,
const SpriteCanvas::ImplRef& rSpriteCanvas ) :
mpBackBuffer(),
mpBackBufferMask(),
mpSpriteCanvas( rSpriteCanvas ),
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
maContent(),
maCurrClipBounds(),
maPosition(0.0, 0.0),
maSize( 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 ) ) ) ),
maTransform(),
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
mxClipPoly(),
mfAlpha(0.0),
mbActive(false),
mbIsCurrClipRectangle(true),
mbIsContentFullyOpaque( false ),
mbTransformDirty( true )
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
ENSURE_AND_THROW( rDevice.get() && rSpriteCanvas.get(),
"CanvasBitmap::CanvasBitmap(): Invalid device or sprite canvas" );
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// setup graphic device
maCanvasHelper.setGraphicDevice( rDevice );
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// setup back buffer
// -----------------
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// create content backbuffer in screen depth
mpBackBuffer.reset( new BackBuffer( *rDevice->getOutDev() ) );
mpBackBuffer->getVirDev().SetOutputSizePixel( maSize );
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// create mask backbuffer, with one bit color depth
mpBackBufferMask.reset( new BackBuffer( *rDevice->getOutDev(), true ) );
mpBackBufferMask->getVirDev().SetOutputSizePixel( maSize );
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// TODO(F1): Implement alpha vdev (could prolly enable
// antialiasing again, then)
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// disable font antialiasing (causes ugly shadows otherwise)
mpBackBuffer->getVirDev().SetAntialiasing( ANTIALIASING_DISABLE_TEXT );
mpBackBufferMask->getVirDev().SetAntialiasing( ANTIALIASING_DISABLE_TEXT );
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
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
mpBackBufferMask->getVirDev().SetDrawMode( DRAWMODE_BLACKLINE | DRAWMODE_BLACKFILL | DRAWMODE_BLACKTEXT |
DRAWMODE_BLACKGRADIENT | DRAWMODE_BLACKBITMAP );
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// setup canvas helper
// -------------------
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// always render into back buffer, don't preserve state
// (it's our private VDev, after all)
maCanvasHelper.setOutDev( mpBackBuffer, false );
maCanvasHelper.setBackgroundOutDev( mpBackBufferMask );
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
CanvasCustomSprite::~CanvasCustomSprite()
{
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
void SAL_CALL CanvasCustomSprite::disposing()
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
mpSpriteCanvas.clear();
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// forward to parent
CanvasCustomSprite_Base::disposing();
}
uno::Reference< rendering::XCachedPrimitive > SAL_CALL CanvasCustomSprite::drawBitmap( const uno::Reference< rendering::XBitmap >& xBitmap,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState ) throw (lang::IllegalArgumentException, uno::RuntimeException)
{
tools::LocalGuard aGuard;
const ::BitmapEx& rBmpEx( tools::bitmapExFromXBitmap(xBitmap) );
// check whether bitmap is non-alpha, and whether its
// transformed size covers the whole sprite.
if( !rBmpEx.IsTransparent() )
{
// TODO(Q2): Factor out to canvastools or similar
::basegfx::B2DHomMatrix aTransform;
::canvas::tools::mergeViewAndRenderTransform(aTransform,
viewState,
renderState);
const geometry::IntegerSize2D& rSize( xBitmap->getSize() );
::basegfx::B2DPolygon aPoly(
::basegfx::tools::createPolygonFromRect(
::basegfx::B2DRectangle( 0.0,0.0,
rSize.Width+1,
rSize.Height+1 ) ) );
aPoly.transform( aTransform );
if( ::basegfx::tools::isInside(
aPoly,
::basegfx::tools::createPolygonFromRect(
::basegfx::B2DRectangle( 0.0,0.0,
maSize.Width(),
maSize.Height() ) ),
true ) )
{
// bitmap will fully cover the sprite, set flag
// appropriately
mbIsContentFullyOpaque = true;
}
}
// delegate to base
return CanvasCustomSprite_Base::drawBitmap( xBitmap,
viewState,
renderState );
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
void SAL_CALL CanvasCustomSprite::setAlpha( double alpha ) throw (lang::IllegalArgumentException, uno::RuntimeException)
{
tools::LocalGuard aGuard;
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
if( !mpSpriteCanvas.get() )
return; // we're disposed
::canvas::tools::checkRange(alpha, 0.0, 1.0);
if( alpha != mfAlpha )
{
mfAlpha = alpha;
if( mbActive )
mpSpriteCanvas->updateSprite( Sprite::ImplRef( this ),
::vcl::unotools::pointFromB2DPoint( maPosition ),
getSpriteRect() );
}
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
void SAL_CALL CanvasCustomSprite::move( const geometry::RealPoint2D& aNewPos,
const rendering::ViewState& viewState,
const rendering::RenderState& renderState ) throw (lang::IllegalArgumentException, uno::RuntimeException)
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
if( !mpSpriteCanvas.get() )
return; // we're disposed
::basegfx::B2DHomMatrix aTransform;
::canvas::tools::mergeViewAndRenderTransform(aTransform,
viewState,
renderState);
::basegfx::B2DPoint aPoint( ::basegfx::unotools::b2DPointFromRealPoint2D(aNewPos) );
aPoint *= aTransform;
if( aPoint != maPosition )
{
const ::Rectangle& rBounds( getFullSpriteRect() );
const ::basegfx::B2DPoint& rOutPos(
::vcl::unotools::b2DPointFromPoint( rBounds.TopLeft() ) );
if( mbActive )
mpSpriteCanvas->moveSprite( Sprite::ImplRef( this ),
rBounds.TopLeft(),
::vcl::unotools::pointFromB2DPoint(
rOutPos - maPosition + aPoint ),
rBounds.GetSize() );
maPosition = aPoint;
}
}
void SAL_CALL CanvasCustomSprite::transform( const geometry::AffineMatrix2D& aTransformation ) throw (lang::IllegalArgumentException,
uno::RuntimeException)
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
::basegfx::B2DHomMatrix aMatrix;
::basegfx::unotools::homMatrixFromAffineMatrix(aMatrix,
aTransformation);
if( maTransform != aMatrix )
{
// retrieve bounds before and after transformation change,
// and calc union of them, as the resulting update area.
Rectangle aPrevBounds(
getSpriteRect() );
maTransform = aMatrix;
aPrevBounds.Union( getSpriteRect() );
if( mbActive )
mpSpriteCanvas->updateSprite( Sprite::ImplRef( this ),
::vcl::unotools::pointFromB2DPoint( maPosition ),
aPrevBounds );
mbTransformDirty = true;
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
}
namespace
{
/** This method computes the up to four rectangles that make
up the set difference between two rectangles.
@param a
First rect
@param b
Second rect
@param out
Pointer to an array of at least four elements, herein, the
resulting parts of the set difference are returned.
@return
The number of rectangles written to the out array.
*/
unsigned int b2dRectComputeSetDifference( const ::basegfx::B2DRectangle& a,
const ::basegfx::B2DRectangle& b,
::basegfx::B2DRectangle* out )
{
OSL_ENSURE( out != NULL,
"b2dRectComputeSetDifference(): Invalid output array" );
// special-casing the empty rect case (this will fail most
// of the times below, because of the DBL_MIN/MAX special
// values denoting emptyness in the rectangle.
if( a.isEmpty() )
{
*out = b;
return 1;
}
if( b.isEmpty() )
{
*out = a;
return 1;
}
unsigned int num_rectangles = 0;
double ax(a.getMinX());
double ay(a.getMinY());
double aw(a.getWidth());
double ah(a.getHeight());
double bx(b.getMinX());
double by(b.getMinY());
double bw(b.getWidth());
double bh(b.getHeight());
double h0 = (by > ay) ? by - ay : 0.0;
double h3 = (by + bh < ay + ah) ? ay + ah - by - bh : 0.0;
double w1 = (bx > ax) ? bx - ax : 0.0;
double w2 = (ax + aw > bx + bw) ? ax + aw - bx - bw : 0.0;
double h12 = (h0 + h3 < ah) ? ah - h0 - h3 : 0.0;
if (h0 > 0)
out[num_rectangles++] = ::basegfx::B2DRectangle(ax,ay,ax+aw,ay+h0);
if (w1 > 0 && h12 > 0)
out[num_rectangles++] = ::basegfx::B2DRectangle(ax,ay+h0,ax+w1,ay+h0+h12);
if (w2 > 0 && h12 > 0)
out[num_rectangles++] = ::basegfx::B2DRectangle(bx+bw,ay+h0,bx+bw+w2,ay+h0+h12);
if (h3 > 0)
out[num_rectangles++] = ::basegfx::B2DRectangle(ax,ay+h0+h12,ax+aw,ay+h0+h12+h3);
return num_rectangles;
}
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
void SAL_CALL CanvasCustomSprite::clip( const uno::Reference< rendering::XPolyPolygon2D >& xClip ) throw (uno::RuntimeException)
{
tools::LocalGuard aGuard;
mxClipPoly = xClip;
if( mbActive )
{
const sal_Int32 nNumClipPolygons( mxClipPoly->getNumberOfPolygons() );
if( !mxClipPoly.is() ||
nNumClipPolygons == 0 )
{
// empty clip polygon -> everything is visible now
maCurrClipBounds.reset();
mbIsCurrClipRectangle = true;
}
else
{
// new clip is not empty - determine actual update
// area
const ::basegfx::B2DPolyPolygon& rClipPath(
tools::polyPolygonFromXPolyPolygon2D( mxClipPoly ) );
// clip which is about to be set, expressed as a
// b2drectangle
const ::basegfx::B2DRectangle& rClipBounds(
::basegfx::tools::getRange( rClipPath ) );
const ::basegfx::B2DRectangle aBounds( 0.0, 0.0,
maSize.Width(),
maSize.Height() );
// rectangular area which is actually covered by the sprite.
// coordinates are relative to the sprite origin.
::basegfx::B2DRectangle aSpriteRectPixel;
::canvas::tools::calcTransformedRectBounds( aSpriteRectPixel,
aBounds,
maTransform );
// aClipBoundsA = new clip [set intersection] sprite
::basegfx::B2DRectangle aClipBoundsA(rClipBounds);
aClipBoundsA.intersect( aSpriteRectPixel );
if( nNumClipPolygons != 1 )
{
// new clip cannot be a single rectangle -> cannot
// optimize update
mbIsCurrClipRectangle = false;
maCurrClipBounds = aClipBoundsA;
}
else
{
// new clip could be a single rectangle
const bool bNewClipIsRect(
::basegfx::tools::isRectangle( rClipPath.getB2DPolygon(0) ) );
// both new and old clip are truly rectangles
// - can now take the optimized path
const bool bUseOptimizedUpdate( bNewClipIsRect &&
mbIsCurrClipRectangle );
const ::basegfx::B2DRectangle aOldBounds( maCurrClipBounds );
// store new current clip type
maCurrClipBounds = aClipBoundsA;
mbIsCurrClipRectangle = bNewClipIsRect;
if( bUseOptimizedUpdate )
{
// aClipBoundsB = maCurrClipBounds, i.e. last clip [set intersection] sprite
::basegfx::B2DRectangle aClipDifference[4];
const unsigned int num_rectangles(
b2dRectComputeSetDifference(aClipBoundsA,
aOldBounds,
aClipDifference) );
for(unsigned int i=0; i<num_rectangles; ++i)
{
// aClipDifference[i] now contains the final
// update area, coordinates are still relative
// to the sprite origin. before submitting
// this area to 'updateSprite()' we need to
// translate this area to the final position,
// coordinates need to be relative to the
// spritecanvas.
mpSpriteCanvas->updateSprite( Sprite::ImplRef( this ),
::vcl::unotools::pointFromB2DPoint( maPosition ),
Rectangle( static_cast< sal_Int32 >( maPosition.getX() + aClipDifference[i].getMinX() ),
static_cast< sal_Int32 >( maPosition.getY() + aClipDifference[i].getMinY() ),
static_cast< sal_Int32 >( ceil( maPosition.getX() + aClipDifference[i].getMaxX() ) ),
static_cast< sal_Int32 >( ceil( maPosition.getY() + aClipDifference[i].getMaxY() ) ) ) );
}
// early exit, needed to process the four
// difference rects independently.
return;
}
}
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
mpSpriteCanvas->updateSprite( Sprite::ImplRef( this ),
::vcl::unotools::pointFromB2DPoint( maPosition ),
getSpriteRect() );
}
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
void SAL_CALL CanvasCustomSprite::setPriority( double nPriority ) throw (uno::RuntimeException)
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
// TODO(F2): Implement sprite priority
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
void SAL_CALL CanvasCustomSprite::show() throw (uno::RuntimeException)
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
if( !mpSpriteCanvas.get() )
return; // we're disposed
if( !mbActive )
{
mpSpriteCanvas->showSprite( Sprite::ImplRef( this ) );
mbActive = true;
if( mfAlpha != 0.0 )
{
mpSpriteCanvas->updateSprite( Sprite::ImplRef( this ),
::vcl::unotools::pointFromB2DPoint( maPosition ),
getSpriteRect() );
}
}
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
void SAL_CALL CanvasCustomSprite::hide() throw (uno::RuntimeException)
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
if( !mpSpriteCanvas.get() )
return; // we're disposed
if( mbActive )
{
mpSpriteCanvas->hideSprite( Sprite::ImplRef( this ) );
mbActive = false;
if( mfAlpha != 0.0 )
{
mpSpriteCanvas->updateSprite( Sprite::ImplRef( this ),
::vcl::unotools::pointFromB2DPoint( maPosition ),
getSpriteRect() );
}
}
}
uno::Reference< rendering::XCanvas > SAL_CALL CanvasCustomSprite::getContentCanvas() throw (uno::RuntimeException)
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
if( !mpSpriteCanvas.get() || !mpBackBuffer.get() )
uno::Reference< rendering::XCanvas >(); // we're disposed
if( mbActive )
{
// the client is about to render into the sprite. Thus,
// potentially the whole sprite area has changed.
mpSpriteCanvas->updateSprite( Sprite::ImplRef( this ),
::vcl::unotools::pointFromB2DPoint( maPosition ),
getSpriteRect() );
}
// clear surface
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
OutputDevice& rOutDev( mpBackBuffer->getOutDev() );
rOutDev.EnableMapMode( FALSE );
rOutDev.SetFillColor( Color( COL_WHITE ) );
rOutDev.SetLineColor();
rOutDev.DrawRect( Rectangle(Point(), maSize) );
OutputDevice& rMaskOutDev( mpBackBufferMask->getOutDev() );
rMaskOutDev.SetDrawMode( DRAWMODE_DEFAULT );
rMaskOutDev.EnableMapMode( FALSE );
rMaskOutDev.SetFillColor( Color( COL_WHITE ) );
rMaskOutDev.SetLineColor();
rMaskOutDev.DrawRect( Rectangle(Point(), maSize) );
rMaskOutDev.SetDrawMode( DRAWMODE_BLACKLINE | DRAWMODE_BLACKFILL | DRAWMODE_BLACKTEXT |
DRAWMODE_BLACKGRADIENT | DRAWMODE_BLACKBITMAP );
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// surface content has changed (we cleared it, at least)
mbSurfaceDirty = true;
// just cleared content to fully transparent
mbIsContentFullyOpaque = false;
return this;
}
#define SERVICE_NAME "com.sun.star.rendering.CanvasCustomSprite"
::rtl::OUString SAL_CALL CanvasCustomSprite::getImplementationName() throw( uno::RuntimeException )
{
return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CANVASCUSTOMSPRITE_IMPLEMENTATION_NAME ) );
}
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
void CanvasCustomSprite::redraw( OutputDevice& rTargetSurface ) const
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
redraw( rTargetSurface,
::vcl::unotools::pointFromB2DPoint( maPosition ) );
}
void CanvasCustomSprite::redraw( OutputDevice& rTargetSurface,
const Point& rOutputPos ) const
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
if( !mpSpriteCanvas.get() || !mpBackBuffer.get() )
return; // we're disposed
// log output pos in device pixel
VERBOSE_TRACE( "CanvasCustomSprite::redraw(): output pos is (%f, %f)",
maPosition.getX(),
maPosition.getY() );
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
if( mbActive &&
!::basegfx::fTools::equalZero( mfAlpha ) )
{
const Point aEmptyPoint;
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// TODO(F3): Support for alpha-VDev
// Do we have to update our bitmaps (necessary if virdev
// was painted to, or transformation changed)?
const bool bNeedBitmapUpdate( mbSurfaceDirty ||
mbTransformDirty ||
maContent->IsEmpty() );
if( bNeedBitmapUpdate )
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
{
mbSurfaceDirty = false;
mbTransformDirty = false;
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
Bitmap aBmp( mpBackBuffer->getOutDev().GetBitmap( aEmptyPoint, maSize ) );
if( mbIsContentFullyOpaque )
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
{
// optimized case: content canvas is fully opaque
// maContent = BitmapEx( aBmp.CreateDisplayBitmap( &rTargetSurface ) );
maContent = BitmapEx( aBmp );
}
else
{
Bitmap aMask( mpBackBufferMask->getOutDev().GetBitmap( aEmptyPoint, maSize ) );
if( aMask.GetBitCount() != 1 )
{
OSL_ENSURE(false,
"CanvasCustomSprite::redraw(): Mask bitmap is not monochrome (performance!)");
aMask.MakeMono(255);
}
// maContent = BitmapEx( aBmp.CreateDisplayBitmap( &rTargetSurface ),
// aMask.CreateDisplayBitmap( &rTargetSurface ) );
maContent = BitmapEx( aBmp, aMask );
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
}
}
// might get changed below (e.g. adapted for
// transformations)
::Size aOutputSize( maSize );
::Point aOutPos( rOutputPos );
// check whether matrix is "easy" to handle - pure
// translations or scales are handled by OutputDevice
// alone
if( !maTransform.isIdentity() )
{
if( !::basegfx::fTools::equalZero( maTransform.get(0,1) ) ||
!::basegfx::fTools::equalZero( maTransform.get(1,0) ) )
{
// "complex" transformation, employ affine
// transformator
::basegfx::B2DHomMatrix aTransform( maTransform );
aTransform.translate( aOutPos.X(),
aOutPos.Y() );
// modify output position, to account for the fact
// that transformBitmap() always normalizes its output
// bitmap into the smallest enclosing box.
::basegfx::B2DRectangle aDestRect;
::canvas::tools::calcTransformedRectBounds( aDestRect,
::basegfx::B2DRectangle(0,
0,
maSize.Width(),
maSize.Height()),
aTransform );
aOutPos.X() = ::basegfx::fround( aDestRect.getMinX() );
aOutPos.Y() = ::basegfx::fround( aDestRect.getMinY() );
// actually re-create the bitmap ONLY if necessary
if( bNeedBitmapUpdate )
maContent = tools::transformBitmap( *maContent,
aTransform,
uno::Sequence<double>(),
tools::MODULATE_NONE );
aOutputSize = maContent->GetSizePixel();
}
else
{
// relatively 'simplistic' transformation -
// retrieve scale and translational offset
aOutputSize.setWidth (
::basegfx::fround( maSize.getWidth() * maTransform.get(0,0) ) );
aOutputSize.setHeight(
::basegfx::fround( maSize.getHeight() * maTransform.get(1,1) ) );
aOutPos.X() = ::basegfx::fround( aOutPos.X() + maTransform.get(0,2) );
aOutPos.Y() = ::basegfx::fround( aOutPos.Y() + maTransform.get(1,2) );
}
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
}
// transformBitmap() might return empty bitmaps, for tiny
// scales.
if( !!(*maContent) )
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
{
rTargetSurface.Push( PUSH_CLIPREGION );
// apply clip (if any)
if( mxClipPoly.is() )
{
const ::basegfx::B2DPolyPolygon& rClipPoly( tools::polyPolygonFromXPolyPolygon2D( mxClipPoly ) );
if( rClipPoly.count() )
{
PolyPolygon aPolyPoly( rClipPoly );
aPolyPoly.Translate( rOutputPos );
const Region aClipRegion( Region::GetRegionFromPolyPolygon( aPolyPoly ) );
rTargetSurface.IntersectClipRegion( aClipRegion );
}
}
if( ::rtl::math::approxEqual(mfAlpha, 1.0) )
{
// no alpha modulation -> just copy to output
if( maContent->IsTransparent() )
rTargetSurface.DrawBitmapEx( aOutPos, aOutputSize, *maContent );
else
rTargetSurface.DrawBitmap( aOutPos, aOutputSize, maContent->GetBitmap() );
}
else
{
// TODO(P3): Switch to OutputDevice::DrawTransparent()
// here
// draw semi-transparent
BYTE nColor( static_cast<UINT8>( ::basegfx::fround( 255.0*(1.0 - mfAlpha) + .5) ) );
AlphaMask aAlpha( maContent->GetSizePixel(),
&nColor );
// mask out fully transparent areas
if( maContent->IsTransparent() )
aAlpha.Replace( maContent->GetMask(), 255 );
// alpha-blend to output
rTargetSurface.DrawBitmapEx( aOutPos, aOutputSize,
BitmapEx( maContent->GetBitmap(),
aAlpha ) );
}
rTargetSurface.Pop();
#if defined(VERBOSE) && defined(DBG_UTIL)
// Paint little red sprite area markers
rTargetSurface.SetLineColor( Color( 255,0,0 ) );
rTargetSurface.SetFillColor();
rTargetSurface.DrawLine( Point( aOutPos.X(),
aOutPos.Y() ),
Point( aOutPos.X()+4,
aOutPos.Y() ) );
rTargetSurface.DrawLine( Point( aOutPos.X(),
aOutPos.Y() ),
Point( aOutPos.X(),
aOutPos.Y()+4 ) );
rTargetSurface.DrawLine( Point( aOutPos.X()+aOutputSize.Width()-5,
aOutPos.Y() ),
Point( aOutPos.X()+aOutputSize.Width()-1,
aOutPos.Y() ) );
rTargetSurface.DrawLine( Point( aOutPos.X()+aOutputSize.Width()-1,
aOutPos.Y() ),
Point( aOutPos.X()+aOutputSize.Width()-1,
aOutPos.Y()+4 ) );
rTargetSurface.DrawLine( Point( aOutPos.X(),
aOutPos.Y()+aOutputSize.Height()-1 ),
Point( aOutPos.X()+4,
aOutPos.Y()+aOutputSize.Height()-1 ) );
rTargetSurface.DrawLine( Point( aOutPos.X(),
aOutPos.Y()+aOutputSize.Height()-5 ),
Point( aOutPos.X(),
aOutPos.Y()+aOutputSize.Height()-1 ) );
rTargetSurface.DrawLine( Point( aOutPos.X()+aOutputSize.Width()-5,
aOutPos.Y()+aOutputSize.Height()-1 ),
Point( aOutPos.X()+aOutputSize.Width()-1,
aOutPos.Y()+aOutputSize.Height()-1 ) );
rTargetSurface.DrawLine( Point( aOutPos.X()+aOutputSize.Width()-1,
aOutPos.Y()+aOutputSize.Height()-5 ),
Point( aOutPos.X()+aOutputSize.Width()-1,
aOutPos.Y()+aOutputSize.Height()-1 ) );
#endif
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
}
}
}
bool CanvasCustomSprite::isAreaUpdateOpaque( const Rectangle& rUpdateArea ) const
{
if( !mbIsCurrClipRectangle ||
!mbIsContentFullyOpaque ||
!::rtl::math::approxEqual(mfAlpha, 1.0) )
{
// sprite either transparent, or clip rect does not
// represent exact bounds -> update might not be fully
// opaque
return false;
}
else
{
const Rectangle& rSpriteRect( getSpriteRect() );
// make sure sprite rect covers update area fully -
// although the update area originates from the sprite,
// it's by no means guaranteed that it's limited to this
// sprite's update area - after all, other sprites might
// have been merged, or this sprite is moving.
// Note: as Rectangle::IsInside() checks for _strict_
// insidedness (i.e. all rect edges must be strictly
// inside, not equal to one of the spriteRect's edges),
// need the check for equality here.
return rSpriteRect == rUpdateArea || rSpriteRect.IsInside( rUpdateArea );
}
}
::basegfx::B2DPoint CanvasCustomSprite::getSpritePos() const
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
return maPosition;
}
::basegfx::B2DSize CanvasCustomSprite::getSpriteSize() const
{
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
tools::LocalGuard aGuard;
INTEGRATION: CWS presentationengine01 (1.2.2); FILE MERGED 2004/11/17 17:00:28 thb 1.2.2.20: #118514# Canvas module reorg 2004/10/26 23:36:58 thb 1.2.2.19: #110496# Added dedicated alpha bitmap support: factory methods at the XGraphicDevice, and optimized handling internally 2004/10/25 19:07:44 thb 1.2.2.18: #i20518# Improved canvas performance for sprite rendering 2004/10/11 00:00:05 thb 1.2.2.17: #i34997# Added new method XCanvas::drawBitmapModulated(), to facilitate global alpha channel changes when rendering bitmaps 2004/09/09 14:44:31 thb 1.2.2.16: #110496# Fixed minor map file issues; changed order of canvas instantiations in canvas factory; added sprite clipping to DirectX canvas 2004/09/06 13:33:45 thb 1.2.2.15: #110496# Improved documentation 2004/09/01 10:50:36 thb 1.2.2.14: #110496# Optimized sprite repaint (for static sprite content) 2004/08/27 18:46:16 thb 1.2.2.13: #110496# Adapted to recent canvas API changes (XSpriteCanvas::updateScreen and sprite clip semantics 2004/08/26 12:23:40 thb 1.2.2.12: #110496# Fixed a nasty update bug (hidden sprites where not cleared, when not part of other update areas by chance) 2004/08/20 00:27:10 thb 1.2.2.11: #110496# Added TODO comment 2004/08/06 14:00:09 thb 1.2.2.10: #110496# Adapted XSprite API to match reality (the way it was simply wasn't logical). Implemented sprite clipping 2004/08/02 17:50:59 thb 1.2.2.9: #110496# Adapted to recent XCanvas API changes, streamlined and factored out common code with directxcanvas 2004/07/22 20:38:27 thb 1.2.2.8: #110496# Adapted to setData/setPixel API change 2004/07/22 18:40:42 thb 1.2.2.7: #110496# Overhauled sprite redraw algo, to also respect overlapping sprites 2004/07/20 19:23:55 thb 1.2.2.6: #110496# Removed self-references to various interface implementations, along the lines, factored out common base implementation for all c++ canvases 2004/06/17 10:33:25 thb 1.2.2.5: #110496# Handle huge shrinks correctly for font scaling; added some more debug code 2004/05/27 20:51:24 thb 1.2.2.4: #110496# Added classification code to all TODO/HACK/FIXME comments. There are four categories: - code quality (C) - performance (P) - missing functionality (F) - and missing/incomplete error handling (E) Furthermore, every category has a severity number between 1 and 3 associated, where 1 is lowest and 3 highest severity 2004/05/27 14:36:52 thb 1.2.2.3: #110496# verbose tracing is now guarded also with DBG_UTIL. Unified verbose trace output between directx and VCL canvas 2004/04/12 15:12:24 thb 1.2.2.2: #110496# Adaptions after canvas01 merge 2004/04/05 15:57:57 thb 1.2.2.1: Resync with canvas01 changes
2004-11-26 16:11:13 +00:00
// TODO(Q1): Use AW's wrappers once resynced
return ::basegfx::B2DSize( maSize.Width(),
maSize.Height() );
}
bool CanvasCustomSprite::repaint( const GraphicObjectSharedPtr& rGrf,
const ::Point& rPt,
const ::Size& rSz,
const GraphicAttr& rAttr ) const
{
tools::LocalGuard aGuard;
mbSurfaceDirty = true;
return maCanvasHelper.repaint( rGrf, rPt, rSz, rAttr );
}
Rectangle CanvasCustomSprite::getSpriteRect( const ::basegfx::B2DRectangle& rBounds ) const
{
// Internal! Only call with locked object mutex!
::basegfx::B2DHomMatrix aTransform( maTransform );
aTransform.translate( maPosition.getX(),
maPosition.getY() );
// transform bounds at origin, as the sprite transformation is
// formulated that way
::basegfx::B2DRectangle aTransformedBounds;
::canvas::tools::calcTransformedRectBounds( aTransformedBounds,
rBounds,
aTransform );
// return integer rect, rounded away from the center
return Rectangle( static_cast< sal_Int32 >( aTransformedBounds.getMinX() ),
static_cast< sal_Int32 >( aTransformedBounds.getMinY() ),
static_cast< sal_Int32 >( aTransformedBounds.getMaxX() )+1,
static_cast< sal_Int32 >( aTransformedBounds.getMaxY() )+1 );
}
Rectangle CanvasCustomSprite::getSpriteRect() const
{
// Internal! Only call with locked object mutex!
// return effective sprite rect, i.e. take active clip into
// account
if( maCurrClipBounds.isEmpty() )
return getSpriteRect( ::basegfx::B2DRectangle( 0.0, 0.0,
maSize.Width(),
maSize.Height() ) );
else
// return integer rect, rounded away from the center
return Rectangle( static_cast< sal_Int32 >( maPosition.getX() + maCurrClipBounds.getMinX() ),
static_cast< sal_Int32 >( maPosition.getY() + maCurrClipBounds.getMinY() ),
static_cast< sal_Int32 >( ceil( maPosition.getX() + maCurrClipBounds.getMaxX() ) ),
static_cast< sal_Int32 >( ceil( maPosition.getY() + maCurrClipBounds.getMaxY() ) ) );
}
Rectangle CanvasCustomSprite::getFullSpriteRect() const
{
// Internal! Only call with locked object mutex!
return getSpriteRect( ::basegfx::B2DRectangle( 0.0, 0.0,
maSize.Width(),
maSize.Height() ) );
}
}