summaryrefslogtreecommitdiff
path: root/drawinglayer/source
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source')
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx37
-rw-r--r--drawinglayer/source/processor3d/zbufferprocessor3d.cxx47
2 files changed, 70 insertions, 14 deletions
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 31e4919103..af61cefcf4 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 9b8542c5b9..36f94a6960 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);
+ }
}
}