summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-10-26 11:00:48 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-12 15:38:50 +0100
commit70e3eb2c1762fb1ca097cf671e3c7ce3d0dfd1b7 (patch)
tree80ec388e04d6fa22e19c8ba5329cab9f2068c666 /drawinglayer
parenta70233e991619e134fde2c5ff6037960d07a06ae (diff)
Resolves: #i121267# added support for taking clipping into account...
for metafile-based exporters to vector formats (cherry picked from commit 229a79b97110c11ef21b7b99ffc768254ca01d96) Conflicts: basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx filter/source/flash/swfexporter.cxx filter/source/graphicfilter/eos2met/eos2met.cxx svtools/source/filter/wmf/wmf.cxx vcl/Package_inc.mk Remove unused variable to prevent compile warnings. (cherry picked from commit 60d19c1602e4fec740624fd20a7bfd39707297e4) Change-Id: Iaeb02d7321bea2890cf4e969f1d45d58deef5584 106285f06a21f4f39f34c6755d12ac6cd4196a7f
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx76
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx36
2 files changed, 83 insertions, 29 deletions
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index cf3c79b92638..3511e5714678 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1177,14 +1177,29 @@ namespace drawinglayer
// direct draw of hairline; use default processing
// support SvtGraphicStroke MetaCommentAction
const basegfx::BColor aLineColor(maBColorModifierStack.getModifiedColor(rHairlinePrimitive.getBColor()));
- SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(
- rHairlinePrimitive.getB2DPolygon(),
- &aLineColor,
- 0, 0, 0, 0);
+ SvtGraphicStroke* pSvtGraphicStroke = 0;
+
+ // #i121267# Not needed, does not give better quality compared with
+ // the META_POLYPOLYGON_ACTION written by RenderPolygonHairlinePrimitive2D
+ // below
+ bool bSupportSvtGraphicStroke(false);
+
+ if(bSupportSvtGraphicStroke)
+ {
+ pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(
+ rHairlinePrimitive.getB2DPolygon(),
+ &aLineColor,
+ 0, 0, 0, 0);
+
+ impStartSvtGraphicStroke(pSvtGraphicStroke);
+ }
- impStartSvtGraphicStroke(pSvtGraphicStroke);
RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate), false);
- impEndSvtGraphicStroke(pSvtGraphicStroke);
+
+ if(bSupportSvtGraphicStroke)
+ {
+ impEndSvtGraphicStroke(pSvtGraphicStroke);
+ }
}
break;
}
@@ -1653,7 +1668,12 @@ namespace drawinglayer
// XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support
SvtGraphicFill* pSvtGraphicFill = 0;
- if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count())
+ // #i121267# Not needed, does not give better quality compared with
+ // the META_POLYPOLYGON_ACTION written by the DrawPolyPolygon command
+ // below
+ bool bSupportSvtGraphicFill(false);
+
+ if(bSupportSvtGraphicFill && !mnSvtGraphicFillCount && aLocalPolyPolygon.count())
{
// setup simple color fill stuff like in impgrfll
pSvtGraphicFill = new SvtGraphicFill(
@@ -1678,9 +1698,17 @@ namespace drawinglayer
mpOutputDevice->SetLineColor();
// call VCL directly; encapsulate with SvtGraphicFill
- impStartSvtGraphicFill(pSvtGraphicFill);
+ if(bSupportSvtGraphicFill)
+ {
+ impStartSvtGraphicFill(pSvtGraphicFill);
+ }
+
mpOutputDevice->DrawPolyPolygon(aLocalPolyPolygon);
- impEndSvtGraphicFill(pSvtGraphicFill);
+
+ if(bSupportSvtGraphicFill)
+ {
+ impEndSvtGraphicFill(pSvtGraphicFill);
+ }
break;
}
@@ -1739,16 +1767,13 @@ namespace drawinglayer
// Removed subdivision and fixed in Region::ImplPolyPolyRegionToBandRegionFunc() in VCL where
// the ClipRegion is built from the Polygon. A AdaptiveSubdivide on the source polygon was missing there
mpOutputDevice->Push(PUSH_CLIPREGION);
- //mpOutputDevice->SetClipRegion(Region(PolyPolygon(basegfx::tools::adaptiveSubdivideByAngle(maClipPolyPolygon))));
- //mpOutputDevice->SetClipRegion(Region(PolyPolygon(maClipPolyPolygon)));
mpOutputDevice->SetClipRegion(Region(maClipPolyPolygon));
- }
- // recursively paint content
- process(rMaskCandidate.getChildren());
+ // recursively paint content
+ // #i121267# Only need to process sub-content when clip polygon is *not* empty.
+ // If it is empty, the clip is empty and there can be nothing inside.
+ process(rMaskCandidate.getChildren());
- if(maClipPolyPolygon.count())
- {
// restore VCL clip region
mpOutputDevice->Pop();
}
@@ -1820,7 +1845,12 @@ namespace drawinglayer
// XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END support
SvtGraphicFill* pSvtGraphicFill = 0;
- if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count())
+ // #i121267# Not needed, does not give better quality compared with
+ // the META_POLYPOLYGON_ACTION written by the DrawPolyPolygon command
+ // below
+ bool bSupportSvtGraphicFill(false);
+
+ if(bSupportSvtGraphicFill && !mnSvtGraphicFillCount && aLocalPolyPolygon.count())
{
// setup simple color with transparence fill stuff like in impgrfll
pSvtGraphicFill = new SvtGraphicFill(
@@ -1846,11 +1876,19 @@ namespace drawinglayer
mpOutputDevice->SetLineColor();
// call VCL directly; encapsulate with SvtGraphicFill
- impStartSvtGraphicFill(pSvtGraphicFill);
+ if(bSupportSvtGraphicFill)
+ {
+ impStartSvtGraphicFill(pSvtGraphicFill);
+ }
+
mpOutputDevice->DrawTransparent(
PolyPolygon(aLocalPolyPolygon),
nTransPercentVcl);
- impEndSvtGraphicFill(pSvtGraphicFill);
+
+ if(bSupportSvtGraphicFill)
+ {
+ impEndSvtGraphicFill(pSvtGraphicFill);
+ }
}
else
{
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index d129251dbfc1..9741bc8e6b6d 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -538,14 +538,16 @@ namespace drawinglayer
// nBWidth, nBHeight is the pixel size of the neede bitmap. To not need to scale it
// in vcl many times, create a size-optimized version
const Size aNeededBitmapSizePixel(nBWidth, nBHeight);
- BitmapEx aBitmapEx(rFillGraphicAttribute.getGraphic().GetBitmapEx(
- GraphicConversionParameters(
- aNeededBitmapSizePixel, // get the correct size immediately
- false, // no unlimited size
- false, // Use AntiAliasing
- false, //SnapHorVerLines
- true // ScaleHighQuality
- )));
+ BitmapEx aBitmapEx(rFillGraphicAttribute.getGraphic().GetBitmapEx());
+ static bool bEnablePreScaling(true);
+ const bool bPreScaled(bEnablePreScaling && nBWidth * nBHeight < (250 * 250));
+
+ if(bPreScaled)
+ {
+ // ... but only up to a maximum size, else it gets too expensive
+ aBitmapEx.Scale(aNeededBitmapSizePixel, BMP_SCALE_INTERPOLATE);
+ }
+
bool bPainted(false);
if(maBColorModifierStack.count())
@@ -632,7 +634,14 @@ namespace drawinglayer
if(aOutRectPixel.IsOver(aVisiblePixel))
{
- mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aBitmapEx);
+ if(bPreScaled)
+ {
+ mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aBitmapEx);
+ }
+ else
+ {
+ mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aNeededBitmapSizePixel, aBitmapEx);
+ }
}
}
}
@@ -652,7 +661,14 @@ namespace drawinglayer
if(aOutRectPixel.IsOver(aVisiblePixel))
{
- mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aBitmapEx);
+ if(bPreScaled)
+ {
+ mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aBitmapEx);
+ }
+ else
+ {
+ mpOutputDevice->DrawBitmapEx(aOutRectPixel.TopLeft(), aNeededBitmapSizePixel, aBitmapEx);
+ }
}
}
}