From 608b04ca26be47c0c231a4419617e032bb21ae2e Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Sun, 5 Feb 2023 11:52:22 +0300 Subject: [PATCH] For bug 61014 --- DesktopEditor/graphics/Graphics.cpp | 9 ++++++++- DesktopEditor/graphics/Graphics.h | 2 ++ DesktopEditor/graphics/GraphicsRenderer.cpp | 3 +++ DesktopEditor/graphics/IRenderer.h | 1 + PdfFile/PdfFile.cpp | 1 + 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/DesktopEditor/graphics/Graphics.cpp b/DesktopEditor/graphics/Graphics.cpp index d7c39ce66d..3691a58a0d 100644 --- a/DesktopEditor/graphics/Graphics.cpp +++ b/DesktopEditor/graphics/Graphics.cpp @@ -69,6 +69,8 @@ namespace Aggplus m_nTextRenderMode = FT_RENDER_MODE_NORMAL; m_nBlendMode = agg::comp_op_src_over; + + m_bIs0PenWidthAs1px = false; } CGraphics::CGraphics(int dwWidth, int dwHeight, int stride, BYTE* pBuffer) : m_dwConfigFlags(0) @@ -103,6 +105,8 @@ namespace Aggplus m_nTextRenderMode = FT_RENDER_MODE_NORMAL; m_nBlendMode = agg::comp_op_src_over; + + m_bIs0PenWidthAs1px = false; } CGraphics::CGraphics(CImage* pImage) : m_dwConfigFlags(0) @@ -142,6 +146,8 @@ namespace Aggplus m_nTextRenderMode = FT_RENDER_MODE_NORMAL; m_nBlendMode = agg::comp_op_src_over; + + m_bIs0PenWidthAs1px = false; } CGraphics::~CGraphics() @@ -609,7 +615,8 @@ namespace Aggplus if ((0 == dWidth && !m_bIntegerGrid) || dWidth < dWidthMinSize) { - //dWidth = dWidthMinSize; + if (m_bIs0PenWidthAs1px) + dWidth = dWidthMinSize; } double dblMiterLimit = pPen->MiterLimit; diff --git a/DesktopEditor/graphics/Graphics.h b/DesktopEditor/graphics/Graphics.h index bccb67aef8..3f4ef88868 100644 --- a/DesktopEditor/graphics/Graphics.h +++ b/DesktopEditor/graphics/Graphics.h @@ -309,6 +309,8 @@ public: int m_nTextRenderMode; unsigned int m_nBlendMode; + bool m_bIs0PenWidthAs1px; + public: CGraphics(); diff --git a/DesktopEditor/graphics/GraphicsRenderer.cpp b/DesktopEditor/graphics/GraphicsRenderer.cpp index 7e10359002..f7889202c2 100644 --- a/DesktopEditor/graphics/GraphicsRenderer.cpp +++ b/DesktopEditor/graphics/GraphicsRenderer.cpp @@ -1158,6 +1158,9 @@ HRESULT CGraphicsRenderer::CommandLong(const LONG& lType, const LONG& lCommand) m_pRenderer->m_bIsDarkMode = (1 == lCommand); if (c_nUseDictionaryFonts == lType && m_pFontManager) m_pFontManager->SetUseCorrentFontByName((1 == lCommand) ? true : false); + if (c_nPenWidth0As1px == lType && m_pRenderer) + m_pRenderer->m_bIs0PenWidthAs1px = (1 == lCommand) ? true : false; + return S_OK; } HRESULT CGraphicsRenderer::CommandDouble(const LONG& lType, const double& dCommand) diff --git a/DesktopEditor/graphics/IRenderer.h b/DesktopEditor/graphics/IRenderer.h index c441bb54e9..068498f459 100644 --- a/DesktopEditor/graphics/IRenderer.h +++ b/DesktopEditor/graphics/IRenderer.h @@ -107,6 +107,7 @@ const long c_nParamFlipY = 0x0002; const long c_nFlipNextRotate = 0x0004; const long c_nDarkMode = 0x0008; const long c_nUseDictionaryFonts = 0x0010; +const long c_nPenWidth0As1px = 0x0020; // типы рендерера const long c_nUnknownRenderer = 0x0000; diff --git a/PdfFile/PdfFile.cpp b/PdfFile/PdfFile.cpp index 59b193fada..64ed449833 100644 --- a/PdfFile/PdfFile.cpp +++ b/PdfFile/PdfFile.cpp @@ -789,6 +789,7 @@ void CPdfFile::DrawPageOnRenderer(IRenderer* pRenderer, int nPageIndex, bool* pB { if (!m_pInternal->pReader) return; + pRenderer->CommandLong(c_nPenWidth0As1px, 1); m_pInternal->pReader->DrawPageOnRenderer(pRenderer, nPageIndex, pBreak); } std::wstring CPdfFile::GetInfo()