diff --git a/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h b/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h index 9b5aa88f67..5738cf064e 100644 --- a/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h +++ b/DesktopEditor/raster/Metafile/Common/MetaFileRenderer.h @@ -1077,13 +1077,6 @@ namespace MetaFile // TODO: dWidth зависит еще от флага PS_GEOMETRIC в стиле карандаша - double dWidth = pPen->GetWidth(); - - if (dWidth == 0 || (dWidth == 1 && PS_COSMETIC == ulPenType)) - dWidth = m_pFile->GetPixWidth(m_dScaleX); - else - dWidth *= m_dScaleX; - BYTE nStartCapStyle = 0; if (PS_STARTCAP_ROUND == ulPenStartCap) nStartCapStyle = Aggplus::LineCapRound; @@ -1111,6 +1104,17 @@ namespace MetaFile else if (PS_JOIN_MITER == ulPenJoin) nJoinStyle = Aggplus::LineJoinMiter; + double dWidth = pPen->GetWidth(); + + if (dWidth == 0 || (dWidth == 1 && PS_COSMETIC == ulPenType)) + { + dWidth = m_pFile->GetPixWidth(m_dScaleX); + nStartCapStyle = nEndCapStyle = Aggplus::LineCapFlat; + nJoinStyle = Aggplus::LineJoinMiter; + } + else + dWidth *= m_dScaleX; + double dMiterLimit = (0 != pPen->GetMiterLimit()) ? pPen->GetMiterLimit() : m_pFile->GetMiterLimit() * m_dScaleX; // TODO: Реализовать PS_USERSTYLE diff --git a/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParser.cpp b/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParser.cpp index 293d5c07ca..f73dc23f74 100644 --- a/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParser.cpp +++ b/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParser.cpp @@ -14,7 +14,7 @@ namespace MetaFile { CEmfParser::CEmfParser(IMetaFileBase *pParent) - : CEmfParserBase(pParent), m_pEmfPlusParser(NULL) + : m_pEmfPlusParser(NULL) {} CEmfParser::~CEmfParser() diff --git a/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParserBase.cpp b/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParserBase.cpp index d3e6abd0c0..6bc2abf9c7 100644 --- a/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParserBase.cpp +++ b/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParserBase.cpp @@ -620,8 +620,8 @@ namespace MetaFile return m_pDC; } - CEmfParserBase::CEmfParserBase(IMetaFileBase *pParent) - : m_oPlayer(this), m_pParent(pParent) + CEmfParserBase::CEmfParserBase() + : m_oPlayer(this) { m_pPath = NULL; m_pDC = m_oPlayer.GetDC(); @@ -779,9 +779,6 @@ namespace MetaFile double CEmfParserBase::GetPixWidth(double dScaleX) { - if (NULL != m_pParent) - return m_pParent->GetPixWidth(dScaleX); - if (MM_TEXT == m_pDC->GetMapMode()) return dScaleX * std::fabs((double)m_oHeader.oDevice.cx / (double)m_oHeader.oMillimeters.cx); @@ -1238,6 +1235,9 @@ namespace MetaFile if (NULL != m_pInterpretator) m_pInterpretator->HANDLE_EMR_SETVIEWPORTEXTEX(oExtent); + if (MM_ISOTROPIC != m_pDC->GetMapMode() && MM_ANISOTROPIC != m_pDC->GetMapMode()) + return; + m_pDC->SetViewportExtents(oExtent); UpdateOutputDC(); } diff --git a/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParserBase.h b/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParserBase.h index a0260d568a..2b0deb6c3d 100644 --- a/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParserBase.h +++ b/DesktopEditor/raster/Metafile/Emf/EmfParser/CEmfParserBase.h @@ -46,7 +46,7 @@ namespace MetaFile class CEmfParserBase : public virtual IMetaFileBase { public: - CEmfParserBase(IMetaFileBase *pParent = NULL); + CEmfParserBase(); ~CEmfParserBase(); virtual bool ReadFromBuffer(BYTE* pBuffer, unsigned int unSize, const bool& bIsExternal = true) = 0; @@ -151,8 +151,6 @@ namespace MetaFile CEmfInterpretatorBase *m_pInterpretator; bool m_bEof; - - IMetaFileBase *m_pParent; private: virtual bool ReadImage(unsigned int offBmi, unsigned int cbBmi, unsigned int offBits, unsigned int cbBits, unsigned int ulSkip, BYTE **ppBgraBuffer, unsigned int *pulWidth, unsigned int *pulHeight) = 0; diff --git a/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.cpp b/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.cpp index 971801b62e..2781708ed2 100644 --- a/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.cpp +++ b/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.cpp @@ -2,10 +2,8 @@ namespace MetaFile { - CWmfParser::CWmfParser(IMetaFileBase *pParent) - : CWmfParserBase(pParent) + CWmfParser::CWmfParser() { - } CWmfParser::~CWmfParser() @@ -205,14 +203,11 @@ namespace MetaFile if (m_oPlaceable.Inch != 0) { - double dKoef = 1440.f / m_oPlaceable.Inch; - m_pDC->SetViewportOrg(m_oPlaceable.BoundingBox.Left, m_oPlaceable.BoundingBox.Top); m_pDC->SetViewportExt((m_oPlaceable.BoundingBox.Right - m_oPlaceable.BoundingBox.Left), (m_oPlaceable.BoundingBox.Bottom - m_oPlaceable.BoundingBox.Top)); m_pDC->SetWindowOrg(m_oPlaceable.BoundingBox.Left, m_oPlaceable.BoundingBox.Top); m_pDC->SetWindowExt((m_oPlaceable.BoundingBox.Right - m_oPlaceable.BoundingBox.Left), (m_oPlaceable.BoundingBox.Bottom - m_oPlaceable.BoundingBox.Top)); - m_pDC->SetWindowScale(dKoef, dKoef); } SkipVoid(); diff --git a/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.h b/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.h index 7f31812cb1..79d3b55c91 100644 --- a/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.h +++ b/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParser.h @@ -8,7 +8,7 @@ namespace MetaFile class CWmfParser : public CWmfParserBase { public: - CWmfParser(IMetaFileBase *pParent = NULL); + CWmfParser(); virtual ~CWmfParser(); bool ReadFromBuffer(unsigned char* pBuffer, unsigned int unSize) override; diff --git a/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParserBase.cpp b/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParserBase.cpp index b168b069ff..db73d4fbb9 100644 --- a/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParserBase.cpp +++ b/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParserBase.cpp @@ -7,8 +7,8 @@ namespace MetaFile { - CWmfParserBase::CWmfParserBase(IMetaFileBase *pParent) - : m_oPlayer(this), m_pInterpretator(NULL), m_bEof(false), m_pParent(pParent) + CWmfParserBase::CWmfParserBase() + : m_oPlayer(this), m_pInterpretator(NULL), m_bEof(false) { m_pDC = m_oPlayer.GetDC(); } @@ -166,13 +166,10 @@ namespace MetaFile double CWmfParserBase::GetPixWidth(double dScaleX) { - if (NULL != m_pParent) - return m_pParent->GetPixWidth(dScaleX); - if (0 != m_oPlaceable.Inch && MM_TEXT != m_pDC->GetMapMode()) return dScaleX * (1440. / (((m_oPlaceable.Inch <= 1440) ? m_oPlaceable.Inch : 96) * m_pDC->GetPixelWidth())); - return dScaleX * 10. / m_pDC->GetPixelWidth(); + return dScaleX * 10. / m_pDC->GetPixelWidth() / ((0 != m_oPlaceable.Inch) ? (1440. / m_oPlaceable.Inch) : 1.); } void CWmfParserBase::SetInterpretator(IOutputDevice *pOutput) @@ -1618,7 +1615,7 @@ namespace MetaFile if (0 == unRemainingBytes) { - CEmfParser oEmfParser(this); + CEmfParser oEmfParser; oEmfParser.SetFontManager(GetFontManager()); oEmfParser.SetStream(m_oEscapeBuffer.GetBuffer(), m_oEscapeBuffer.GetSize()); diff --git a/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParserBase.h b/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParserBase.h index 341e02239d..d9944c7ca8 100644 --- a/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParserBase.h +++ b/DesktopEditor/raster/Metafile/Wmf/WmfParser/CWmfParserBase.h @@ -23,7 +23,7 @@ namespace MetaFile class CWmfParserBase : public IMetaFileBase { public: - CWmfParserBase(IMetaFileBase *pParent = NULL); + CWmfParserBase(); ~CWmfParserBase(); virtual bool ReadFromBuffer(unsigned char*, unsigned int) = 0; @@ -119,8 +119,6 @@ namespace MetaFile CWmfEscapeBuffer m_oEscapeBuffer; bool m_bEof; - - IMetaFileBase *m_pParent; private: // virtual bool ReadImage(unsigned int offBmi, unsigned int cbBmi, unsigned int offBits, unsigned int cbBits, unsigned int ulSkip, BYTE **ppBgraBuffer, unsigned int *pulWidth, unsigned int *pulHeight) = 0;