mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-15 23:58:12 +08:00
Fixed bugs and refactoring
This commit is contained in:
@ -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
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
namespace MetaFile
|
||||
{
|
||||
CEmfParser::CEmfParser(IMetaFileBase *pParent)
|
||||
: CEmfParserBase(pParent), m_pEmfPlusParser(NULL)
|
||||
: m_pEmfPlusParser(NULL)
|
||||
{}
|
||||
|
||||
CEmfParser::~CEmfParser()
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user