[PATCH libreoffice-4-0-2] implemented EmfPlusRecordTypeDrawEllipse record
Fridrich Strba (via Code Review)
gerrit at gerrit.libreoffice.org
Fri Mar 15 07:57:15 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/2752
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/52/2752/1
implemented EmfPlusRecordTypeDrawEllipse record
(cherry picked from commit fa109b4603f06533a63ee19518c482a23976bfe8)
Conflicts:
cppcanvas/source/mtfrenderer/emfplus.cxx
Change-Id: If8d7c210e437a041f3202c09f3d26d621b5af748
ops, fix build
(cherry picked from commit ebebb309403498a9438a908a26248b05cc855879)
Conflicts:
cppcanvas/source/mtfrenderer/emfplus.cxx
Change-Id: If72f3c1e0d7a14779074d898c4d1eb0fe8f07871
Reviewed-on: https://gerrit.libreoffice.org/2751
Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
Tested-by: Fridrich Strba <fridrich at documentfoundation.org>
(cherry picked from commit 46d4224d1ac0ae4aab52c3bb7f4f844928cce260)
---
M cppcanvas/source/inc/implrenderer.hxx
M cppcanvas/source/mtfrenderer/emfplus.cxx
2 files changed, 47 insertions(+), 34 deletions(-)
diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx
index 7d82ea7..c2902d6 100644
--- a/cppcanvas/source/inc/implrenderer.hxx
+++ b/cppcanvas/source/inc/implrenderer.hxx
@@ -264,6 +264,7 @@
/* EMF+ */
void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas );
double setFont( sal_uInt8 objectId, const ActionFactoryParameters& rParms, OutDevState& rState );
+ void EMFPPlusDrawPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex);
void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor);
ActionVector maActions;
diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx
index 383ce31..de5c480 100644
--- a/cppcanvas/source/mtfrenderer/emfplus.cxx
+++ b/cppcanvas/source/mtfrenderer/emfplus.cxx
@@ -1092,6 +1092,41 @@
}
}
+ void ImplRenderer::EMFPPlusDrawPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms,
+ OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex)
+ {
+ EMFPPen* pen = (EMFPPen*) aObjects [penIndex & 0xff];
+
+ SAL_WARN_IF( !pen, "cppcanvas", "emf+ missing pen" );
+
+ if (pen)
+ {
+ rState.isFillColorSet = false;
+ rState.isLineColorSet = true;
+ rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (),
+ rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace());
+
+ polygon.transform( rState.mapModeTransform );
+ rendering::StrokeAttributes aStrokeAttributes;
+
+ pen->SetStrokeAttributes (aStrokeAttributes, *this, rState);
+
+ ActionSharedPtr pPolyAction(
+ internal::PolyPolyActionFactory::createPolyPolyAction(
+ polygon, rParms.mrCanvas, rState, aStrokeAttributes ) );
+
+ if( pPolyAction )
+ {
+ maActions.push_back(
+ MtfAction(
+ pPolyAction,
+ rParms.mrCurrActionIndex ) );
+
+ rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
+ }
+ }
+ }
+
void ImplRenderer::processObjectRecord(SvMemoryStream& rObjectStream, sal_uInt16 flags, sal_uInt32 dataSize, sal_Bool bUseWholeStream)
{
sal_uInt32 index;
@@ -1294,14 +1329,15 @@
EMFPPlusFillPolygon (((EMFPPath*) aObjects [index])->GetPolygon (*this), rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor);
}
break;
+ case EmfPlusRecordTypeDrawEllipse:
case EmfPlusRecordTypeFillEllipse:
{
- sal_uInt32 index = flags & 0xff;
sal_uInt32 brushIndexOrColor;
- rMF >> brushIndexOrColor;
+ if ( type == EmfPlusRecordTypeFillEllipse )
+ rMF >> brushIndexOrColor;
- EMFP_DEBUG (printf ("EMF+ FillEllipse slot: %u\n", (unsigned int)index));
+ EMFP_DEBUG (printf ("EMF+ %sEllipse slot: %u\n", type == EmfPlusRecordTypeFillEllipse ? "Fill" : "Draw", static_cast<unsigned>(flags & 0xff)));
float dx, dy, dw, dh;
@@ -1314,8 +1350,12 @@
::basegfx::B2DPolyPolygon polyPolygon( ::basegfx::B2DPolygon( ::basegfx::tools::createPolygonFromEllipse( mappedCenter, mappedSize.getX (), mappedSize.getY () ) ) );
- EMFPPlusFillPolygon( polyPolygon,
- rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor );
+ if ( type == EmfPlusRecordTypeFillEllipse )
+ EMFPPlusFillPolygon( polyPolygon,
+ rFactoryParms, rState, rCanvas, flags & 0x8000, brushIndexOrColor );
+ else
+ EMFPPlusDrawPolygon( polyPolygon,
+ rFactoryParms, rState, rCanvas, flags & 0xff );
}
break;
case EmfPlusRecordTypeFillRects:
@@ -1435,38 +1475,10 @@
EMFP_DEBUG (printf ("EMF+\tpen: %u\n", (unsigned int)penIndex));
EMFPPath* path = (EMFPPath*) aObjects [flags & 0xff];
- EMFPPen* pen = (EMFPPen*) aObjects [penIndex & 0xff];
-
- SAL_WARN_IF( !pen, "cppcanvas", "EmfPlusRecordTypeDrawPath missing pen" );
SAL_WARN_IF( !path, "cppcanvas", "EmfPlusRecordTypeDrawPath missing path" );
- if (pen && path)
- {
- rState.isFillColorSet = false;
- rState.isLineColorSet = true;
- rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (),
- rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace());
- ::basegfx::B2DPolyPolygon& polygon (path->GetPolygon (*this));
+ EMFPPlusDrawPolygon (path->GetPolygon (*this), rFactoryParms, rState, rCanvas, penIndex);
- polygon.transform( rState.mapModeTransform );
- rendering::StrokeAttributes aStrokeAttributes;
-
- pen->SetStrokeAttributes (aStrokeAttributes, *this, rState);
-
- ActionSharedPtr pPolyAction(
- internal::PolyPolyActionFactory::createPolyPolyAction(
- polygon, rFactoryParms.mrCanvas, rState, aStrokeAttributes ) );
-
- if( pPolyAction )
- {
- maActions.push_back(
- MtfAction(
- pPolyAction,
- rFactoryParms.mrCurrActionIndex ) );
-
- rFactoryParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
- }
- }
break;
}
case EmfPlusRecordTypeDrawImage:
--
To view, visit https://gerrit.libreoffice.org/2752
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If72f3c1e0d7a14779074d898c4d1eb0fe8f07871
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0-2
Gerrit-Owner: Fridrich Strba <fridrich at documentfoundation.org>
Gerrit-Reviewer: Radek Doulík <rodo at novell.com>
More information about the LibreOffice
mailing list