Fix bug 70986

This commit is contained in:
Oleg Korshul
2024-10-29 15:05:49 +03:00
parent 0dd0ad0023
commit 3401c2b02e
2 changed files with 51 additions and 46 deletions

View File

@ -6,6 +6,9 @@
#include "./../resources/resources.h"
#endif
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
#define CLAMP_ALPHA(x) CLAMP(x, 0, 255)
namespace NSDocxRenderer
{
CDocument::CDocument(IRenderer* pRenderer, NSFonts::IApplicationFonts* pFonts) :
@ -92,7 +95,7 @@ namespace NSDocxRenderer
}
HRESULT CDocument::put_PenAlpha(LONG lAlpha)
{
m_oPen.Alpha = lAlpha;
m_oPen.Alpha = CLAMP_ALPHA(lAlpha);
return S_OK;
}
HRESULT CDocument::get_PenSize(double* dSize)
@ -212,7 +215,7 @@ namespace NSDocxRenderer
}
HRESULT CDocument::put_BrushAlpha1(LONG lAlpha)
{
m_oBrush.Alpha1 = lAlpha;
m_oBrush.Alpha1 = CLAMP_ALPHA(lAlpha);;
return S_OK;
}
HRESULT CDocument::get_BrushColor2(LONG* lColor)
@ -232,7 +235,7 @@ namespace NSDocxRenderer
}
HRESULT CDocument::put_BrushAlpha2(LONG lAlpha)
{
m_oBrush.Alpha2 = lAlpha;
m_oBrush.Alpha2 = CLAMP_ALPHA(lAlpha);;
return S_OK;
}
HRESULT CDocument::get_BrushTexturePath(std::wstring* sPath)
@ -262,7 +265,7 @@ namespace NSDocxRenderer
}
HRESULT CDocument::put_BrushTextureAlpha(LONG lTxAlpha)
{
m_oBrush.TextureAlpha = lTxAlpha;
m_oBrush.TextureAlpha = CLAMP_ALPHA(lTxAlpha);
return S_OK;
}
HRESULT CDocument::get_BrushLinearAngle(double* dAngle)