diff options
author | Armin Weiss <aw@openoffice.org> | 2007-10-16 14:46:52 +0000 |
---|---|---|
committer | Armin Weiss <aw@openoffice.org> | 2007-10-16 14:46:52 +0000 |
commit | 195ed0f878fcd93a13e20b0d172a9bb9754ccbb6 (patch) | |
tree | 1eec05424c2b937c8556efae5552f5c00cc1fb91 /drawinglayer | |
parent | a083e74aca7f332acbfec07541ee08f4716c52f8 (diff) |
#i39532# Finetuning
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/primitive2d/controlprimitive2d.cxx | 78 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/sceneprimitive2d.cxx | 11 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 25 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/vclprocessor2d.cxx | 6 | ||||
-rw-r--r-- | drawinglayer/util/makefile.mk | 5 |
5 files changed, 93 insertions, 32 deletions
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx index 0d17360f6867..7a3de007312a 100644 --- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: controlprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2007-10-15 16:11:08 $ + * last change: $Author: aw $ $Date: 2007-10-16 15:46:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -93,6 +93,10 @@ #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #endif +#ifndef INCLUDED_SVTOOLS_OPTIONSDRAWINGLAYER_HXX +#include <svtools/optionsdrawinglayer.hxx> +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -165,13 +169,17 @@ namespace drawinglayer static double fZoomScale(26.0); // do not ask for this constant factor, but it gets the zoom right aScreenZoom *= fZoomScale; - // limit to a maximum square size, e.g. 500x250 pixels (125000) + // limit to a maximum square size, e.g. 300x150 pixels (45000) + const SvtOptionsDrawinglayer aDrawinglayerOpt; + const double fDiscreteMax(aDrawinglayerOpt.GetQuadraticFormControlRenderLimit()); const double fDiscreteQuadratic(aDiscreteSize.getX() * aDiscreteSize.getY()); - static double fDiscreteMax(125000.0); + const bool bScaleUsed(fDiscreteQuadratic > fDiscreteMax); + double fFactor(1.0); - if(fDiscreteQuadratic > fDiscreteMax) + if(bScaleUsed) { - const double fFactor(sqrt(fDiscreteMax / fDiscreteQuadratic)); + // get factor and adapt to scaled size + fFactor = sqrt(fDiscreteMax / fDiscreteQuadratic); aDiscreteSize *= fFactor; aScreenZoom *= fFactor; } @@ -180,7 +188,7 @@ namespace drawinglayer const sal_Int32 nSizeX(basegfx::fround(aDiscreteSize.getX())); const sal_Int32 nSizeY(basegfx::fround(aDiscreteSize.getY())); - if(nSizeX && nSizeY) + if(nSizeX > 0 && nSizeY > 0) { // prepare VirtualDevice VirtualDevice aVirtualDevice(*Application::GetDefaultDevice()); @@ -210,8 +218,28 @@ namespace drawinglayer // get bitmap const Bitmap aContent(aVirtualDevice.GetBitmap(Point(), aSizePixel)); + // to avoid scaling, use the Bitmap pixel size as primitive size + const Size aBitmapSize(aContent.GetSizePixel()); + basegfx::B2DVector aBitmapSizeLogic( + rViewInformation.getInverseViewTransformation() * + basegfx::B2DVector(aBitmapSize.getWidth() - 1, aBitmapSize.getHeight() - 1)); + + if(bScaleUsed) + { + // if scaled adapt to scaled size + aBitmapSizeLogic /= fFactor; + } + + // short form for scale and translate transformation + basegfx::B2DHomMatrix aBitmapTransform; + + aBitmapTransform.set(0L, 0L, aBitmapSizeLogic.getX()); + aBitmapTransform.set(1L, 1L, aBitmapSizeLogic.getY()); + aBitmapTransform.set(0L, 2L, aTranslate.getX()); + aBitmapTransform.set(1L, 2L, aTranslate.getY()); + // create primitive - xRetval = new BitmapPrimitive2D(BitmapEx(aContent), getTransform()); + xRetval = new BitmapPrimitive2D(BitmapEx(aContent), aBitmapTransform); } catch( const uno::Exception& ) { @@ -295,22 +323,28 @@ namespace drawinglayer if(getTransform() == rCompare.getTransform()) { - // annotation: It is not necessary to compare mxXControl since - // it's creation completely relies on mxControlModel ad just - // is there to buffer it and/or to avoid multiple creations. - if(getControlModel().is() == rCompare.getControlModel().is()) + // check if ControlModel references both are/are not + bool bRetval(getControlModel().is() == rCompare.getControlModel().is()); + + if(bRetval && getControlModel().is()) { - if(getControlModel().is()) - { - // both exist, check for equality - return (getControlModel() == rCompare.getControlModel()); - } - else - { - // none exists -> same - return true; - } + // both exist, check for equality + bRetval = (getControlModel() == rCompare.getControlModel()); + } + + if(bRetval) + { + // check if XControl references both are/are not + bRetval = (getXControl().is() == rCompare.getXControl().is()); } + + if(bRetval && getXControl().is()) + { + // both exist, check for equality + bRetval = (getXControl() == rCompare.getXControl()); + } + + return bRetval; } } diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 0053d15c74e8..c46edd05008c 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sceneprimitive2d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2007-03-06 12:34:30 $ + * last change: $Author: aw $ $Date: 2007-10-16 15:46:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -85,6 +85,10 @@ #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #endif +#ifndef INCLUDED_SVTOOLS_OPTIONSDRAWINGLAYER_HXX +#include <svtools/optionsdrawinglayer.hxx> +#endif + ////////////////////////////////////////////////////////////////////////////// using namespace com::sun::star; @@ -143,7 +147,8 @@ namespace drawinglayer const double fViewSizeX(fLogicSizeX * (rViewInformation.getViewTransformation() * basegfx::B2DVector(aUnitVisiblePart.getWidth(), 0.0)).getLength()); const double fViewSizeY(fLogicSizeY * (rViewInformation.getViewTransformation() * basegfx::B2DVector(0.0, aUnitVisiblePart.getHeight())).getLength()); const double fViewVisibleArea(fViewSizeX * fViewSizeY); - const double fMaximumVisibleArea(1000000.0); + const SvtOptionsDrawinglayer aDrawinglayerOpt; + const double fMaximumVisibleArea(aDrawinglayerOpt.GetQuadratic3DRenderLimit()); double fReduceFactor(1.0); if(fViewVisibleArea > fMaximumVisibleArea) diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 71be0d100dfd..468ff0005689 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: vclpixelprocessor2d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2007-10-15 16:11:08 $ + * last change: $Author: aw $ $Date: 2007-10-16 15:46:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -105,6 +105,10 @@ #include <com/sun/star/awt/XWindow2.hpp> #endif +#ifndef INCLUDED_SVTOOLS_OPTIONSDRAWINGLAYER_HXX +#include <svtools/optionsdrawinglayer.hxx> +#endif + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -120,12 +124,27 @@ namespace drawinglayer // prepare output directly to pixels mpOutputDevice->Push(PUSH_MAPMODE); mpOutputDevice->SetMapMode(); + + // set AntiAliasing + const SvtOptionsDrawinglayer aDrawinglayerOpt; + + if(aDrawinglayerOpt.IsAntiAliasing()) + { + mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() & ~ANTIALIASING_DISABLE_POLYGONS); + } + else + { + mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() | ANTIALIASING_DISABLE_POLYGONS); + } } VclPixelProcessor2D::~VclPixelProcessor2D() { // restore MapMode mpOutputDevice->Pop(); + + // restore AntiAliasing + mpOutputDevice->SetAntialiasing(mpOutputDevice->GetAntialiasing() | ANTIALIASING_DISABLE_POLYGONS); } void VclPixelProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) @@ -285,6 +304,8 @@ namespace drawinglayer // process recursively and use the decomposition as Bitmap process(rCandidate.get2DDecomposition(getViewInformation2D())); } + + break; } default : { diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 039f96c115e3..c29bc052ef29 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: vclprocessor2d.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: aw $ $Date: 2007-10-15 16:11:08 $ + * last change: $Author: aw $ $Date: 2007-10-16 15:46:43 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -916,7 +916,7 @@ namespace drawinglayer xControlView->setGraphics(xGraphics); // set position and size (in pixel) - const basegfx::B2DHomMatrix aObjectToPixel(mpOutputDevice->GetViewTransformation() * rControlPrimitive2D.getTransform()); + const basegfx::B2DHomMatrix aObjectToPixel(maCurrentTransformation * rControlPrimitive2D.getTransform()); const basegfx::B2DPoint aTopLeftPixel(aObjectToPixel * basegfx::B2DPoint(0.0, 0.0)); Reference< XWindow > xControlWindow(rControlPrimitive2D.getXControl(), UNO_QUERY); diff --git a/drawinglayer/util/makefile.mk b/drawinglayer/util/makefile.mk index 3eea09cbf481..90d87767c208 100644 --- a/drawinglayer/util/makefile.mk +++ b/drawinglayer/util/makefile.mk @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.9 $ # -# last change: $Author: aw $ $Date: 2007-08-07 15:49:03 $ +# last change: $Author: aw $ $Date: 2007-10-16 15:46:52 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -63,6 +63,7 @@ SHL1STDLIBS=\ $(VCLLIB) \ $(BASEGFXLIB) \ $(TOOLSLIB) \ + $(SVLLIB) \ $(TKLIB) \ $(SVTOOLLIB) \ $(SALLIB) \ |