summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2019-12-10 03:04:18 +1100
committerBartosz Kosiorek <gang65@poczta.onet.pl>2019-12-20 08:42:18 +0100
commit1bd303a4c38a1bc04c3cf7bf0e7a44ac0fdb209d (patch)
tree314ea0b802e88edf0c9083aa0e72869f33a00a00
parentaa59b0983061d344224986aa044b6ebd3ca218af (diff)
drawinglayer: improve pen object logging
Change-Id: Iaae081ddee8097346000b7c2d987a2321d5e98cd Reviewed-on: https://gerrit.libreoffice.org/84833 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
-rw-r--r--drawinglayer/source/tools/emfphelperdata.cxx36
-rw-r--r--drawinglayer/source/tools/emfppen.cxx50
-rw-r--r--drawinglayer/source/tools/emfppen.hxx14
3 files changed, 74 insertions, 26 deletions
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index 51a727bdcc61..b7a0c893c7af 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -204,40 +204,28 @@ namespace emfplushelper
switch (aUnitType)
{
case UnitTypePixel:
- {
return 1.0f;
- }
+
case UnitTypePoint:
- {
- SAL_INFO("drawinglayer", "EMF+\t Converting Points to Pixels.");
return Application::GetDefaultDevice()->GetDPIX() / 72;
- }
+
case UnitTypeInch:
- {
- SAL_INFO("drawinglayer", "EMF+\t Converting Inches to Pixels.");
return Application::GetDefaultDevice()->GetDPIX();
- }
+
case UnitTypeMillimeter:
- {
- SAL_INFO("drawinglayer", "EMF+\t Converting Millimeters to Pixels");
return Application::GetDefaultDevice()->GetDPIX() / 25.4;
- }
+
case UnitTypeDocument:
- {
- SAL_INFO("drawinglayer", "EMF+\t Converting Documents to Pixels.");
return Application::GetDefaultDevice()->GetDPIX() / 300;
- }
+
case UnitTypeWorld:
case UnitTypeDisplay:
- {
SAL_WARN("drawinglayer", "EMF+\t Converting to World/Display.");
return 1.0f;
- }
+
default:
- {
SAL_WARN("drawinglayer", "EMF+\tTODO Unimplemented support of Unit Type: 0x" << std::hex << aUnitType);
return 1.0f;
- }
}
}
@@ -491,14 +479,14 @@ namespace emfplushelper
{
// we need a line join attribute
basegfx::B2DLineJoin lineJoin = basegfx::B2DLineJoin::Round;
- if (pen->penDataFlags & 0x00000008) // additional line join information
+ if (pen->penDataFlags & EmfPlusPenDataJoin) // additional line join information
{
lineJoin = static_cast<basegfx::B2DLineJoin>(EMFPPen::lcl_convertLineJoinType(pen->lineJoin));
}
// we need a line cap attribute
css::drawing::LineCap lineCap = css::drawing::LineCap_BUTT;
- if (pen->penDataFlags & 0x00000002) // additional line cap information
+ if (pen->penDataFlags & EmfPlusPenDataStartCap) // additional line cap information
{
lineCap = static_cast<css::drawing::LineCap>(EMFPPen::lcl_convertStrokeCap(pen->startCap));
SAL_WARN_IF(pen->startCap != pen->endCap, "drawinglayer", "emf+ pen uses different start and end cap");
@@ -511,7 +499,7 @@ namespace emfplushelper
lineCap);
drawinglayer::attribute::StrokeAttribute aStrokeAttribute;
- if (pen->penDataFlags & 0x00000020 && pen->dashStyle != EmfPlusLineStyleCustom) // pen has a predefined line style
+ if (pen->penDataFlags & EmfPlusPenDataLineStyle && pen->dashStyle != EmfPlusLineStyleCustom) // pen has a predefined line style
{
// short writing
const double pw = maMapTransform.get(1, 1) * pen->penWidth;
@@ -539,7 +527,7 @@ namespace emfplushelper
break;
}
}
- else if (pen->penDataFlags & 0x00000100) // pen has a custom dash line
+ else if (pen->penDataFlags & EmfPlusPenDataMiterLimit) // pen has a custom dash line
{
// StrokeAttribute needs a double vector while the pen provides a float vector
std::vector<double> aPattern(pen->dashPattern.size());
@@ -573,7 +561,7 @@ namespace emfplushelper
pen->GetColor().GetTransparency() / 255.0));
}
- if ((pen->penDataFlags & 0x00000800) && (pen->customStartCap->polygon.begin()->count() > 1))
+ if ((pen->penDataFlags & EmfPlusPenDataCustomStartCap) && (pen->customStartCap->polygon.begin()->count() > 1))
{
SAL_WARN("drawinglayer", "EMF+\tCustom Start Line Cap");
::basegfx::B2DPolyPolygon startCapPolygon(pen->customStartCap->polygon);
@@ -618,7 +606,7 @@ namespace emfplushelper
}
}
- if ((pen->penDataFlags & 0x00001000) && (pen->customEndCap->polygon.begin()->count() > 1))
+ if ((pen->penDataFlags & EmfPlusPenDataCustomEndCap) && (pen->customEndCap->polygon.begin()->count() > 1))
{
SAL_WARN("drawinglayer", "EMF+\tCustom End Line Cap");
diff --git a/drawinglayer/source/tools/emfppen.cxx b/drawinglayer/source/tools/emfppen.cxx
index 353d6faea687..fa0ea00d503d 100644
--- a/drawinglayer/source/tools/emfppen.cxx
+++ b/drawinglayer/source/tools/emfppen.cxx
@@ -71,6 +71,52 @@ namespace emfplushelper
{
}
+ static OUString PenDataFlagsToString(sal_uInt32 flags)
+ {
+ OUString sFlags;
+
+ if (flags & EmfPlusPenDataTransform)
+ sFlags = "\nEMF+\t\t\tEmfPlusPenDataTransform";
+
+ if (flags & EmfPlusPenDataStartCap)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataStartCap");
+
+ if (flags & EmfPlusPenDataEndCap)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataEndCap");
+
+ if (flags & EmfPlusPenDataJoin)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataJoin");
+
+ if (flags & EmfPlusPenDataMiterLimit)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataMiterLimit");
+
+ if (flags & EmfPlusPenDataLineStyle)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataLineStyle");
+
+ if (flags & EmfPlusPenDataDashedLineCap)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataDashedLineCap");
+
+ if (flags & EmfPlusPenDataDashedLineOffset)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataDashedLineOffset");
+
+ if (flags & EmfPlusPenDataDashedLine)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataDashedLine");
+
+ if (flags & EmfPlusPenDataNonCenter)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataNonCenter");
+
+ if (flags & EmfPlusPenDataCompoundLine)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataCompoundLine");
+
+ if (flags & EmfPlusPenDataCustomStartCap)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataCustomStartCap");
+
+ if (flags & EmfPlusPenDataCustomEndCap)
+ sFlags = sFlags.concat("\nEMF+\t\t\tEmfPlusPenDataCustomEndCap");
+
+ return sFlags;
+ }
+
/// Convert stroke caps between EMF+ and rendering API
sal_Int8 EMFPPen::lcl_convertStrokeCap(sal_uInt32 nEmfStroke)
{
@@ -106,8 +152,8 @@ namespace emfplushelper
s.ReadUInt32(graphicsVersion).ReadUInt32(penType).ReadUInt32(penDataFlags).ReadUInt32(penUnit).ReadFloat(penWidth);
SAL_INFO("drawinglayer", "EMF+\t\tGraphics version: 0x" << std::hex << graphicsVersion);
SAL_INFO("drawinglayer", "EMF+\t\tType: " << penType);
- SAL_INFO("drawinglayer", "EMF+\t\tPen data flags: 0x" << penDataFlags);
- SAL_INFO("drawinglayer", "EMF+\t\tUnit: " << penUnit);
+ SAL_INFO("drawinglayer", "EMF+\t\tPen data flags: 0x" << penDataFlags << PenDataFlagsToString(penDataFlags));
+ SAL_INFO("drawinglayer", "EMF+\t\tUnit: " << UnitTypeToString(penUnit));
SAL_INFO("drawinglayer", "EMF+\t\tWidth: " << std::dec << penWidth);
penWidth = penWidth * EmfPlusHelperData::getUnitToPixelMultiplier(static_cast<UnitType>(penUnit));
diff --git a/drawinglayer/source/tools/emfppen.hxx b/drawinglayer/source/tools/emfppen.hxx
index 7570ee49bb40..ecc6f1c83dc3 100644
--- a/drawinglayer/source/tools/emfppen.hxx
+++ b/drawinglayer/source/tools/emfppen.hxx
@@ -40,6 +40,20 @@ namespace emfplushelper
const sal_Int32 EmfPlusLineStyleDashDotDot = 0x00000004;
const sal_Int32 EmfPlusLineStyleCustom = 0x00000005;
+ const sal_uInt32 EmfPlusPenDataTransform = 0x00000001;
+ const sal_uInt32 EmfPlusPenDataStartCap = 0x00000002;
+ const sal_uInt32 EmfPlusPenDataEndCap = 0x00000004;
+ const sal_uInt32 EmfPlusPenDataJoin = 0x00000008;
+ const sal_uInt32 EmfPlusPenDataMiterLimit = 0x00000010;
+ const sal_uInt32 EmfPlusPenDataLineStyle = 0x00000020;
+ const sal_uInt32 EmfPlusPenDataDashedLineCap = 0x00000040;
+ const sal_uInt32 EmfPlusPenDataDashedLineOffset = 0x00000080;
+ const sal_uInt32 EmfPlusPenDataDashedLine = 0x00000100;
+ const sal_uInt32 EmfPlusPenDataNonCenter = 0x00000200;
+ const sal_uInt32 EmfPlusPenDataCompoundLine = 0x00000400;
+ const sal_uInt32 EmfPlusPenDataCustomStartCap = 0x00000800;
+ const sal_uInt32 EmfPlusPenDataCustomEndCap = 0x000001000;
+
struct EMFPCustomLineCap;
struct EMFPPen : public EMFPBrush