From 50afe624b996edb05856bfe1be390639f458a88e Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Mon, 5 Jan 2009 13:44:12 +0000 Subject: CWS-TOOLING: integrate CWS aw059 2008-12-16 16:15:40 +0100 aw r265557 : #i95645# avoid expensive tries to stream in graphic data when stream is at end anyways 2008-12-15 16:49:58 +0100 wg r265512 : i97278 2008-12-12 16:02:15 +0100 aw r265427 : #i95645# new formulation was wrong in two places; thanks go to THB. Thanks! 2008-12-12 15:49:06 +0100 aw r265425 : #i95645# refined formulation of AA on/off constraints for VCLCanvas 2008-12-12 14:51:26 +0100 aw r265420 : #i95645# workaround for DrawTransparent of button hilighting when remote displayed; somehow GDI+ does bad dithering in that case 2008-12-12 13:23:00 +0100 aw r265414 : removed temporary build hack; it made it's way in using the rebase; with SVN the rebase is not based on pure checkouts, but uses local changes. 2008-12-11 19:35:59 +0100 aw r265352 : #i95645# need to switch off AA for WNT and UNX, the VCLCanvas is currently not able to handle AA correctly 2008-12-11 16:05:17 +0100 thb r265327 : #i95645# Changed defaults to on; as for the while svx dialog is not changed 2008-12-10 13:40:38 +0100 aw r265180 : #i95645# changed pixel snap to basegfx::fround 2008-12-10 13:25:45 +0100 aw r265177 : corrected linux warning 2008-12-10 12:28:02 +0100 aw r265167 : #i95645# added support for pixel snap/linux resp. no AA for mac (also pixel snap) when AA is switched off to the basegfx::B2DPolyPolygon painting VCL methods; needed for e.g. selection in SC and SW 2008-12-09 18:44:39 +0100 aw r265136 : #i95645# corrected filled path construction 2008-12-09 18:12:40 +0100 aw r265133 : #i95645# added support for non-AAd transparent paints 2008-12-09 18:11:58 +0100 aw r265132 : #i95645# forced selection without AA 2008-12-09 18:11:29 +0100 aw r265131 : #i88893# smoothed/corrected SW selection rects for transparent selection, forced selection without AA 2008-12-09 15:21:39 +0100 aw r265094 : #i95645# corrected FormControl full drag 2008-12-09 15:11:26 +0100 aw r265093 : #i95645# make gdiplus usages more safe when no line or fill color is selected 2008-12-09 14:30:09 +0100 aw r265085 : #i95645# added GDIPlus support 2008-12-09 13:41:06 +0100 aw r265081 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:46 +0100 aw r265080 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:40:29 +0100 aw r265079 : #i95645# added simple AA using GDIPlis to VCL 2008-12-09 13:33:16 +0100 aw r265078 : #i95645# changes to requirements, discussed with FPE 2008-12-08 14:11:39 +0100 aw r264995 : #i95646# added missing extra-wireframe for SdrDragObjOwn implementations when object has no border 2008-12-08 14:11:00 +0100 aw r264994 : #i95646# corrected RenderMarkerArrayPrimitive2D OutDev usage in VclProcessor2D 2008-12-08 12:15:10 +0100 ufi r264987 : aw059 2008-12-08 12:14:40 +0100 ufi r264986 : aw059 2008-12-05 13:16:18 +0100 aw r264905 : CWS-TOOLING: rebase CWS aw059 to trunk@264807 (milestone: DEV300:m37) 2008-12-04 11:29:48 +0100 aw r264827 : #i95645# corrected warning 2008-12-03 14:43:39 +0100 aw r264783 : #i95645# simplified overlay manager and objects to stl vector; added stuff to render some more overlay to primitive renderer to get AA support for WIN32 2008-12-03 14:42:43 +0100 aw r264782 : #i95645# added test for WIN32 for AA if cairo canvas is available 2008-12-03 14:42:13 +0100 aw r264781 : #i95645# removed unused options for writer selection overlay 2008-12-03 14:41:51 +0100 aw r264780 : #i95645# removed unused options for calc overlay 2008-12-03 14:41:21 +0100 aw r264779 : #i95645# small corrections in canvas renderer 2008-12-02 18:32:31 +0100 aw r264730 : #i95646# merged cairo version from THB's CWS cairosource01 2008-12-02 15:25:45 +0100 aw r264705 : #i95645# added helpers for the MarkerArrayPrimitive2D change which support buffered creation of the most used markers 2008-12-02 12:50:01 +0100 aw r264690 : #i95645# added a non-saved method IsAAPossibleOnThisSystem to SvtOptionsDrawinglayer to quickly test if AA can be offered on the system, added buffering of that check. 2008-12-02 12:48:51 +0100 aw r264689 : #i95645# unified MarkerArrayPrimitive2D to work bitmap-orientated, adapted usages. Added buffered preparation for needed markers. Minor adaptions for AA 2008-12-02 12:47:53 +0100 aw r264688 : #i95645# unified MarkerArrayPrimitive2D to no longer work on a enum and types of markers, but to use a BitmapEx (or any other Bitmap object) which will be displayed centerd and in discrete coordinates at positions. Adapted decomposition and all usages. Corrected minor stuff with grid primitive 2008-11-28 17:11:12 +0100 thb r264565 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:03:27 +0100 thb r264563 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 17:00:07 +0100 thb r264562 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-28 16:59:51 +0100 thb r264561 : #i95645# Added two more lists to config; to be able to differentiate canvas capabilities 2008-11-27 19:13:42 +0100 aw r264519 : #i95646# optimized getLength() a little bit 2008-11-27 19:12:50 +0100 aw r264518 : #i95646# corrected AA expansion of invalidate frame; buffered discrete distance at OM 2008-11-27 18:50:05 +0100 aw r264516 : #i95646# corrected fit to frame texts for WIN32 2008-11-27 15:32:15 +0100 aw r264496 : #i95646# helplines corrected 2008-11-27 15:32:05 +0100 aw r264495 : #i95646# helplines corrected 2008-11-27 15:01:30 +0100 aw r264492 : #i95646# enable AA support for old polygons, especially to get support for MetaFile output 2008-11-27 14:33:28 +0100 aw r264489 : #i95646# AA support for wireframe overlays 2008-11-27 13:40:54 +0100 aw r264485 : #i95646# added full repaint when AA option changes 2008-11-27 13:29:19 +0100 aw r264482 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 13:29:08 +0100 aw r264481 : #i95646# corrected handling of bSolidDragging config entries 2008-11-27 11:30:12 +0100 aw r264469 : #i95646# corrected IsAAPossibleOnThisSystem implementation 2008-11-26 16:33:04 +0100 aw r264420 : #i95646# adapted OfaViewTabPage to use disable mechanism for AA and HWAccel 2008-11-26 15:49:19 +0100 aw r264406 : #i95646# added DlgEdObj::getFullDragClone() to create specialized simple SdrUnoObj clones for solid dragging 2008-11-26 15:48:11 +0100 aw r264405 : #i95646# changed derivation of ViewObjectContactOfUnoControl to get a valid isPrimitiveVisible() implementation 2008-11-26 14:11:37 +0100 aw r264385 : #i88893# added new look for selection in sw 2008-11-26 11:32:33 +0100 aw r264360 : corrected compiler warning 2008-11-25 18:46:29 +0100 aw r264328 : #i95646# snapshot with FullDrag clones 2008-11-25 18:46:07 +0100 aw r264327 : #i95646# snapshot with FullDrag clones 2008-11-25 18:45:43 +0100 aw r264326 : #i95646# snapshot with FullDrag clones 2008-11-25 18:19:04 +0100 thb r264324 : #i96585# Added missing inline specifier 2008-11-25 13:16:25 +0100 aw r264285 : #i95646# next snapshot 2008-11-25 13:15:33 +0100 aw r264284 : #i95646# next snapshot 2008-11-25 13:15:12 +0100 aw r264283 : #i95646# next snapshot 2008-11-25 13:14:51 +0100 aw r264282 : #i95646# next snapshot 2008-11-20 13:40:49 +0100 aw r264045 : #i95646# stable snapshot 2008-11-20 13:40:29 +0100 aw r264044 : #i95646# stable snapshot 2008-11-20 13:40:06 +0100 aw r264043 : #i95646# stable snapshot 2008-11-20 13:39:45 +0100 aw r264042 : #i95646# stable snapshot 2008-11-18 11:53:39 +0100 aw r263758 : #i95646# snapshot for linux test build 2008-11-18 11:52:54 +0100 aw r263757 : #i95646# snapshot for linux test build 2008-11-18 11:52:02 +0100 aw r263756 : #i95646# snapshot for linux test build 2008-11-14 18:17:49 +0100 aw r263692 : #i95646# snapshot with most stuff working 2008-11-14 18:14:26 +0100 aw r263691 : #i95646# snapshot with most stuff working 2008-11-14 18:12:50 +0100 aw r263690 : #i95646# snapshot with most stuff working 2008-11-14 18:12:16 +0100 aw r263689 : #i95646# snapshot with most stuff working 2008-11-14 18:11:41 +0100 aw r263688 : #i95646# snapshot with most stuff working 2008-11-07 18:44:22 +0100 aw r263479 : #i95968# better support PrefMapMode; special for MAP_PIXEL was missing 2008-11-05 17:39:15 +0100 aw r263356 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 17:39:02 +0100 aw r263355 : #i95644# #i95645# #i95646# bigger change done, saving for another experiment 2008-11-05 12:28:32 +0100 aw r263350 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:27:51 +0100 aw r263349 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:58 +0100 aw r263348 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:26:17 +0100 aw r263347 : #i95644# #i95645# #i95646# in-between state before bigger change 2008-11-05 12:25:55 +0100 aw r263346 : #i95644# #i95645# #i95646# in-between state before bigger change --- basegfx/inc/basegfx/color/bcolor.hxx | 7 + basegfx/inc/basegfx/tools/rectcliptools.hxx | 2 +- basegfx/source/vector/b2dvector.cxx | 9 + canvas/source/factory/cf_service.cxx | 177 ++++++++-- canvas/source/vcl/backbuffer.cxx | 11 + canvas/source/vcl/bitmapbackbuffer.cxx | 10 + canvas/source/vcl/spritedevicehelper.cxx | 12 +- goodies/inc/pch/precompiled_goodies.hxx | 1 - svtools/inc/cacheoptions.hxx | 2 +- svtools/inc/svtools/options3d.hxx | 174 ---------- svtools/inc/svtools/optionsdrawinglayer.hxx | 7 + svtools/source/config/itemholder1.cxx | 5 - svtools/source/config/itemholderbase.hxx | 1 - svtools/source/config/makefile.mk | 1 - svtools/source/config/options3d.cxx | 459 -------------------------- svtools/source/config/optionsdrawinglayer.cxx | 101 +++++- vcl/aqua/source/gdi/salgdi.cxx | 14 +- vcl/inc/vcl/salgdi.hxx | 9 + vcl/source/gdi/impgraph.cxx | 131 ++++---- vcl/source/gdi/outdev.cxx | 6 +- vcl/source/gdi/outdev3.cxx | 5 + vcl/source/gdi/outdev6.cxx | 12 +- vcl/source/gdi/salgdilayout.cxx | 3 +- vcl/unx/source/gdi/salgdi.cxx | 13 +- vcl/unx/source/gdi/salgdi2.cxx | 1 + vcl/util/makefile.mk | 3 +- vcl/win/inc/saldata.hxx | 3 + vcl/win/inc/salgdi.h | 4 + vcl/win/source/app/salinst.cxx | 34 +- vcl/win/source/gdi/MAKEFILE.MK | 1 + vcl/win/source/gdi/salgdi.cxx | 21 +- vcl/win/source/gdi/salgdi2.cxx | 4 + vcl/win/source/gdi/salgdi_gdiplus.cxx | 195 +++++++++++ 33 files changed, 656 insertions(+), 782 deletions(-) delete mode 100644 svtools/inc/svtools/options3d.hxx delete mode 100644 svtools/source/config/options3d.cxx create mode 100644 vcl/win/source/gdi/salgdi_gdiplus.cxx diff --git a/basegfx/inc/basegfx/color/bcolor.hxx b/basegfx/inc/basegfx/color/bcolor.hxx index 0ce3321c798e..f19f7e74080f 100644 --- a/basegfx/inc/basegfx/color/bcolor.hxx +++ b/basegfx/inc/basegfx/color/bcolor.hxx @@ -208,6 +208,13 @@ namespace basegfx mfZ = basegfx::clamp(mfZ, 0.0, 1.0); } + void invert() + { + mfX = 1.0 - mfX; + mfY = 1.0 - mfY; + mfZ = 1.0 - mfZ; + } + static const BColor& getEmptyBColor() { return (const BColor&) ::basegfx::B3DTuple::getEmptyTuple(); diff --git a/basegfx/inc/basegfx/tools/rectcliptools.hxx b/basegfx/inc/basegfx/tools/rectcliptools.hxx index b4c5049b1da8..bfcd808ed19c 100644 --- a/basegfx/inc/basegfx/tools/rectcliptools.hxx +++ b/basegfx/inc/basegfx/tools/rectcliptools.hxx @@ -74,7 +74,7 @@ namespace basegfx the number of clip planes hit within the getCohenSutherlandClipFlags() method. */ - sal_uInt32 getNumberOfClipPlanes( sal_uInt32 nFlags ) + inline sal_uInt32 getNumberOfClipPlanes( sal_uInt32 nFlags ) { // classic bit count algo, see e.g. Reingold, Nievergelt, // Deo: Combinatorial Algorithms, Theory and Practice, diff --git a/basegfx/source/vector/b2dvector.cxx b/basegfx/source/vector/b2dvector.cxx index b3e4e2ae4946..311372348653 100644 --- a/basegfx/source/vector/b2dvector.cxx +++ b/basegfx/source/vector/b2dvector.cxx @@ -74,6 +74,15 @@ namespace basegfx double B2DVector::getLength() const { + if(fTools::equalZero(mfX)) + { + return fabs(mfY); + } + else if(fTools::equalZero(mfY)) + { + return fabs(mfX); + } + return hypot( mfX, mfY ); } diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index 396d9f68ce6b..e192198f2cdf 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -88,11 +88,18 @@ class CanvasFactory mutable ::osl::Mutex m_mutex; Reference m_xContext; - Reference m_xForceFlagNameAccess; + Reference m_xCanvasConfigNameAccess; AvailVector m_aAvailableImplementations; + AvailVector m_aAcceleratedImplementations; + AvailVector m_aAAImplementations; mutable CacheVector m_aCachedImplementations; mutable bool m_bCacheHasForcedLastImpl; + mutable bool m_bCacheHasUseAcceleratedEntry; + mutable bool m_bCacheHasUseAAEntry; + void checkConfigFlag( bool& r_bFlag, + bool& r_CacheFlag, + const OUString& nodeName ) const; Reference use( OUString const & serviceName, Sequence const & args, @@ -136,10 +143,14 @@ public: CanvasFactory::CanvasFactory( Reference const & xContext ) : m_mutex(), m_xContext(xContext), - m_xForceFlagNameAccess(), + m_xCanvasConfigNameAccess(), m_aAvailableImplementations(), + m_aAcceleratedImplementations(), + m_aAAImplementations(), m_aCachedImplementations(), - m_bCacheHasForcedLastImpl() + m_bCacheHasForcedLastImpl(), + m_bCacheHasUseAcceleratedEntry(), + m_bCacheHasUseAAEntry() { try { @@ -155,7 +166,7 @@ CanvasFactory::CanvasFactory( Reference const & xContext ) : makeAny( OUSTR("/org.openoffice.Office.Canvas") ), beans::PropertyState_DIRECT_VALUE ) ) ); - m_xForceFlagNameAccess.set( + m_xCanvasConfigNameAccess.set( xConfigProvider->createInstanceWithArguments( OUSTR("com.sun.star.configuration.ConfigurationAccess"), Sequence( &propValue, 1 ) ), @@ -185,9 +196,13 @@ CanvasFactory::CanvasFactory( Reference const & xContext ) : if( xEntryNameAccess.is() ) { - Sequence preferredImplementations; - if( (xEntryNameAccess->getByName( OUSTR("PreferredImplementations") ) >>= preferredImplementations) ) - m_aAvailableImplementations.push_back( std::make_pair(*pCurr,preferredImplementations) ); + Sequence implementationList; + if( (xEntryNameAccess->getByName( OUSTR("PreferredImplementations") ) >>= implementationList) ) + m_aAvailableImplementations.push_back( std::make_pair(*pCurr,implementationList) ); + if( (xEntryNameAccess->getByName( OUSTR("AcceleratedImplementations") ) >>= implementationList) ) + m_aAcceleratedImplementations.push_back( std::make_pair(*pCurr,implementationList) ); + if( (xEntryNameAccess->getByName( OUSTR("AntialiasingImplementations") ) >>= implementationList) ) + m_aAAImplementations.push_back( std::make_pair(*pCurr,implementationList) ); } ++pCurr; @@ -291,26 +306,48 @@ Reference CanvasFactory::use( } //______________________________________________________________________________ -Reference CanvasFactory::lookupAndUse( - OUString const & serviceName, Sequence const & args, - Reference const & xContext ) const +void CanvasFactory::checkConfigFlag( bool& r_bFlag, + bool& r_CacheFlag, + const OUString& nodeName ) const { - ::osl::MutexGuard guard(m_mutex); - - // forcing last entry from impl list, if config flag set - bool bForceLastEntry(false); - if( m_xForceFlagNameAccess.is() ) + if( m_xCanvasConfigNameAccess.is() ) { - m_xForceFlagNameAccess->getByName( OUSTR("ForceSafeServiceImpl") ) >>= bForceLastEntry; + m_xCanvasConfigNameAccess->getByName( nodeName ) >>= r_bFlag; - if( m_bCacheHasForcedLastImpl != bForceLastEntry ) + if( r_CacheFlag != r_bFlag ) { // cache is invalid, because of different order of // elements - m_bCacheHasForcedLastImpl = bForceLastEntry; + r_CacheFlag = r_bFlag; m_aCachedImplementations.clear(); } } +} + +//______________________________________________________________________________ +Reference CanvasFactory::lookupAndUse( + OUString const & serviceName, Sequence const & args, + Reference const & xContext ) const +{ + ::osl::MutexGuard guard(m_mutex); + + // forcing last entry from impl list, if config flag set + bool bForceLastEntry(false); + checkConfigFlag( bForceLastEntry, + m_bCacheHasForcedLastImpl, + OUSTR("ForceSafeServiceImpl") ); + + // use anti-aliasing canvas, if config flag set (or not existing) + bool bUseAAEntry(true); + checkConfigFlag( bUseAAEntry, + m_bCacheHasUseAAEntry, + OUSTR("UseAntialiasingCanvas") ); + + // use accelerated canvas, if config flag set (or not existing) + bool bUseAcceleratedEntry(true); + checkConfigFlag( bUseAcceleratedEntry, + m_bCacheHasUseAcceleratedEntry, + OUSTR("UseAcceleratedCanvas") ); // try to reuse last working implementation for given service name const CacheVector::iterator aEnd(m_aCachedImplementations.end()); @@ -330,27 +367,97 @@ Reference CanvasFactory::lookupAndUse( // lookup in available service list const AvailVector::const_iterator aAvailEnd(m_aAvailableImplementations.end()); - AvailVector::const_iterator aAvailMatch; - if( (aAvailMatch=std::find_if(m_aAvailableImplementations.begin(), - aAvailEnd, - boost::bind(&OUString::equals, - boost::cref(serviceName), - boost::bind( - std::select1st(), - _1)))) != aAvailEnd ) + AvailVector::const_iterator aAvailImplsMatch; + if( (aAvailImplsMatch=std::find_if(m_aAvailableImplementations.begin(), + aAvailEnd, + boost::bind(&OUString::equals, + boost::cref(serviceName), + boost::bind( + std::select1st(), + _1)))) == aAvailEnd ) { - const Sequence aPreferredImpls( aAvailMatch->second ); - const OUString* pCurrImpl = aPreferredImpls.getConstArray(); - const OUString* const pEndImpl = pCurrImpl + aPreferredImpls.getLength(); + return Reference(); + } - // force last entry from impl list, if config flag set - if( bForceLastEntry ) - pCurrImpl = pEndImpl-1; + const AvailVector::const_iterator aAAEnd(m_aAAImplementations.end()); + AvailVector::const_iterator aAAImplsMatch; + if( (aAAImplsMatch=std::find_if(m_aAAImplementations.begin(), + aAAEnd, + boost::bind(&OUString::equals, + boost::cref(serviceName), + boost::bind( + std::select1st(), + _1)))) == aAAEnd ) + { + return Reference(); + } + + const AvailVector::const_iterator aAccelEnd(m_aAcceleratedImplementations.end()); + AvailVector::const_iterator aAccelImplsMatch; + if( (aAccelImplsMatch=std::find_if(m_aAcceleratedImplementations.begin(), + aAccelEnd, + boost::bind(&OUString::equals, + boost::cref(serviceName), + boost::bind( + std::select1st(), + _1)))) == aAccelEnd ) + { + return Reference(); + } - while( pCurrImpl != pEndImpl ) + const Sequence aPreferredImpls( aAvailImplsMatch->second ); + const OUString* pCurrImpl = aPreferredImpls.getConstArray(); + const OUString* const pEndImpl = pCurrImpl + aPreferredImpls.getLength(); + + const Sequence aAAImpls( aAAImplsMatch->second ); + const OUString* const pFirstAAImpl = aAAImpls.getConstArray(); + const OUString* const pEndAAImpl = pFirstAAImpl + aAAImpls.getLength(); + + const Sequence aAccelImpls( aAccelImplsMatch->second ); + const OUString* const pFirstAccelImpl = aAccelImpls.getConstArray(); + const OUString* const pEndAccelImpl = pFirstAccelImpl + aAccelImpls.getLength(); + + // force last entry from impl list, if config flag set + if( bForceLastEntry ) + pCurrImpl = pEndImpl-1; + + while( pCurrImpl != pEndImpl ) + { + const OUString aCurrName(pCurrImpl->trim()); + + // check whether given canvas service is listed in the + // sequence of "accelerated canvas implementations" + const bool bIsAcceleratedImpl( + std::find_if(pFirstAccelImpl, + pEndAccelImpl, + boost::bind(&OUString::equals, + boost::cref(aCurrName), + boost::bind( + &OUString::trim, + _1))) != pEndAccelImpl ); + + // check whether given canvas service is listed in the + // sequence of "antialiasing canvas implementations" + const bool bIsAAImpl( + std::find_if(pFirstAAImpl, + pEndAAImpl, + boost::bind(&OUString::equals, + boost::cref(aCurrName), + boost::bind( + &OUString::trim, + _1))) != pEndAAImpl ); + + // try to instantiate canvas *only* if either accel and AA + // property match preference, *or*, if there's a mismatch, only + // go for a less capable canvas (that effectively let those + // pour canvas impls still work as fallbacks, should an + // accelerated/AA one fail). Property implies configuration: + // http://en.wikipedia.org/wiki/Truth_table#Logical_implication + if( (!bIsAAImpl || bUseAAEntry) && (!bIsAcceleratedImpl || bUseAcceleratedEntry) ) { Reference xCanvas( use( pCurrImpl->trim(), args, xContext ) ); + if(xCanvas.is()) { if( aMatch != aEnd ) @@ -368,9 +475,9 @@ Reference CanvasFactory::lookupAndUse( return xCanvas; } - - ++pCurrImpl; } + + ++pCurrImpl; } return Reference(); diff --git a/canvas/source/vcl/backbuffer.cxx b/canvas/source/vcl/backbuffer.cxx index 29731514af65..5e08204681d3 100644 --- a/canvas/source/vcl/backbuffer.cxx +++ b/canvas/source/vcl/backbuffer.cxx @@ -42,7 +42,18 @@ namespace vclcanvas bMonochromeBuffer ) ) { if( !bMonochromeBuffer ) + { + // #i95645# +#if defined( QUARTZ ) + // use AA on VCLCanvas for Mac maVDev->SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | maVDev->GetAntialiasing() ); +#else + // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and + // is not required to do AA. It would need to be adapted to use it correctly + // (especially gradient painting). This will need extra work. + maVDev->SetAntialiasing( maVDev->GetAntialiasing() & !ANTIALIASING_ENABLE_B2DDRAW); +#endif + } } OutputDevice& BackBuffer::getOutDev() diff --git a/canvas/source/vcl/bitmapbackbuffer.cxx b/canvas/source/vcl/bitmapbackbuffer.cxx index 2426a70bacca..a7895f1034dd 100644 --- a/canvas/source/vcl/bitmapbackbuffer.cxx +++ b/canvas/source/vcl/bitmapbackbuffer.cxx @@ -119,7 +119,17 @@ namespace vclcanvas "BitmapBackBuffer::createVDev(): Unable to create VirtualDevice" ); mpVDev->SetOutputSizePixel( maBitmap->GetSizePixel() ); + + // #i95645# +#if defined( QUARTZ ) + // use AA on VCLCanvas for Mac mpVDev->SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | mpVDev->GetAntialiasing() ); +#else + // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and + // is not required to do AA. It would need to be adapted to use it correctly + // (especially gradient painting). This will need extra work. + mpVDev->SetAntialiasing(mpVDev->GetAntialiasing() & !ANTIALIASING_ENABLE_B2DDRAW); +#endif } } diff --git a/canvas/source/vcl/spritedevicehelper.cxx b/canvas/source/vcl/spritedevicehelper.cxx index 2446053c2d21..755f1ce9cfdc 100644 --- a/canvas/source/vcl/spritedevicehelper.cxx +++ b/canvas/source/vcl/spritedevicehelper.cxx @@ -62,8 +62,16 @@ namespace vclcanvas mpBackBuffer.reset( new BackBuffer( rOutDev )); mpBackBuffer->setSize( rOutDev.GetOutputSizePixel() ); - mpBackBuffer->getOutDev().SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | - mpBackBuffer->getOutDev().GetAntialiasing() ); + // #i95645# +#if defined( QUARTZ ) + // use AA on VCLCanvas for Mac + mpBackBuffer->getOutDev().SetAntialiasing( ANTIALIASING_ENABLE_B2DDRAW | mpBackBuffer->getOutDev().GetAntialiasing() ); +#else + // switch off AA for WIN32 and UNIX, the VCLCanvas does not look good with it and + // is not required to do AA. It would need to be adapted to use it correctly + // (especially gradient painting). This will need extra work. + mpBackBuffer->getOutDev().SetAntialiasing(mpBackBuffer->getOutDev().GetAntialiasing() & !ANTIALIASING_ENABLE_B2DDRAW); +#endif } ::sal_Int32 SpriteDeviceHelper::createBuffers( ::sal_Int32 nBuffers ) diff --git a/goodies/inc/pch/precompiled_goodies.hxx b/goodies/inc/pch/precompiled_goodies.hxx index 5ac2273e1e17..b0d1ba09410b 100644 --- a/goodies/inc/pch/precompiled_goodies.hxx +++ b/goodies/inc/pch/precompiled_goodies.hxx @@ -100,7 +100,6 @@ #include "svtools/fltcall.hxx" #include "svtools/itemprop.hxx" #include "svtools/lstner.hxx" -#include "svtools/options3d.hxx" #include "svtools/solar.hrc" #include "svtools/stdctrl.hxx" #include "svtools/svarray.hxx" diff --git a/svtools/inc/cacheoptions.hxx b/svtools/inc/cacheoptions.hxx index fad248c53991..0dd1d2eaaf6d 100644 --- a/svtools/inc/cacheoptions.hxx +++ b/svtools/inc/cacheoptions.hxx @@ -171,6 +171,6 @@ class SVL_DLLPUBLIC SvtCacheOptions static SvtCacheOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! static sal_Int32 m_nRefCount ; /// internal ref count mechanism -}; // class SvtOptions3D +}; #endif // #ifndef INCLUDED_SVTOOLS_CACHEOPTIONS_HXX diff --git a/svtools/inc/svtools/options3d.hxx b/svtools/inc/svtools/options3d.hxx deleted file mode 100644 index dff3a6e2a3f0..000000000000 --- a/svtools/inc/svtools/options3d.hxx +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: options3d.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_SVTOOLS_OPTIONS3D_HXX -#define INCLUDED_SVTOOLS_OPTIONS3D_HXX - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include "svtools/svldllapi.h" -#include -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// forward declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short forward declaration to our private date container implementation - @descr We use these class as internal member to support small memory requirements. - You can create the container if it is neccessary. The class which use these mechanism - is faster and smaller then a complete implementation! -*//*-*************************************************************************************************************/ - -class SvtOptions3D_Impl; - -//_________________________________________________________________________________________________________________ -// declarations -//_________________________________________________________________________________________________________________ - -/*-************************************************************************************************************//** - @short collect informations about startup features - @descr - - - @implements - - @base - - - @devstatus ready to use -*//*-*************************************************************************************************************/ - -class SVL_DLLPUBLIC SvtOptions3D: public svt::detail::Options -{ - //------------------------------------------------------------------------------------------------------------- - // public methods - //------------------------------------------------------------------------------------------------------------- - - public: - - //--------------------------------------------------------------------------------------------------------- - // constructor / destructor - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short standard constructor and destructor - @descr This will initialize an instance with default values. - We implement these class with a refcount mechanism! Every instance of this class increase it - at create and decrease it at delete time - but all instances use the same data container! - He is implemented as a static member ... - - @seealso member m_nRefCount - @seealso member m_pDataContainer - - @param - - @return - - - @onerror - - *//*-*****************************************************************************************************/ - - SvtOptions3D(); - virtual ~SvtOptions3D(); - - //--------------------------------------------------------------------------------------------------------- - // interface - //--------------------------------------------------------------------------------------------------------- - - /*-****************************************************************************************************//** - @short interface methods to get and set value of config key "org.openoffice.Office.Common/_3D-Engine/..." - @descr These options describe internal states to enable/disable features of installed office. - - IsDithering() - SetDithering() => Activate this field for dithering of 3D objects - - IsOpenGL() - SetOpenGL() => Activate this field for using OpenGL library - - IsOpenGL_Faster() - SetOpenGL_Faster() => Activate this field for optimized OpenGL calls - - IsShowFull() - SetShowFull() => Activate this field for fully shown 3D objects while construction - - @seealso configuration package "org.openoffice.Office.Common/_3D-Engine" - *//*-*****************************************************************************************************/ - - sal_Bool IsDithering() const; - sal_Bool IsOpenGL() const; - sal_Bool IsOpenGL_Faster() const; - sal_Bool IsShowFull() const; - - void SetDithering( sal_Bool bState ); - void SetOpenGL( sal_Bool bState ); - void SetOpenGL_Faster( sal_Bool bState ); - void SetShowFull( sal_Bool bState ); - - //------------------------------------------------------------------------------------------------------------- - // private methods - //------------------------------------------------------------------------------------------------------------- - - private: - - /*-****************************************************************************************************//** - @short return a reference to a static mutex - @descr These class use his own static mutex to be threadsafe. - We create a static mutex only for one ime and use at different times. - - @seealso - - - @param - - @return A reference to a static mutex member. - - @onerror - - *//*-*****************************************************************************************************/ - SVL_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex(); - - //------------------------------------------------------------------------------------------------------------- - // private member - //------------------------------------------------------------------------------------------------------------- - - private: - - /*Attention - - Don't initialize these static member in these header! - a) Double dfined symbols will be detected ... - b) and unresolved externals exist at linking time. - Do it in your source only. - */ - - static SvtOptions3D_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements! - static sal_Int32 m_nRefCount ; /// internal ref count mechanism - -}; // class SvtOptions3D - -#endif // #ifndef INCLUDED_SVTOOLS_OPTIONS3D_HXX diff --git a/svtools/inc/svtools/optionsdrawinglayer.hxx b/svtools/inc/svtools/optionsdrawinglayer.hxx index bc88072d404b..4e97de7d6792 100644 --- a/svtools/inc/svtools/optionsdrawinglayer.hxx +++ b/svtools/inc/svtools/optionsdrawinglayer.hxx @@ -168,12 +168,19 @@ class SVL_DLLPUBLIC SvtOptionsDrawinglayer void SetMaximumPaperTopMargin(sal_uInt32 nNew); void SetMaximumPaperBottomMargin(sal_uInt32 nNew); + // #i95644# helper to check if AA is allowed on this system. Currently, for WIN its disabled + // and OutDevSupport_TransparentRect is checked (this hits XRenderExtension, e.g. + // currently for SunRay as long as not supported there) + sal_Bool IsAAPossibleOnThisSystem() const; + // primitives sal_Bool IsAntiAliasing() const; + sal_Bool IsSolidDragCreate() const; sal_uInt32 GetQuadratic3DRenderLimit() const; sal_uInt32 GetQuadraticFormControlRenderLimit() const; void SetAntiAliasing( sal_Bool bState ); + void SetSolidDragCreate( sal_Bool bState ); void SetQuadratic3DRenderLimit(sal_uInt32 nNew); void SetQuadraticFormControlRenderLimit(sal_uInt32 nNew); diff --git a/svtools/source/config/itemholder1.cxx b/svtools/source/config/itemholder1.cxx index 8ff0c908f358..37a57259c807 100644 --- a/svtools/source/config/itemholder1.cxx +++ b/svtools/source/config/itemholder1.cxx @@ -57,7 +57,6 @@ #include #include #include -#include #include #include #include @@ -253,10 +252,6 @@ void ItemHolder1::impl_newItem(TItemInfo& rItem) rItem.pItem = new SvtOptionsDialogOptions(); break; - case E_OPTIONS3D : - rItem.pItem = new SvtOptions3D(); - break; - case E_PATHOPTIONS : rItem.pItem = new SvtPathOptions(); break; diff --git a/svtools/source/config/itemholderbase.hxx b/svtools/source/config/itemholderbase.hxx index 0fe261be680a..b5c1dd5d57d0 100644 --- a/svtools/source/config/itemholderbase.hxx +++ b/svtools/source/config/itemholderbase.hxx @@ -88,7 +88,6 @@ enum EItem E_MODULEOPTIONS , // E_OPTIONSDLGOPTIONS , // - E_OPTIONS3D , // E_PATHOPTIONS , // E_PRINTOPTIONS , // 2 diff --git a/svtools/source/config/makefile.mk b/svtools/source/config/makefile.mk index d73c1625b9da..9c0985329eb3 100644 --- a/svtools/source/config/makefile.mk +++ b/svtools/source/config/makefile.mk @@ -68,7 +68,6 @@ LIB1OBJFILES= \ $(SLO)$/inetoptions.obj \ $(SLO)$/menuoptions.obj \ $(SLO)$/dynamicmenuoptions.obj \ - $(SLO)$/options3d.obj \ $(SLO)$/optionsdrawinglayer.obj \ $(SLO)$/fontoptions.obj \ $(SLO)$/addxmltostorageoptions.obj \ diff --git a/svtools/source/config/options3d.cxx b/svtools/source/config/options3d.cxx deleted file mode 100644 index 50f524f16180..000000000000 --- a/svtools/source/config/options3d.cxx +++ /dev/null @@ -1,459 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: options3d.cxx,v $ - * $Revision: 1.8 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#ifndef GCC -#endif - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#include -#include -#include -#include -#include -#include - -#include - -//_________________________________________________________________________________________________________________ -// namespaces -//_________________________________________________________________________________________________________________ - -using namespace ::utl ; -using namespace ::rtl ; -using namespace ::osl ; -using namespace ::com::sun::star::uno ; - -//_________________________________________________________________________________________________________________ -// const -//_________________________________________________________________________________________________________________ - -#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/_3D_Engine" )) -#define DEFAULT_DITHERING sal_True -#define DEFAULT_OPENGL sal_True -#define DEFAULT_OPENGL_FASTER sal_True -#define DEFAULT_OPENGL_FASTER sal_True -#define DEFAULT_SHOWFULL sal_False - -#define PROPERTYNAME_DITHERING OUString(RTL_CONSTASCII_USTRINGPARAM("Dithering" )) -#define PROPERTYNAME_OPENGL OUString(RTL_CONSTASCII_USTRINGPARAM("OpenGL" )) -#define PROPERTYNAME_OPENGL_FASTER OUString(RTL_CONSTASCII_USTRINGPARAM("OpenGL_Faster" )) -#define PROPERTYNAME_SHOWFULL OUString(RTL_CONSTASCII_USTRINGPARAM("ShowFull" )) - -#define PROPERTYHANDLE_DITHERING 0 -#define PROPERTYHANDLE_OPENGL 1 -#define PROPERTYHANDLE_OPENGL_FASTER 2 -#define PROPERTYHANDLE_SHOWFULL 3 - -#define PROPERTYCOUNT 4 - -class SvtOptions3D_Impl : public ConfigItem -{ -public: - -//--------------------------------------------------------------------------------------------------------- -// constructor / destructor -//--------------------------------------------------------------------------------------------------------- - - SvtOptions3D_Impl(); - ~SvtOptions3D_Impl(); - -//--------------------------------------------------------------------------------------------------------- -// overloaded methods of baseclass -//--------------------------------------------------------------------------------------------------------- - - virtual void Commit(); - -//--------------------------------------------------------------------------------------------------------- -// public interface -//--------------------------------------------------------------------------------------------------------- - - sal_Bool IsDithering() const; - sal_Bool IsOpenGL() const; - sal_Bool IsOpenGL_Faster() const; - sal_Bool IsShowFull() const; - - void SetDithering( sal_Bool bState ); - void SetOpenGL( sal_Bool bState ); - void SetOpenGL_Faster( sal_Bool bState ); - void SetShowFull( sal_Bool bState ); - -//------------------------------------------------------------------------------------------------------------- -// private methods -//------------------------------------------------------------------------------------------------------------- - -private: - - static Sequence< OUString > impl_GetPropertyNames(); - -//------------------------------------------------------------------------------------------------------------- -// private member -//------------------------------------------------------------------------------------------------------------- - -private: - - sal_Bool m_bDithering; - sal_Bool m_bOpenGL; - sal_Bool m_bOpenGL_Faster; - sal_Bool m_bShowFull; -}; - -//_________________________________________________________________________________________________________________ -// definitions -//_________________________________________________________________________________________________________________ - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtOptions3D_Impl::SvtOptions3D_Impl() : - ConfigItem( ROOTNODE_START ), - m_bDithering( DEFAULT_DITHERING ), - m_bOpenGL( DEFAULT_OPENGL ), - m_bOpenGL_Faster( DEFAULT_OPENGL_FASTER ), - m_bShowFull( DEFAULT_SHOWFULL ) -{ - Sequence< OUString > seqNames( impl_GetPropertyNames() ); - Sequence< Any > seqValues = GetProperties( seqNames ) ; - - DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptions3D_Impl::SvtOptions3D_Impl()\nI miss some values of configuration keys!\n" ); - - // Copy values from list in right order to ouer internal member. - sal_Int32 nPropertyCount = seqValues.getLength(); - sal_Int32 nProperty = 0; - - for( nProperty=0; nProperty>= m_bDithering; - } - break; - - case PROPERTYHANDLE_OPENGL: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptions3D_Impl::SvtOptions3D_Impl()\nWho has changed the value type of \"Office.Common\\_3D_Engine\\OpenGL\"?" ); - seqValues[nProperty] >>= m_bOpenGL; - } - break; - - case PROPERTYHANDLE_OPENGL_FASTER: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptions3D_Impl::SvtOptions3D_Impl()\nWho has changed the value type of \"Office.Common\\_3D_Engine\\OpenGL_Faster\"?" ); - seqValues[nProperty] >>= m_bOpenGL_Faster; - } - break; - - case PROPERTYHANDLE_SHOWFULL: - { - DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptions3D_Impl::SvtOptions3D_Impl()\nWho has changed the value type of \"Office.Common\\_3D_Engine\\ShowFull\"?" ); - seqValues[nProperty] >>= m_bShowFull; - } - break; - } - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtOptions3D_Impl::~SvtOptions3D_Impl() -{ - if( IsModified() ) - Commit(); -} - -//***************************************************************************************************************** -// Commit -//***************************************************************************************************************** -void SvtOptions3D_Impl::Commit() -{ - Sequence< OUString > aSeqNames( impl_GetPropertyNames() ); - Sequence< Any > aSeqValues( aSeqNames.getLength() ); - - for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty ) - { - switch( nProperty ) - { - case PROPERTYHANDLE_DITHERING: - aSeqValues[nProperty] <<= m_bDithering; - break; - - case PROPERTYHANDLE_OPENGL: - aSeqValues[nProperty] <<= m_bOpenGL; - break; - - case PROPERTYHANDLE_OPENGL_FASTER: - aSeqValues[nProperty] <<= m_bOpenGL_Faster; - break; - - case PROPERTYHANDLE_SHOWFULL: - aSeqValues[nProperty] <<= m_bShowFull; - break; - } - } - - PutProperties( aSeqNames, aSeqValues ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D_Impl::IsDithering() const -{ - return m_bDithering; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D_Impl::IsOpenGL() const -{ - return m_bOpenGL; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D_Impl::IsOpenGL_Faster() const -{ - return m_bOpenGL_Faster; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D_Impl::IsShowFull() const -{ - return m_bShowFull; -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D_Impl::SetDithering( sal_Bool bState ) -{ - m_bDithering = bState; - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D_Impl::SetOpenGL( sal_Bool bState ) -{ - m_bOpenGL = bState; - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D_Impl::SetOpenGL_Faster( sal_Bool bState ) -{ - m_bOpenGL_Faster = bState; - SetModified(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D_Impl::SetShowFull( sal_Bool bState ) -{ - m_bShowFull = bState; - SetModified(); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Sequence< OUString > SvtOptions3D_Impl::impl_GetPropertyNames() -{ - // Build static list of configuration key names. - static const OUString pProperties[] = - { - PROPERTYNAME_DITHERING , - PROPERTYNAME_OPENGL , - PROPERTYNAME_OPENGL_FASTER , - PROPERTYNAME_SHOWFULL - }; - // Initialize return sequence with these list ... - static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT ); - // ... and return it. - return seqPropertyNames; -} - -//***************************************************************************************************************** -// initialize static member -// DON'T DO IT IN YOUR HEADER! -// see definition for further informations -//***************************************************************************************************************** -SvtOptions3D_Impl* SvtOptions3D::m_pDataContainer = NULL ; -sal_Int32 SvtOptions3D::m_nRefCount = 0 ; - -//***************************************************************************************************************** -// constructor -//***************************************************************************************************************** -SvtOptions3D::SvtOptions3D() -{ - // Global access, must be guarded (multithreading!). - MutexGuard aGuard( GetOwnStaticMutex() ); - // Increase ouer refcount ... - ++m_nRefCount; - // ... and initialize ouer data container only if it not already! - if( m_pDataContainer == NULL ) - { - m_pDataContainer = new SvtOptions3D_Impl(); - ItemHolder1::holdConfigItem(E_OPTIONS3D); - } -} - -//***************************************************************************************************************** -// destructor -//***************************************************************************************************************** -SvtOptions3D::~SvtOptions3D() -{ - // Global access, must be guarded (multithreading!) - MutexGuard aGuard( GetOwnStaticMutex() ); - // Decrease ouer refcount. - --m_nRefCount; - // If last instance was deleted ... - // we must destroy ouer static data container! - if( m_nRefCount <= 0 ) - { - delete m_pDataContainer; - m_pDataContainer = NULL; - } -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D::IsDithering() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsDithering(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D::IsOpenGL() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsOpenGL(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D::IsOpenGL_Faster() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsOpenGL_Faster(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -sal_Bool SvtOptions3D::IsShowFull() const -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsShowFull(); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D::SetDithering( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetDithering( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D::SetOpenGL( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOpenGL( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D::SetOpenGL_Faster( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetOpenGL_Faster( bState ); -} - -//***************************************************************************************************************** -// public method -//***************************************************************************************************************** -void SvtOptions3D::SetShowFull( sal_Bool bState ) -{ - MutexGuard aGuard( GetOwnStaticMutex() ); - m_pDataContainer->SetShowFull( bState ); -} - -//***************************************************************************************************************** -// private method -//***************************************************************************************************************** -Mutex& SvtOptions3D::GetOwnStaticMutex() -{ - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; -} diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx index 5f12b32feaa9..c63dc2154c55 100644 --- a/svtools/source/config/optionsdrawinglayer.cxx +++ b/svtools/source/config/optionsdrawinglayer.cxx @@ -41,6 +41,8 @@ #include #include #include +#include +#include //_________________________________________________________________________________________________________________ // namespaces @@ -82,7 +84,8 @@ using namespace ::com::sun::star::uno ; #define DEFAULT_MAXIMUMPAPERBOTTOMMARGIN 9999 // primitives -#define DEFAULT_ANTIALIASING sal_False +#define DEFAULT_ANTIALIASING sal_True +#define DEFAULT_SOLIDDRAGCREATE sal_True #define DEFAULT_QUADRATIC3DRENDERLIMIT 1000000 #define DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT 45000 @@ -112,6 +115,7 @@ using namespace ::com::sun::star::uno ; // primitives #define PROPERTYNAME_ANTIALIASING OUString(RTL_CONSTASCII_USTRINGPARAM("AntiAliasing")) +#define PROPERTYNAME_SOLIDDRAGCREATE OUString(RTL_CONSTASCII_USTRINGPARAM("SolidDragCreate")) #define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("Quadratic3DRenderLimit")) #define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("QuadraticFormControlRenderLimit")) @@ -141,10 +145,11 @@ using namespace ::com::sun::star::uno ; // primitives #define PROPERTYHANDLE_ANTIALIASING 17 -#define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 18 -#define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 19 +#define PROPERTYHANDLE_SOLIDDRAGCREATE 18 +#define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 19 +#define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 20 -#define PROPERTYCOUNT 20 +#define PROPERTYCOUNT 21 class SvtOptionsDrawinglayer_Impl : public ConfigItem { @@ -214,12 +219,17 @@ public: void SetMaximumPaperTopMargin(sal_uInt32 nNew); void SetMaximumPaperBottomMargin(sal_uInt32 nNew); + // helper + sal_Bool IsAAPossibleOnThisSystem() const; + // primitives sal_Bool IsAntiAliasing() const; + sal_Bool IsSolidDragCreate() const; sal_uInt32 GetQuadratic3DRenderLimit() const; sal_uInt32 GetQuadraticFormControlRenderLimit() const; void SetAntiAliasing( sal_Bool bState ); + void SetSolidDragCreate( sal_Bool bState ); void SetQuadratic3DRenderLimit(sal_uInt32 nNew); void SetQuadraticFormControlRenderLimit(sal_uInt32 nNew); @@ -263,8 +273,13 @@ private: // primitives sal_Bool m_bAntiAliasing; + sal_Bool m_bSolidDragCreate; sal_uInt32 m_nQuadratic3DRenderLimit; sal_uInt32 m_nQuadraticFormControlRenderLimit; + + // local values + bool m_bAllowAA : 1; + bool m_bAllowAAChecked : 1; }; //_________________________________________________________________________________________________________________ @@ -302,8 +317,13 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : // primitives m_bAntiAliasing(DEFAULT_ANTIALIASING), + m_bSolidDragCreate(DEFAULT_SOLIDDRAGCREATE), m_nQuadratic3DRenderLimit(DEFAULT_QUADRATIC3DRENDERLIMIT), - m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT) + m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT), + + // local values + m_bAllowAA(true), + m_bAllowAAChecked(false) { Sequence< OUString > seqNames( impl_GetPropertyNames() ); Sequence< Any > seqValues = GetProperties( seqNames ) ; @@ -454,6 +474,13 @@ SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() : } break; + case PROPERTYHANDLE_SOLIDDRAGCREATE: + { + DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" ); + seqValues[nProperty] >>= m_bSolidDragCreate; + } + break; + case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: { DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" ); @@ -568,6 +595,10 @@ void SvtOptionsDrawinglayer_Impl::Commit() aSeqValues[nProperty] <<= m_bAntiAliasing; break; + case PROPERTYHANDLE_SOLIDDRAGCREATE: + aSeqValues[nProperty] <<= m_bSolidDragCreate; + break; + case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT: aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit; break; @@ -855,12 +886,42 @@ void SvtOptionsDrawinglayer_Impl::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) } } +// helper +sal_Bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const +{ + if(!m_bAllowAAChecked) + { + SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this); + pThat->m_bAllowAAChecked = true; + +#ifdef WIN32 + // WIN32 uses GDIPlus with VCL forthe first incarnation; this will be enhanced + // in the future to use canvases and the canvas renderer, thus a AA-abled + // canvas needs to be checked here in the future. + // Currently, just allow AA for WIN32 +#endif + + // check XRenderExtension + if(m_bAllowAA && !Application::GetDefaultDevice()->supportsOperation( OutDevSupport_TransparentRect )) + { + pThat->m_bAllowAA = false; + } + } + + return m_bAllowAA; +} + // primitives sal_Bool SvtOptionsDrawinglayer_Impl::IsAntiAliasing() const { return m_bAntiAliasing; } +sal_Bool SvtOptionsDrawinglayer_Impl::IsSolidDragCreate() const +{ + return m_bSolidDragCreate; +} + sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadratic3DRenderLimit() const { return m_nQuadratic3DRenderLimit; @@ -880,6 +941,15 @@ void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( sal_Bool bState ) } } +void SvtOptionsDrawinglayer_Impl::SetSolidDragCreate( sal_Bool bState ) +{ + if(m_bSolidDragCreate != bState) + { + m_bSolidDragCreate = bState; + SetModified(); + } +} + void SvtOptionsDrawinglayer_Impl::SetQuadratic3DRenderLimit(sal_uInt32 nNew) { if(m_nQuadratic3DRenderLimit != nNew) @@ -932,6 +1002,7 @@ Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames() // primitives PROPERTYNAME_ANTIALIASING, + PROPERTYNAME_SOLIDDRAGCREATE, PROPERTYNAME_QUADRATIC3DRENDERLIMIT, PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT }; @@ -1224,11 +1295,23 @@ void SvtOptionsDrawinglayer::SetMaximumPaperBottomMargin( sal_uInt32 nNew ) m_pDataContainer->SetMaximumPaperBottomMargin( nNew ); } +// helper +sal_Bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const +{ + return m_pDataContainer->IsAAPossibleOnThisSystem(); +} + // primitives sal_Bool SvtOptionsDrawinglayer::IsAntiAliasing() const { MutexGuard aGuard( GetOwnStaticMutex() ); - return m_pDataContainer->IsAntiAliasing(); + return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem(); +} + +sal_Bool SvtOptionsDrawinglayer::IsSolidDragCreate() const +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + return m_pDataContainer->IsSolidDragCreate(); } sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const @@ -1249,6 +1332,12 @@ void SvtOptionsDrawinglayer::SetAntiAliasing( sal_Bool bState ) m_pDataContainer->SetAntiAliasing( bState ); } +void SvtOptionsDrawinglayer::SetSolidDragCreate( sal_Bool bState ) +{ + MutexGuard aGuard( GetOwnStaticMutex() ); + m_pDataContainer->SetSolidDragCreate( bState ); +} + void SvtOptionsDrawinglayer::SetQuadratic3DRenderLimit(sal_uInt32 nNew) { MutexGuard aGuard( GetOwnStaticMutex() ); diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx index ce986cd468d3..bc7082c33d1c 100644 --- a/vcl/aqua/source/gdi/salgdi.cxx +++ b/vcl/aqua/source/gdi/salgdi.cxx @@ -462,6 +462,14 @@ static void AddPolygonToPath( CGMutablePathRef xPath, } ::basegfx::B2DPoint aPoint = rPolygon.getB2DPoint( nClosedIdx ); + + if(bPixelSnap) + { + // snap device coordinates to full pixels + aPoint.setX( basegfx::fround( aPoint.getX() ) ); + aPoint.setY( basegfx::fround( aPoint.getY() ) ); + } + if( bLineDraw ) aPoint += aHalfPointOfs; @@ -554,7 +562,7 @@ bool AquaSalGraphics::unionClipRegion( const ::basegfx::B2DPolyPolygon& rPolyPol if( !mxClipPath ) mxClipPath = CGPathCreateMutable(); - AddPolyPolygonToPath( mxClipPath, rPolyPolygon, false, false ); + AddPolyPolygonToPath( mxClipPath, rPolyPolygon, !getAntiAliasB2DDraw(), false ); return true; } @@ -906,7 +914,7 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol for( int nPolyIdx = 0; nPolyIdx < nPolyCount; ++nPolyIdx ) { const ::basegfx::B2DPolygon rPolygon = rPolyPoly.getB2DPolygon( nPolyIdx ); - AddPolygonToPath( xPath, rPolygon, true, false, IsPenVisible() ); + AddPolygonToPath( xPath, rPolygon, true, !getAntiAliasB2DDraw(), IsPenVisible() ); } CGContextSaveGState( mrContext ); CGContextBeginPath( mrContext ); @@ -952,7 +960,7 @@ bool AquaSalGraphics::drawPolyLine( const ::basegfx::B2DPolygon& rPolyLine, // setup poly-polygon path CGMutablePathRef xPath = CGPathCreateMutable(); - AddPolygonToPath( xPath, rPolyLine, rPolyLine.isClosed(), false, true ); + AddPolygonToPath( xPath, rPolyLine, rPolyLine.isClosed(), !getAntiAliasB2DDraw(), true ); CGContextSaveGState( mrContext ); CGContextAddPath( mrContext, xPath ); const CGRect aRefreshRect = CGPathGetBoundingBox( xPath ); diff --git a/vcl/inc/vcl/salgdi.hxx b/vcl/inc/vcl/salgdi.hxx index 16ff921ba003..2bbb44d67b42 100644 --- a/vcl/inc/vcl/salgdi.hxx +++ b/vcl/inc/vcl/salgdi.hxx @@ -102,7 +102,16 @@ typedef std::vector< sal_Int32 > Int32Vector; class VCL_DLLPUBLIC SalGraphics { int m_nLayout; // 0: mirroring off, 1: mirror x-axis + +protected: + // flags which hold the SetAntialiasing() value from OutputDevice + bool m_bAntiAliasB2DDraw; + public: + // get/set AA + void setAntiAliasB2DDraw(bool bNew) { m_bAntiAliasB2DDraw = bNew; } + bool getAntiAliasB2DDraw() const { return m_bAntiAliasB2DDraw; } + SalGraphics(); virtual ~SalGraphics(); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 6291c011fee1..a67d6fa7feac 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -1504,92 +1504,99 @@ SvStream& operator>>( SvStream& rIStm, ImpGraphic& rImpGraphic ) // read Id rIStm >> nTmp; - if( !rIStm.GetError() && NATIVE_FORMAT_50 == nTmp ) + // if there is no more data, avoid further expensive + // reading which will create VDevs and other stuff, just to + // read nothing. CAUTION: Eof is only true AFTER reading another + // byte, a speciality of SvMemoryStream (!) + if(!rIStm.GetError() && !rIStm.IsEof()) { - Graphic aGraphic; - GfxLink aLink; - VersionCompat* pCompat; + if( NATIVE_FORMAT_50 == nTmp ) + { + Graphic aGraphic; + GfxLink aLink; + VersionCompat* pCompat; - // read compat info - pCompat = new VersionCompat( rIStm, STREAM_READ ); - delete pCompat; + // read compat info + pCompat = new VersionCompat( rIStm, STREAM_READ ); + delete pCompat; - rIStm >> aLink; + rIStm >> aLink; - // set dummy link to avoid creation of additional link after filtering; - // we set a default link to avoid unnecessary swapping of native data - aGraphic.SetLink( GfxLink() ); + // set dummy link to avoid creation of additional link after filtering; + // we set a default link to avoid unnecessary swapping of native data + aGraphic.SetLink( GfxLink() ); - if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) ) - { - // set link only, if no other link was set - const BOOL bSetLink = ( rImpGraphic.mpGfxLink == NULL ); + if( !rIStm.GetError() && aLink.LoadNative( aGraphic ) ) + { + // set link only, if no other link was set + const BOOL bSetLink = ( rImpGraphic.mpGfxLink == NULL ); - // assign graphic - rImpGraphic = *aGraphic.ImplGetImpGraphic(); + // assign graphic + rImpGraphic = *aGraphic.ImplGetImpGraphic(); - if( aLink.IsPrefMapModeValid() ) - rImpGraphic.ImplSetPrefMapMode( aLink.GetPrefMapMode() ); + if( aLink.IsPrefMapModeValid() ) + rImpGraphic.ImplSetPrefMapMode( aLink.GetPrefMapMode() ); - if( aLink.IsPrefSizeValid() ) - rImpGraphic.ImplSetPrefSize( aLink.GetPrefSize() ); + if( aLink.IsPrefSizeValid() ) + rImpGraphic.ImplSetPrefSize( aLink.GetPrefSize() ); - if( bSetLink ) - rImpGraphic.ImplSetLink( aLink ); + if( bSetLink ) + rImpGraphic.ImplSetLink( aLink ); + } + else + { + rIStm.Seek( nStmPos1 ); + rIStm.SetError( ERRCODE_IO_WRONGFORMAT ); + } } else { - rIStm.Seek( nStmPos1 ); - rIStm.SetError( ERRCODE_IO_WRONGFORMAT ); - } - } - else - { - BitmapEx aBmpEx; - const USHORT nOldFormat = rIStm.GetNumberFormatInt(); + BitmapEx aBmpEx; + const USHORT nOldFormat = rIStm.GetNumberFormatInt(); - rIStm.SeekRel( -4 ); - rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - rIStm >> aBmpEx; + rIStm.SeekRel( -4 ); + rIStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); + rIStm >> aBmpEx; - if( !rIStm.GetError() ) - { - UINT32 nMagic1(0), nMagic2(0); - ULONG nActPos = rIStm.Tell(); + if( !rIStm.GetError() ) + { + UINT32 nMagic1(0), nMagic2(0); + ULONG nActPos = rIStm.Tell(); - rIStm >> nMagic1 >> nMagic2; - rIStm.Seek( nActPos ); + rIStm >> nMagic1 >> nMagic2; + rIStm.Seek( nActPos ); - rImpGraphic = ImpGraphic( aBmpEx ); + rImpGraphic = ImpGraphic( aBmpEx ); - if( !rIStm.GetError() && ( 0x5344414e == nMagic1 ) && ( 0x494d4931 == nMagic2 ) ) - { - delete rImpGraphic.mpAnimation; - rImpGraphic.mpAnimation = new Animation; - rIStm >> *rImpGraphic.mpAnimation; + if( !rIStm.GetError() && ( 0x5344414e == nMagic1 ) && ( 0x494d4931 == nMagic2 ) ) + { + delete rImpGraphic.mpAnimation; + rImpGraphic.mpAnimation = new Animation; + rIStm >> *rImpGraphic.mpAnimation; - // #108077# manually set loaded BmpEx to Animation - // (which skips loading its BmpEx if already done) - rImpGraphic.mpAnimation->SetBitmapEx(aBmpEx); + // #108077# manually set loaded BmpEx to Animation + // (which skips loading its BmpEx if already done) + rImpGraphic.mpAnimation->SetBitmapEx(aBmpEx); + } + else + rIStm.ResetError(); } else + { + GDIMetaFile aMtf; + + rIStm.Seek( nStmPos1 ); rIStm.ResetError(); - } - else - { - GDIMetaFile aMtf; + rIStm >> aMtf; - rIStm.Seek( nStmPos1 ); - rIStm.ResetError(); - rIStm >> aMtf; + if( !rIStm.GetError() ) + rImpGraphic = aMtf; + else + rIStm.Seek( nStmPos1 ); + } - if( !rIStm.GetError() ) - rImpGraphic = aMtf; - else - rIStm.Seek( nStmPos1 ); + rIStm.SetNumberFormatInt( nOldFormat ); } - - rIStm.SetNumberFormatInt( nOldFormat ); } } diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 9c94811e0122..2c33d069b007 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -791,6 +791,7 @@ int OutputDevice::ImplGetGraphics() const if ( mpGraphics ) { mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp), ROP_INVERT == meRasterOp ); + mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW); return TRUE; } @@ -2735,15 +2736,14 @@ void OutputDevice::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rB2DPolyPoly if( mbInitFillColor ) ImplInitFillColor(); - if(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) + if( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) != 0 + && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) ) { -#ifdef UNX // b2dpolygon support not implemented yet on non-UNX platforms const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); ::basegfx::B2DPolyPolygon aB2DPP = rB2DPolyPoly; aB2DPP.transform( aTransform ); if( mpGraphics->DrawPolyPolygon( aB2DPP, 0.0, this ) ) return; -#endif } // fallback to old polygon drawing if needed diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 4a682c4cecc9..19a9778ebb04 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -5351,6 +5351,11 @@ void OutputDevice::SetAntialiasing( USHORT nMode ) { mnAntialiasing = nMode; mbInitFont = TRUE; + + if(mpGraphics) + { + mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW); + } } if( mpAlphaVDev ) diff --git a/vcl/source/gdi/outdev6.cxx b/vcl/source/gdi/outdev6.cxx index 4e3bba322bc8..d4c24ff44e20 100644 --- a/vcl/source/gdi/outdev6.cxx +++ b/vcl/source/gdi/outdev6.cxx @@ -186,9 +186,9 @@ fprintf(stderr,"OD::DT( fT=%f, bAA=%d)\n",fTransparency,mnAntialiasing);//###### if( mbInitFillColor ) ImplInitFillColor(); - if(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) + if( (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) != 0 + && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) ) { -#ifdef UNX // b2dpolygon support not implemented yet on non-UNX platforms const ::basegfx::B2DHomMatrix aTransform = ImplGetDeviceTransformation(); ::basegfx::B2DPolyPolygon aB2DPP = rB2DPolyPoly; @@ -209,7 +209,6 @@ fprintf(stderr,"OD::DT( fT=%f, bAA=%d)\n",fTransparency,mnAntialiasing);//###### #endif return; } -#endif } // fallback to old polygon drawing if needed @@ -265,7 +264,12 @@ void OutputDevice::DrawTransparent( const PolyPolygon& rPolyPoly, // try hard to draw it directly, because the emulation layers are slower if( !pDisableNative - && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) ) + && mpGraphics->supportsOperation( OutDevSupport_B2DDraw ) +#ifdef WIN32 + // workaround bad dithering on remote displaying when using GDI+ with toolbar buttoin hilighting + && !rPolyPoly.IsRect() +#endif + ) { // prepare the graphics device if( mbInitClipRegion ) diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 339cc875256f..509ad4f725ce 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -81,7 +81,8 @@ SalFrameGeometry SalFrame::GetGeometry() // ---------------------------------------------------------------------------- SalGraphics::SalGraphics() - : m_nLayout( 0 ) +: m_nLayout( 0 ), + m_bAntiAliasB2DDraw(false) { // read global RTL settings if( Application::GetSettings().GetLayoutRTL() ) diff --git a/vcl/unx/source/gdi/salgdi.cxx b/vcl/unx/source/gdi/salgdi.cxx index bc50f464269b..dabce7c59b9e 100644 --- a/vcl/unx/source/gdi/salgdi.cxx +++ b/vcl/unx/source/gdi/salgdi.cxx @@ -1183,9 +1183,18 @@ bool X11SalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly { const int k = (nPointIdx < nPointCount) ? nPointIdx : 0; const ::basegfx::B2DPoint& aPoint = aInnerPolygon.getB2DPoint( k ); + // convert the B2DPoint into XRENDER units - aNewXPF.x = XDoubleToFixed( aPoint.getX() ); - aNewXPF.y = XDoubleToFixed( aPoint.getY() ); + if(getAntiAliasB2DDraw()) + { + aNewXPF.x = XDoubleToFixed( aPoint.getX() ); + aNewXPF.y = XDoubleToFixed( aPoint.getY() ); + } + else + { + aNewXPF.x = XDoubleToFixed( basegfx::fround( aPoint.getX() ) ); + aNewXPF.y = XDoubleToFixed( basegfx::fround( aPoint.getY() ) ); + } // check if enough data is available for a new HalfTrapezoid if( nPointIdx == 0 ) diff --git a/vcl/unx/source/gdi/salgdi2.cxx b/vcl/unx/source/gdi/salgdi2.cxx index 8086ea8e8ea5..c10abac60bb0 100644 --- a/vcl/unx/source/gdi/salgdi2.cxx +++ b/vcl/unx/source/gdi/salgdi2.cxx @@ -1158,6 +1158,7 @@ bool X11SalGraphics::supportsOperation( OutDevSupportType eType ) const switch( eType ) { case OutDevSupport_TransparentRect: + case OutDevSupport_B2DDraw: { XRenderPeer& rPeer = XRenderPeer::GetInstance(); if( rPeer.GetVersion() >= 0x02 ) diff --git a/vcl/util/makefile.mk b/vcl/util/makefile.mk index 34b0e331a9e5..98fe62caae26 100644 --- a/vcl/util/makefile.mk +++ b/vcl/util/makefile.mk @@ -229,7 +229,8 @@ SHL1STDLIBS += $(PSPLIB) SHL1STDLIBS += $(UWINAPILIB) \ $(GDI32LIB) \ - $(MSIMG32LIB) \ + $(GDIPLUSLIB) \ + $(MSIMG32LIB) \ $(WINSPOOLLIB) \ $(OLE32LIB) \ $(SHELL32LIB) \ diff --git a/vcl/win/inc/saldata.hxx b/vcl/win/inc/saldata.hxx index abd88cbbc639..d743a7b7dae1 100644 --- a/vcl/win/inc/saldata.hxx +++ b/vcl/win/inc/saldata.hxx @@ -135,6 +135,9 @@ public: TempFontItem* mpTempFontItem; BOOL mbThemeChanged; // true if visual theme was changed: throw away theme handles + // for GdiPlus GdiplusStartup/GdiplusShutdown + ULONG_PTR gdiplusToken; + std::set< HMENU > mhMenuSet; // keeps track of menu handles created by VCL, used by IsKnownMenuHandle() std::map< UINT,USHORT > maVKMap; // map some dynamic VK_* entries }; diff --git a/vcl/win/inc/salgdi.h b/vcl/win/inc/salgdi.h index b2f1158f91f5..cea6fc5dbbb3 100644 --- a/vcl/win/inc/salgdi.h +++ b/vcl/win/inc/salgdi.h @@ -167,6 +167,10 @@ public: BOOL mbScreen; // is Screen compatible bool mbXORMode; // _every_ output with RasterOp XOR + // remember RGB values for SetLineColor/SetFillColor + SalColor maLineColor; + SalColor maFillColor; + HFONT ImplDoSetFont( ImplFontSelectData* i_pFont, float& o_rFontScale, HFONT& o_rOldFont ); public: diff --git a/vcl/win/source/app/salinst.cxx b/vcl/win/source/app/salinst.cxx index b1ee05a9c2e3..d57cdd48eed2 100644 --- a/vcl/win/source/app/salinst.cxx +++ b/vcl/win/source/app/salinst.cxx @@ -56,6 +56,25 @@ #include #include // CS_DROPSHADOW +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#if defined _MSC_VER +#pragma warning(push, 1) +#endif + +#include +#include +#include + +#if defined _MSC_VER +#pragma warning(pop) +#endif + // ======================================================================= void SalAbort( const XubString& rErrorText ) @@ -418,6 +437,9 @@ SalData::SalData() mpTempFontItem = 0; mbThemeChanged = FALSE; // true if visual theme was changed: throw away theme handles + // init with NULL + gdiplusToken = 0; + initKeyCodeMap(); SetSalData( this ); @@ -433,8 +455,11 @@ SalData::~SalData() void InitSalData() { SalData* pSalData = new SalData; - (void)pSalData; CoInitialize(0); + + // init GDIPlus + static Gdiplus::GdiplusStartupInput gdiplusStartupInput; + Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, NULL); } @@ -442,6 +467,13 @@ void DeInitSalData() { CoUninitialize(); SalData* pSalData = GetSalData(); + + // deinit GDIPlus + if(pSalData) + { + Gdiplus::GdiplusShutdown(pSalData->gdiplusToken); + } + delete pSalData; } diff --git a/vcl/win/source/gdi/MAKEFILE.MK b/vcl/win/source/gdi/MAKEFILE.MK index d9cdd067edb3..d50abc1b5aa3 100644 --- a/vcl/win/source/gdi/MAKEFILE.MK +++ b/vcl/win/source/gdi/MAKEFILE.MK @@ -54,6 +54,7 @@ CFLAGS += -DWINVER=0x0400 SLOFILES= $(SLO)$/salgdi.obj \ $(SLO)$/salgdi2.obj \ $(SLO)$/salgdi3.obj \ + $(SLO)$/salgdi_gdiplus.obj \ $(SLO)$/salvd.obj \ $(SLO)$/salprn.obj \ $(SLO)$/salbmp.obj \ diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 100e338fb45d..55caa086a57a 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -1006,6 +1006,7 @@ void WinSalGraphics::SetLineColor() void WinSalGraphics::SetLineColor( SalColor nSalColor ) { + maLineColor = nSalColor; COLORREF nPenColor = PALETTERGB( SALCOLOR_RED( nSalColor ), SALCOLOR_GREEN( nSalColor ), SALCOLOR_BLUE( nSalColor ) ); @@ -1087,6 +1088,7 @@ void WinSalGraphics::SetFillColor() void WinSalGraphics::SetFillColor( SalColor nSalColor ) { + maFillColor = nSalColor; SalData* pSalData = GetSalData(); BYTE nRed = SALCOLOR_RED( nSalColor ); BYTE nGreen = SALCOLOR_GREEN( nSalColor ); @@ -1418,25 +1420,6 @@ void WinSalGraphics::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoint // ----------------------------------------------------------------------- -bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon&, double /*fTransparency*/ ) -{ - // TODO: implement and advertise OutDevSupport_B2DDraw support - return false; -} - -// ----------------------------------------------------------------------- - -bool WinSalGraphics::drawPolyLine( - const basegfx::B2DPolygon& /*rPolygon*/, - const basegfx::B2DVector& /*rLineWidths*/, - basegfx::B2DLineJoin /*eLineJoin*/) -{ - // TODO: implement - return false; -} - -// ----------------------------------------------------------------------- - #define SAL_POLY_STACKBUF 32 // ----------------------------------------------------------------------- diff --git a/vcl/win/source/gdi/salgdi2.cxx b/vcl/win/source/gdi/salgdi2.cxx index 0498a57f43fc..0a60c6971213 100644 --- a/vcl/win/source/gdi/salgdi2.cxx +++ b/vcl/win/source/gdi/salgdi2.cxx @@ -46,12 +46,16 @@ bool WinSalGraphics::supportsOperation( OutDevSupportType eType ) const { + static bool bAllowForTest(true); bool bRet = false; + switch( eType ) { case OutDevSupport_TransparentRect: bRet = mbVirDev || mbWindow; break; + case OutDevSupport_B2DDraw: + bRet = bAllowForTest; default: break; } return bRet; diff --git a/vcl/win/source/gdi/salgdi_gdiplus.cxx b/vcl/win/source/gdi/salgdi_gdiplus.cxx new file mode 100644 index 000000000000..8709fc872540 --- /dev/null +++ b/vcl/win/source/gdi/salgdi_gdiplus.cxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: salgdi.cxx,v $ + * $Revision: 1.36 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_vcl.hxx" + +#include +#include +#include +#include +#include +#include +#include + +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + +#if defined _MSC_VER +#pragma warning(push, 1) +#endif + +#include +#include +#include + +#if defined _MSC_VER +#pragma warning(pop) +#endif + +#include + +// ----------------------------------------------------------------------- + +void impAddB2DPolygonToGDIPlusGraphicsPath(Gdiplus::GraphicsPath& rPath, const basegfx::B2DPolygon& rPolygon) +{ + const sal_uInt32 nCount(rPolygon.count()); + + if(nCount) + { + const sal_uInt32 nEdgeCount(rPolygon.isClosed() ? nCount : nCount - 1); + const bool bControls(rPolygon.areControlPointsUsed()); + basegfx::B2DPoint aCurr(rPolygon.getB2DPoint(0)); + Gdiplus::PointF aFCurr(Gdiplus::REAL(aCurr.getX()), Gdiplus::REAL(aCurr.getY())); + + for(sal_uInt32 a(0); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex((a + 1) % nCount); + const basegfx::B2DPoint aNext(rPolygon.getB2DPoint(nNextIndex)); + const Gdiplus::PointF aFNext(Gdiplus::REAL(aNext.getX()), Gdiplus::REAL(aNext.getY())); + + if(bControls && (rPolygon.isNextControlPointUsed(a) || rPolygon.isPrevControlPointUsed(nNextIndex))) + { + const basegfx::B2DPoint aCa(rPolygon.getNextControlPoint(a)); + const basegfx::B2DPoint aCb(rPolygon.getPrevControlPoint(nNextIndex)); + + rPath.AddBezier( + aFCurr, + Gdiplus::PointF(Gdiplus::REAL(aCa.getX()), Gdiplus::REAL(aCa.getY())), + Gdiplus::PointF(Gdiplus::REAL(aCb.getX()), Gdiplus::REAL(aCb.getY())), + aFNext); + } + else + { + rPath.AddLine(aFCurr, aFNext); + } + + if(a + 1 < nEdgeCount) + { + aCurr = aNext; + aFCurr = aFNext; + } + } + } +} + +bool WinSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPolygon, double fTransparency) +{ + const sal_uInt32 nCount(rPolyPolygon.count()); + + if(mbBrush && nCount && (fTransparency >= 0.0 && fTransparency < 1.0)) + { + Gdiplus::Graphics aGraphics(mhDC); + const sal_uInt8 aTrans((sal_uInt8)255 - (sal_uInt8)basegfx::fround(fTransparency * 255.0)); + Gdiplus::Color aTestColor(aTrans, SALCOLOR_RED(maFillColor), SALCOLOR_GREEN(maFillColor), SALCOLOR_BLUE(maFillColor)); + Gdiplus::SolidBrush aTestBrush(aTestColor); + Gdiplus::GraphicsPath aPath; + + for(sal_uInt32 a(0); a < nCount; a++) + { + aPath.StartFigure(); + impAddB2DPolygonToGDIPlusGraphicsPath(aPath, rPolyPolygon.getB2DPolygon(a)); + aPath.CloseFigure(); + } + + if(getAntiAliasB2DDraw()) + { + aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); + } + else + { + aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone); + } + + aGraphics.FillPath(&aTestBrush, &aPath); + } + + return true; +} + +bool WinSalGraphics::drawPolyLine(const basegfx::B2DPolygon& rPolygon, const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin eLineJoin) +{ + const sal_uInt32 nCount(rPolygon.count()); + + if(mbPen && nCount) + { + Gdiplus::Graphics aGraphics(mhDC); + Gdiplus::Color aTestColor(255, SALCOLOR_RED(maLineColor), SALCOLOR_GREEN(maLineColor), SALCOLOR_BLUE(maLineColor)); + Gdiplus::Pen aTestPen(aTestColor, Gdiplus::REAL(rLineWidths.getX())); + Gdiplus::GraphicsPath aPath; + + switch(eLineJoin) + { + default : // basegfx::B2DLINEJOIN_NONE : + { + break; + } + case basegfx::B2DLINEJOIN_BEVEL : + { + aTestPen.SetLineJoin(Gdiplus::LineJoinBevel); + break; + } + case basegfx::B2DLINEJOIN_MIDDLE : + case basegfx::B2DLINEJOIN_MITER : + { + const Gdiplus::REAL aMiterLimit(15.0); + aTestPen.SetMiterLimit(aMiterLimit); + aTestPen.SetLineJoin(Gdiplus::LineJoinMiter); + break; + } + case basegfx::B2DLINEJOIN_ROUND : + { + aTestPen.SetLineJoin(Gdiplus::LineJoinRound); + break; + } + } + + impAddB2DPolygonToGDIPlusGraphicsPath(aPath, rPolygon); + + if(getAntiAliasB2DDraw()) + { + aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias); + } + else + { + aGraphics.SetSmoothingMode(Gdiplus::SmoothingModeNone); + } + + aGraphics.DrawPath(&aTestPen, &aPath); + } + + return true; +} + +// ----------------------------------------------------------------------- -- cgit v1.2.3