diff options
Diffstat (limited to 'drawinglayer')
4 files changed, 80 insertions, 28 deletions
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx index dc9bdc1d10fe..36a5f01e066e 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: vclprocessor2d.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: aw $ $Date: 2007-12-12 13:23:39 $ + * last change: $Author: aw $ $Date: 2007-12-13 16:43:01 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -100,6 +100,10 @@ namespace drawinglayer // SvtOptionsDrawinglayer incarnation to react on diverse settings const SvtOptionsDrawinglayer maDrawinglayerOpt; + // stack value (increment and decrement) to count how deep we are in + // PolygonStrokePrimitive2D's decompositions (normally only one) + sal_uInt32 mnPolygonStrokePrimitive2D; + ////////////////////////////////////////////////////////////////////////////// // common VCL rendering support diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index b257aef16e7b..03a47e2a1e58 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -4,9 +4,9 @@ * * $RCSfile: vclhelperbufferdevice.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2007-11-07 14:27:27 $ + * last change: $Author: aw $ $Date: 2007-12-13 16:43:09 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -150,7 +150,8 @@ namespace drawinglayer mpAlpha->SetOutputSizePixel(maDestPixel.GetSize(), true); mpAlpha->SetMapMode(maContent.GetMapMode()); - // do NOT copy AA flag for alpha! + // copy AA flag for new target; masking needs to be smooth + mpAlpha->SetAntialiasing(maContent.GetAntialiasing()); } return *mpAlpha; diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 8485cc647c1d..d95f690ed03d 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: vclpixelprocessor2d.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: aw $ $Date: 2007-12-12 13:23:40 $ + * last change: $Author: aw $ $Date: 2007-12-13 16:43:09 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -109,6 +109,8 @@ #include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx> #endif +#include <cstdio> + ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -230,8 +232,18 @@ namespace drawinglayer } case PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D : { - // direct draw of gradient - RenderPolyPolygonGradientPrimitive2D(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate)); + if(getOptionsDrawinglayer().IsAntiAliasing()) + { + // For AA, direct render has to be avoided since it uses XOR maskings which will not + // work with AA. Instead, the decompose which uses MaskPrimitive2D with fillings is + // used + process(rCandidate.get2DDecomposition(getViewInformation2D())); + } + else + { + // direct draw of gradient + RenderPolyPolygonGradientPrimitive2D(static_cast< const primitive2d::PolyPolygonGradientPrimitive2D& >(rCandidate)); + } break; } case PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D : @@ -264,7 +276,7 @@ namespace drawinglayer // use the faster OutputDevice::DrawTransparent method const primitive2d::UnifiedAlphaPrimitive2D& rUniAlphaCandidate = static_cast< const primitive2d::UnifiedAlphaPrimitive2D& >(rCandidate); const primitive2d::Primitive2DSequence rContent = rUniAlphaCandidate.getChildren(); - bool bCouldUseDrawTransparent(false); + bool bDrawTransparentUsed(false); // ATM need to disable this since OutputDevice::DrawTransparent uses the // old tools::Polygon classes and may not be sufficient here. HDU is evaluating... @@ -285,14 +297,12 @@ namespace drawinglayer basegfx::B2DPolyPolygon aLocalPolyPolygon(pPoPoColor->getB2DPolyPolygon()); aLocalPolyPolygon.transform(maCurrentTransformation); - const PolyPolygon aToolsPolyPolygon(aLocalPolyPolygon); - const sal_uInt16 aPercentTrans(sal_uInt16(basegfx::fround(rUniAlphaCandidate.getAlpha() * 100.0))); - mpOutputDevice->DrawTransparent(aToolsPolyPolygon, aPercentTrans); - bCouldUseDrawTransparent = true; + mpOutputDevice->DrawTransparent(aLocalPolyPolygon, rUniAlphaCandidate.getAlpha()); + bDrawTransparentUsed = true; } } - if(!bCouldUseDrawTransparent) + if(!bDrawTransparentUsed) { // use decomposition process(rCandidate.get2DDecomposition(getViewInformation2D())); @@ -377,8 +387,15 @@ namespace drawinglayer if(getOptionsDrawinglayer().IsAntiAliasing() || bSuppressFatToHairlineCorrection) { + // remeber that we enter a PolygonStrokePrimitive2D decomposition, + // used for AA thick line drawing + mnPolygonStrokePrimitive2D++; + // with AA there is no need to handle thin lines special process(rCandidate.get2DDecomposition(getViewInformation2D())); + + // leave PolygonStrokePrimitive2D + mnPolygonStrokePrimitive2D--; } else { diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 79088a6bf404..a07ac83b79f0 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: vclprocessor2d.cxx,v $ * - * $Revision: 1.23 $ + * $Revision: 1.24 $ * - * last change: $Author: aw $ $Date: 2007-12-12 13:23:40 $ + * last change: $Author: aw $ $Date: 2007-12-13 16:43:09 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -391,7 +391,7 @@ namespace drawinglayer basegfx::B2DPolygon aLocalPolygon(rPolygonCandidate.getB2DPolygon()); aLocalPolygon.transform(maCurrentTransformation); - mpOutputDevice->DrawPolyLine(aLocalPolygon,0.0); + mpOutputDevice->DrawPolyLine(aLocalPolygon, 0.0); } // direct draw of transformed BitmapEx primitive @@ -633,6 +633,20 @@ namespace drawinglayer aLocalPolyPolygon.transform(maCurrentTransformation); mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon); + if(mnPolygonStrokePrimitive2D && getOptionsDrawinglayer().IsAntiAliasing()) + { + // when AA is on and this filled polygons are the result of stroked line geometry, + // draw the geometry once extra as lines to avoid AA 'gaps' between partial polygons + mpOutputDevice->SetFillColor(); + mpOutputDevice->SetLineColor(Color(aPolygonColor)); + const sal_uInt32 nCount(aLocalPolyPolygon.count()); + + for(sal_uInt32 a(0); a < nCount; a++) + { + mpOutputDevice->DrawPolyLine(aLocalPolyPolygon.getB2DPolygon(a), 0.0); + } + } + static bool bTestPolygonClipping(false); if(bTestPolygonClipping) { @@ -661,7 +675,7 @@ namespace drawinglayer for(sal_uInt32 a(0); a < aLineClipped.count(); a++) { - mpOutputDevice->DrawPolyLine(aLineClipped.getB2DPolygon(a)); + mpOutputDevice->DrawPolyLine(aLineClipped.getB2DPolygon(a), 0.0); } } } @@ -735,13 +749,28 @@ namespace drawinglayer mpOutputDevice = pLastOutputDevice; // draw mask - VirtualDevice& rMask = aBufferDevice.getMask(); - rMask.SetLineColor(); - rMask.SetFillColor(COL_BLACK); - rMask.DrawPolyPolygon(aMask); - - // dump buffer to outdev - aBufferDevice.paint(); + if(getOptionsDrawinglayer().IsAntiAliasing()) + { + // with AA, use 8bit AlphaMask to get nice borders + VirtualDevice& rAlpha = aBufferDevice.getAlpha(); + rAlpha.SetLineColor(); + rAlpha.SetFillColor(COL_BLACK); + rAlpha.DrawPolyPolygon(aMask); + + // dump buffer to outdev + aBufferDevice.paint(); + } + else + { + // No AA, use 1bit mask + VirtualDevice& rMask = aBufferDevice.getMask(); + rMask.SetLineColor(); + rMask.SetFillColor(COL_BLACK); + rMask.DrawPolyPolygon(aMask); + + // dump buffer to outdev + aBufferDevice.paint(); + } } } } @@ -783,7 +812,7 @@ namespace drawinglayer basegfx::BColorModifierStack aLastBColorModifierStack(maBColorModifierStack); maBColorModifierStack = basegfx::BColorModifierStack(); - // paint mask to it + // paint mask to it (always with alpha intensities, evtl. with AA) process(rTransCandidate.getAlpha()); // back to old color stack @@ -1220,7 +1249,8 @@ namespace drawinglayer mpOutputDevice(&rOutDev), maBColorModifierStack(), maCurrentTransformation(), - maDrawinglayerOpt() + maDrawinglayerOpt(), + mnPolygonStrokePrimitive2D(0) { // set digit language, derived from SvtCTLOptions to have the correct // number display for arabic/hindi numerals |