summaryrefslogtreecommitdiff
path: root/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx')
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx126
1 files changed, 70 insertions, 56 deletions
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 1ccfc5f9aa6c..b78ac5b1e8df 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1,30 +1,21 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
+/*
+ * This file is part of the LibreOffice project.
*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
- * Copyright 2000, 2010 Oracle and/or its affiliates.
+ * This file incorporates work covered by the following license notice:
*
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
#include <drawinglayer/processor2d/vclmetafileprocessor2d.hxx>
#include <tools/gen.hxx>
@@ -36,7 +27,6 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
-#include <drawinglayer/primitive2d/rendergraphicprimitive2d.hxx>
#include <drawinglayer/primitive2d/metafileprimitive2d.hxx>
#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygonclipper.hxx>
@@ -63,7 +53,6 @@
#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
-#include <helperchartrenderer.hxx>
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
#include <basegfx/polygon/b2dlinegeometry.hxx>
@@ -80,11 +69,6 @@
#include <com/sun/star/beans/XPropertySet.hpp>
//////////////////////////////////////////////////////////////////////////////
-// for current chart PrettyPrinting support
-
-#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
// for StructureTagPrimitive support in sd's unomodel.cxx
#include <drawinglayer/primitive2d/structuretagprimitive2d.hxx>
@@ -450,6 +434,7 @@ namespace drawinglayer
}
SvtGraphicStroke::JoinType eJoin(SvtGraphicStroke::joinNone);
+ SvtGraphicStroke::CapType eCap(SvtGraphicStroke::capButt);
double fLineWidth(0.0);
double fMiterLength(0.0);
SvtGraphicStroke::DashArray aDashArray;
@@ -489,6 +474,26 @@ namespace drawinglayer
break;
}
}
+
+ // get stroke
+ switch(pLineAttribute->getLineCap())
+ {
+ default: /* com::sun::star::drawing::LineCap_BUTT */
+ {
+ eCap = SvtGraphicStroke::capButt;
+ break;
+ }
+ case com::sun::star::drawing::LineCap_ROUND:
+ {
+ eCap = SvtGraphicStroke::capRound;
+ break;
+ }
+ case com::sun::star::drawing::LineCap_SQUARE:
+ {
+ eCap = SvtGraphicStroke::capSquare;
+ break;
+ }
+ }
}
if(pStrokeAttribute)
@@ -516,7 +521,7 @@ namespace drawinglayer
PolyPolygon(aEndArrow),
mfCurrentUnifiedTransparence,
fLineWidth,
- SvtGraphicStroke::capButt,
+ eCap,
eJoin,
fMiterLength,
aDashArray);
@@ -1234,6 +1239,7 @@ namespace drawinglayer
LineInfo aLineInfo(LINE_SOLID, basegfx::fround(fDiscreteLineWidth));
aLineInfo.SetLineJoin(rLine.getLineJoin());
+ aLineInfo.SetLineCap(rLine.getLineCap());
for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++)
{
@@ -1308,12 +1314,6 @@ namespace drawinglayer
RenderBitmapPrimitive2D(static_cast< const primitive2d::BitmapPrimitive2D& >(rCandidate));
break;
}
- case PRIMITIVE2D_ID_RENDERGRAPHICPRIMITIVE2D :
- {
- // direct draw of transformed RenderGraphic primitive; use default processing
- RenderRenderGraphicPrimitive2D(static_cast< const primitive2d::RenderGraphicPrimitive2D& >(rCandidate));
- break;
- }
case PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D :
{
// need to handle PolyPolygonBitmapPrimitive2D here to support XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END
@@ -1630,8 +1630,19 @@ namespace drawinglayer
}
case PRIMITIVE2D_ID_METAFILEPRIMITIVE2D :
{
- // direct draw of MetaFile, use default pocessing
- RenderMetafilePrimitive2D(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate));
+ static bool bUseMetaFilePrimitiveDecomposition(true);
+
+ if(bUseMetaFilePrimitiveDecomposition)
+ {
+ // use new Metafile decomposition
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ }
+ else
+ {
+ // direct draw of MetaFile, use default pocessing
+ RenderMetafilePrimitive2D(static_cast< const primitive2d::MetafilePrimitive2D& >(rCandidate));
+ }
+
break;
}
case PRIMITIVE2D_ID_MASKPRIMITIVE2D :
@@ -1672,7 +1683,8 @@ namespace drawinglayer
// 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(PolyPolygon(maClipPolyPolygon)));
+ mpOutputDevice->SetClipRegion(Region(maClipPolyPolygon));
}
// recursively paint content
@@ -1889,9 +1901,20 @@ namespace drawinglayer
(sal_Int32)floor(aViewRange.getMinX()), (sal_Int32)floor(aViewRange.getMinY()),
(sal_Int32)ceil(aViewRange.getMaxX()), (sal_Int32)ceil(aViewRange.getMaxY()));
const Rectangle aRectPixel(mpOutputDevice->LogicToPixel(aRectLogic));
- const Size aSizePixel(aRectPixel.GetSize());
+ Size aSizePixel(aRectPixel.GetSize());
const Point aEmptyPoint;
VirtualDevice aBufferDevice;
+ const sal_uInt32 nMaxQuadratPixels(500000);
+ const sal_uInt32 nViewVisibleArea(aSizePixel.getWidth() * aSizePixel.getHeight());
+ double fReduceFactor(1.0);
+
+ if(nViewVisibleArea > nMaxQuadratPixels)
+ {
+ // reduce render size
+ fReduceFactor = sqrt((double)nMaxQuadratPixels / (double)nViewVisibleArea);
+ aSizePixel = Size(basegfx::fround((double)aSizePixel.getWidth() * fReduceFactor),
+ basegfx::fround((double)aSizePixel.getHeight() * fReduceFactor));
+ }
if(aBufferDevice.SetOutputSizePixel(aSizePixel))
{
@@ -1915,6 +1938,12 @@ namespace drawinglayer
aViewTransform.scale(fDPIXChange, fDPIYChange);
}
+ // also take scaling from Size reduction into acount
+ if(!basegfx::fTools::equal(fReduceFactor, 1.0))
+ {
+ aViewTransform.scale(fReduceFactor, fReduceFactor);
+ }
+
// create view information and pixel renderer. Reuse known ViewInformation
// except new transformation and range
const geometry::ViewInformation2D aViewInfo(
@@ -1971,21 +2000,6 @@ namespace drawinglayer
RenderPointArrayPrimitive2D(static_cast< const primitive2d::PointArrayPrimitive2D& >(rCandidate));
break;
}
- case PRIMITIVE2D_ID_CHARTPRIMITIVE2D :
- {
- // ChartPrimitive2D
- const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate);
-
- if(!renderChartPrimitive2D(
- rChartPrimitive,
- *mpOutputDevice,
- getViewInformation2D()))
- {
- // fallback to decomposition (MetaFile)
- process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
- }
- break;
- }
case PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D :
{
// structured tag primitive