summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Behrens <Thorsten.Behrens@CIB.de>2017-08-21 22:44:30 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-08-22 12:28:57 +0200
commitebc11ae0b132eefd3b1b1a837a8d0ad3ba73b460 (patch)
tree599ae51a0a42b111f245697e7ad86b7f85681798
parenta3782f1152e4cf02f30003b5f96c7ba603a87db9 (diff)
emfplus: cut over to new EMF+ renderer
We're on par with the old functionality now (modulo a few smaller issues); overall QoS is much better, we get vector output on pdf and print, and the need for large offscreen bitmap rendering goes away. Change-Id: I1fa92c5cad67579c3fcfa78f1bc68696bf1623ec Reviewed-on: https://gerrit.libreoffice.org/41406 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Patrick Jaap <patrick.jaap@tu-dresden.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx34
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx54
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx92
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.hxx1
4 files changed, 1 insertions, 180 deletions
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 3c554bb8f05e..4b02e95e6a92 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1714,40 +1714,6 @@ namespace drawinglayer
break;
}
- case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
- {
- const primitive2d::MetafilePrimitive2D& aMetafile = static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate);
-
- if(!aMetafile.getMetaFile().GetUseCanvas())
- {
- // Use new Metafile decomposition.
- // TODO EMF+ stuffed into METACOMMENT support required
- process(rCandidate);
- }
- else
- {
-#ifdef DBG_UTIL
- // switch to test EMFPlus-enhanced MetafileDecomposition, don't do
- // this by default in debug mode
- static bool bTestEMFPDecomposition(false);
-
- if (bTestEMFPDecomposition)
- {
- process(rCandidate);
- }
- else
- {
- // direct draw of MetaFile
- RenderMetafilePrimitive2D(aMetafile);
- }
-#else // DBG_UTIL
- // direct draw of MetaFile, use default processing
- RenderMetafilePrimitive2D(aMetafile);
-#endif // DBG_UTIL
- }
-
- break;
- }
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
{
// mask group. Special handling for MetaFiles.
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index de9f9ee510b6..977d992871b3 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -485,59 +485,7 @@ namespace drawinglayer
mpOutputDevice->SetAntialiasing(nOldAntiAliase | AntialiasingFlags::PixelSnapHairline);
}
- const primitive2d::MetafilePrimitive2D& rMetafilePrimitive( static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate) );
-
- if( !rMetafilePrimitive.getMetaFile().GetUseCanvas() )
- {
- // use new Metafile decomposition
- process(rCandidate);
- }
- else
- {
-#ifdef DBG_UTIL
- // switch to test EMFPlus-enhanced MetafileDecomposition, don't do
- // this by default in debug mode
- static bool bTestEMFPDecomposition(false);
-
- // switch to show the new visualization color changed behind
- // the original output vor visual testing, also not by default in debug mode
- static bool bUseChangedColorObject(false);
-
- if (bTestEMFPDecomposition)
- {
- if (bUseChangedColorObject)
- {
- primitive2d::Primitive2DContainer aDecomposition;
- rMetafilePrimitive.get2DDecomposition(aDecomposition, getViewInformation2D());
- primitive2d::BasePrimitive2D* pBasePrimitive = nullptr;
- const primitive2d::Primitive2DReference aPrimitiveR(
- pBasePrimitive = new primitive2d::ModifiedColorPrimitive2D(
- aDecomposition,
- basegfx::BColorModifierSharedPtr(
- new basegfx::BColorModifier_RGBLuminanceContrast(
- 0.5, // red
- -0.5, // green
- -0.5, // blue
- 0.0, // luminance
- 0.0)))); // contrast
- processBasePrimitive2D(*pBasePrimitive);
- RenderMetafilePrimitive2D(rMetafilePrimitive);
- }
- else
- {
- process(rCandidate);
- }
- }
- else
- {
- // direct draw of MetaFile
- RenderMetafilePrimitive2D(rMetafilePrimitive);
- }
-#else // DBG_UTIL
- // direct draw of MetaFile
- RenderMetafilePrimitive2D(rMetafilePrimitive);
-#endif // DBG_UTIL
- }
+ process(rCandidate);
if(bForceLineSnap)
{
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 5af036d3cced..b699d84a1dc7 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -87,18 +87,6 @@ namespace
return nSteps;
}
-
- // get metafile (copy it)
- GDIMetaFile GetMetaFile(const drawinglayer::primitive2d::MetafilePrimitive2D& rMetaCandidate, const basegfx::BColorModifierStack& rColorModifierStack)
- {
- if (rColorModifierStack.count())
- {
- const basegfx::BColor aRGBBaseColor(0, 0, 0);
- const basegfx::BColor aRGBColor(rColorModifierStack.getModifiedColor(aRGBBaseColor));
- return rMetaCandidate.getMetaFile().GetMonochromeMtf(Color(aRGBColor));
- }
- return rMetaCandidate.getMetaFile();
- }
}
namespace drawinglayer
@@ -713,86 +701,6 @@ namespace drawinglayer
}
}
- // direct draw of MetaFile
- void VclProcessor2D::RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate)
- {
- // decompose matrix to check for shear, rotate and mirroring
- basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation * rMetaCandidate.getTransform());
- basegfx::B2DVector aScale, aTranslate;
- double fRotate, fShearX;
- aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
-
- if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
- {
- // #i102175# handle special case: If scale is negative in (x,y) (3rd quadrant), it can
- // be expressed as rotation by PI. This needs to be done for Metafiles since
- // these can be rotated, but not really mirrored
- aScale = basegfx::absolute(aScale);
- fRotate += F_PI;
- }
-
- // get BoundRect
- basegfx::B2DRange aOutlineRange(rMetaCandidate.getB2DRange(getViewInformation2D()));
- aOutlineRange.transform(maCurrentTransformation);
-
- // Due to the integer MapModes used from VCL aind inside MetaFiles errors of up to three
- // pixels in size may happen. As long as there is no better way (e.g. convert the MetaFile
- // to primitives) it is necessary to reduce maximum pixel size by 1 in X and Y and to use
- // the inner pixel bounds accordingly (ceil resp. floor). This will also be done for logic
- // units e.g. when creating a new MetaFile, but since much huger value ranges are used
- // there typically will be okay for this compromise.
- tools::Rectangle aDestRectView(
- // !!CAUTION!! Here, ceil and floor are exchanged BY PURPOSE, do NOT copy when
- // looking for a standard conversion to rectangle (!)
- (sal_Int32)ceil(aOutlineRange.getMinX()), (sal_Int32)ceil(aOutlineRange.getMinY()),
- (sal_Int32)floor(aOutlineRange.getMaxX()), (sal_Int32)floor(aOutlineRange.getMaxY()));
-
- // get metafile (copy it)
- GDIMetaFile aMetaFile(GetMetaFile(rMetaCandidate, maBColorModifierStack));
-
- // rotation
- if(!basegfx::fTools::equalZero(fRotate))
- {
- // #i103530#
- // MetaFile::Rotate has no input parameter check, so the parameter needs to be
- // well-aligned to the old range [0..3600] 10th degrees with inverse orientation
- sal_Int16 nRotation((sal_Int16)((fRotate / F_PI180) * -10.0));
-
- while(nRotation < 0)
- nRotation += 3600;
-
- while(nRotation >= 3600)
- nRotation -= 3600;
-
- aMetaFile.Rotate(nRotation);
- }
-
- // Prepare target output size
- Size aDestSize(aDestRectView.GetSize());
-
- if(aDestSize.getWidth() > 0 && aDestSize.getHeight() > 0)
- {
- // 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 contained 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
void VclProcessor2D::RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate)
{
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.hxx b/drawinglayer/source/processor2d/vclprocessor2d.hxx
index 48de1b903d5d..beb6146f1535 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.hxx
@@ -106,7 +106,6 @@ namespace drawinglayer
void RenderEpsPrimitive2D(const primitive2d::EpsPrimitive2D& rEpsPrimitive2D);
void RenderSvgLinearAtomPrimitive2D(const primitive2d::SvgLinearAtomPrimitive2D& rCandidate);
void RenderSvgRadialAtomPrimitive2D(const primitive2d::SvgRadialAtomPrimitive2D& rCandidate);
- void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate);
// DrawMode adaption support
void adaptLineToFillDrawMode() const;