summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2009-04-01 16:31:09 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2009-04-01 16:31:09 +0000
commitc48a05c77bfd377bc98e24cee8fc585b681d31a8 (patch)
treefc6655ea1b0a91dec67870b99f74704afe1b8bf7 /drawinglayer
parente91ee8ea42a057a85949f10ffaf97bc7e84c7061 (diff)
CWS-TOOLING: integrate CWS aw066_DEV300
2009-03-19 17:20:55 +0100 aw r269762 : #i99662# enhanced MetaFile paint by avoiding single pixel scalings due to MapMode errors 2009-03-19 17:20:18 +0100 aw r269761 : #i99662# enhanced 3D AA by using the SnapHorVerLinesToDiscrete options flag to unify the hor/ver hairlines
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx7
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx37
-rw-r--r--drawinglayer/source/processor3d/zbufferprocessor3d.cxx47
3 files changed, 77 insertions, 14 deletions
diff --git a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx
index 7f01f9328153..e965d22ab880 100644
--- a/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx
@@ -40,6 +40,7 @@
#include <basegfx/matrix/b3dhommatrix.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/color/bcolormodifier.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
//////////////////////////////////////////////////////////////////////////////
// predefines
@@ -94,6 +95,9 @@ namespace drawinglayer
// the current active transparence texture
texture::GeoTexSvx* mpTransparenceGeoTexSvx;
+ // SvtOptionsDrawinglayer incarnation to react on diverse settings
+ const SvtOptionsDrawinglayer maDrawinglayerOpt;
+
// bitfield
unsigned mbModulate : 1;
unsigned mbFilter : 1;
@@ -136,6 +140,9 @@ namespace drawinglayer
bool getModulate() const { return mbModulate; }
bool getFilter() const { return mbFilter; }
bool getSimpleTextureActive() const { return mbSimpleTextureActive; }
+
+ // access to Drawinglayer configuration options
+ const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
};
} // end of namespace processor3d
} // end of namespace drawinglayer
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index b8a21767b839..7904815f1eeb 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -673,16 +673,6 @@ namespace drawinglayer
(sal_Int32)ceil(aOutlineRange.getMinX()), (sal_Int32)ceil(aOutlineRange.getMinY()),
(sal_Int32)floor(aOutlineRange.getMaxX()), (sal_Int32)floor(aOutlineRange.getMaxY()));
- if(aDestRectView.Right() > aDestRectView.Left())
- {
- aDestRectView.Right()--;
- }
-
- if(aDestRectView.Bottom() > aDestRectView.Top())
- {
- aDestRectView.Bottom()--;
- }
-
// get metafile (copy it)
GDIMetaFile aMetaFile;
@@ -704,9 +694,30 @@ namespace drawinglayer
aMetaFile.Rotate((sal_uInt16)(fRotation));
}
- // paint it
- aMetaFile.WindStart();
- aMetaFile.Play(mpOutputDevice, aDestRectView.TopLeft(), aDestRectView.GetSize());
+ // Prepare target output size
+ Size aDestSize(aDestRectView.GetSize());
+
+ if(aDestSize.getWidth() && aDestSize.getHeight())
+ {
+ // Get preferred Metafile output size. When it's very equal to the output size, it's probably
+ // a rounding error somewhere, so correct it to get a 1:1 output without single pixel scalings
+ // of the Metafile (esp. for contaned Bitmaps, e.g 3D charts)
+ const Size aPrefSize(mpOutputDevice->LogicToPixel(aMetaFile.GetPrefSize(), aMetaFile.GetPrefMapMode()));
+
+ if(aPrefSize.getWidth() && (aPrefSize.getWidth() - 1 == aDestSize.getWidth() || aPrefSize.getWidth() + 1 == aDestSize.getWidth()))
+ {
+ aDestSize.setWidth(aPrefSize.getWidth());
+ }
+
+ if(aPrefSize.getHeight() && (aPrefSize.getHeight() - 1 == aDestSize.getHeight() || aPrefSize.getHeight() + 1 == aDestSize.getHeight()))
+ {
+ aDestSize.setHeight(aPrefSize.getHeight());
+ }
+
+ // paint it
+ aMetaFile.WindStart();
+ aMetaFile.Play(mpOutputDevice, aDestRectView.TopLeft(), aDestSize);
+ }
}
// mask group. Force output to VDev and create mask from given mask
diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
index 7a6eefd90a4e..24015903de4c 100644
--- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
@@ -49,6 +49,7 @@
#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
#include <drawinglayer/primitive3d/polypolygonprimitive3d.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <basegfx/polygon/b3dpolygontools.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -556,7 +557,51 @@ namespace drawinglayer
if(mpBZPixelRaster)
{
mpZBufferRasterConverter3D->setCurrentMaterial(rMaterial);
- mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize ? mnAntiAlialize : 1);
+
+ if(mnAntiAlialize > 1)
+ {
+ const bool bForceLineSnap(getOptionsDrawinglayer().IsAntiAliasing() && getOptionsDrawinglayer().IsSnapHorVerLinesToDiscrete());
+
+ if(bForceLineSnap)
+ {
+ basegfx::B3DHomMatrix aTransform;
+ basegfx::B3DPolygon aSnappedHairline(rHairline);
+ const double fScaleDown(1.0 / mnAntiAlialize);
+ const double fScaleUp(mnAntiAlialize);
+
+ // take oversampling out
+ aTransform.scale(fScaleDown, fScaleDown, 1.0);
+ aSnappedHairline.transform(aTransform);
+
+ // snap to integer
+ aSnappedHairline = basegfx::tools::snapPointsOfHorizontalOrVerticalEdges(aSnappedHairline);
+
+ // add oversampling again
+ aTransform.identity();
+ aTransform.scale(fScaleUp, fScaleUp, 1.0);
+
+ if(false)
+ {
+ // when really want to go to single pixel lines, move to center.
+ // Without this translation, all hor/ver hairlines will be centered exactly
+ // between two pixel lines (which looks best)
+ const double fTranslateToCenter(mnAntiAlialize * 0.5);
+ aTransform.translate(fTranslateToCenter, fTranslateToCenter, 0.0);
+ }
+
+ aSnappedHairline.transform(aTransform);
+
+ mpZBufferRasterConverter3D->rasterconvertB3DPolygon(aSnappedHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize);
+ }
+ else
+ {
+ mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), mnAntiAlialize);
+ }
+ }
+ else
+ {
+ mpZBufferRasterConverter3D->rasterconvertB3DPolygon(rHairline, 0, mpBZPixelRaster->getHeight(), 1);
+ }
}
}