diff options
Diffstat (limited to 'core/fxge')
-rw-r--r-- | core/fxge/cfx_renderdevice.cpp | 29 | ||||
-rw-r--r-- | core/fxge/cfx_renderdevice.h | 16 |
2 files changed, 24 insertions, 21 deletions
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index a479517d0e..826f14dfa7 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp @@ -9,7 +9,6 @@ #include <algorithm> #include <memory> #include <utility> -#include <vector> #include "core/fxcrt/fx_safe_types.h" #include "core/fxge/cfx_defaultrenderdevice.h" @@ -477,12 +476,14 @@ bool CFX_RenderDevice::SetClip_PathStroke( return true; } +#ifdef PDF_ENABLE_XFA bool CFX_RenderDevice::SetClip_Rect(const CFX_RectF& rtClip) { return SetClip_Rect(FX_RECT(static_cast<int32_t>(floor(rtClip.left)), static_cast<int32_t>(floor(rtClip.top)), static_cast<int32_t>(ceil(rtClip.right())), static_cast<int32_t>(ceil(rtClip.bottom())))); } +#endif bool CFX_RenderDevice::SetClip_Rect(const FX_RECT& rect) { CFX_PathData path; @@ -1104,19 +1105,19 @@ void CFX_RenderDevice::DrawFillRect(const CFX_Matrix* pUser2Device, DrawPath(&path, pUser2Device, nullptr, color, 0, FXFILL_WINDING); } -void CFX_RenderDevice::DrawFillArea(const CFX_Matrix* pUser2Device, - const CFX_PointF* pPts, - int32_t nCount, +void CFX_RenderDevice::DrawFillArea(const CFX_Matrix& mtUser2Device, + const std::vector<CFX_PointF>& points, const FX_COLORREF& color) { + ASSERT(!points.empty()); CFX_PathData path; - path.AppendPoint(pPts[0], FXPT_TYPE::MoveTo, false); - for (int32_t i = 1; i < nCount; i++) - path.AppendPoint(pPts[i], FXPT_TYPE::LineTo, false); + path.AppendPoint(points[0], FXPT_TYPE::MoveTo, false); + for (size_t i = 1; i < points.size(); ++i) + path.AppendPoint(points[i], FXPT_TYPE::LineTo, false); - DrawPath(&path, pUser2Device, nullptr, color, 0, FXFILL_ALTERNATE); + DrawPath(&path, &mtUser2Device, nullptr, color, 0, FXFILL_ALTERNATE); } -void CFX_RenderDevice::DrawStrokeRect(const CFX_Matrix* pUser2Device, +void CFX_RenderDevice::DrawStrokeRect(const CFX_Matrix& mtUser2Device, const CFX_FloatRect& rect, const FX_COLORREF& color, float fWidth) { @@ -1125,7 +1126,7 @@ void CFX_RenderDevice::DrawStrokeRect(const CFX_Matrix* pUser2Device, CFX_PathData path; path.AppendRect(rect); - DrawPath(&path, pUser2Device, &gsd, 0, color, FXFILL_ALTERNATE); + DrawPath(&path, &mtUser2Device, &gsd, 0, color, FXFILL_ALTERNATE); } void CFX_RenderDevice::DrawStrokeLine(const CFX_Matrix* pUser2Device, @@ -1150,10 +1151,10 @@ void CFX_RenderDevice::DrawFillRect(const CFX_Matrix* pUser2Device, DrawFillRect(pUser2Device, rect, color.ToFXColor(nTransparency)); } -void CFX_RenderDevice::DrawShadow(const CFX_Matrix* pUser2Device, +void CFX_RenderDevice::DrawShadow(const CFX_Matrix& mtUser2Device, bool bVertical, bool bHorizontal, - CFX_FloatRect rect, + const CFX_FloatRect& rect, int32_t nTransparency, int32_t nStartGray, int32_t nEndGray) { @@ -1164,7 +1165,7 @@ void CFX_RenderDevice::DrawShadow(const CFX_Matrix* pUser2Device, for (float fy = rect.bottom + 0.5f; fy <= rect.top - 0.5f; fy += 1.0f) { int32_t nGray = nStartGray + (int32_t)(fStepGray * (fy - rect.bottom)); - DrawStrokeLine(pUser2Device, CFX_PointF(rect.left, fy), + DrawStrokeLine(&mtUser2Device, CFX_PointF(rect.left, fy), CFX_PointF(rect.right, fy), ArgbEncode(nTransparency, nGray, nGray, nGray), 1.5f); } @@ -1175,7 +1176,7 @@ void CFX_RenderDevice::DrawShadow(const CFX_Matrix* pUser2Device, for (float fx = rect.left + 0.5f; fx <= rect.right - 0.5f; fx += 1.0f) { int32_t nGray = nStartGray + (int32_t)(fStepGray * (fx - rect.left)); - DrawStrokeLine(pUser2Device, CFX_PointF(fx, rect.bottom), + DrawStrokeLine(&mtUser2Device, CFX_PointF(fx, rect.bottom), CFX_PointF(fx, rect.top), ArgbEncode(nTransparency, nGray, nGray, nGray), 1.5f); } diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h index e6c44ff35f..1d6fe48170 100644 --- a/core/fxge/cfx_renderdevice.h +++ b/core/fxge/cfx_renderdevice.h @@ -8,6 +8,7 @@ #define CORE_FXGE_CFX_RENDERDEVICE_H_ #include <memory> +#include <vector> #include "core/fpdfdoc/cpdf_defaultappearance.h" #include "core/fxcrt/unowned_ptr.h" @@ -123,7 +124,9 @@ class CFX_RenderDevice { bool SetClip_PathFill(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, int fill_mode); - bool SetClip_Rect(const CFX_RectF& pRect); +#ifdef PDF_ENABLE_XFA + bool SetClip_Rect(const CFX_RectF& rtClip); +#endif bool SetClip_Rect(const FX_RECT& pRect); bool SetClip_PathStroke(const CFX_PathData* pPathData, const CFX_Matrix* pObject2Device, @@ -233,7 +236,7 @@ class CFX_RenderDevice { void DrawFillRect(const CFX_Matrix* pUser2Device, const CFX_FloatRect& rect, const FX_COLORREF& color); - void DrawStrokeRect(const CFX_Matrix* pUser2Device, + void DrawStrokeRect(const CFX_Matrix& mtUser2Device, const CFX_FloatRect& rect, const FX_COLORREF& color, float fWidth); @@ -250,14 +253,13 @@ class CFX_RenderDevice { const CFX_Color& crRightBottom, BorderStyle nStyle, int32_t nTransparency); - void DrawFillArea(const CFX_Matrix* pUser2Device, - const CFX_PointF* pPts, - int32_t nCount, + void DrawFillArea(const CFX_Matrix& mtUser2Device, + const std::vector<CFX_PointF>& points, const FX_COLORREF& color); - void DrawShadow(const CFX_Matrix* pUser2Device, + void DrawShadow(const CFX_Matrix& mtUser2Device, bool bVertical, bool bHorizontal, - CFX_FloatRect rect, + const CFX_FloatRect& rect, int32_t nTransparency, int32_t nStartGray, int32_t nEndGray); |