summaryrefslogtreecommitdiff
path: root/xfa/fde
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde')
-rw-r--r--xfa/fde/cfde_path.cpp21
-rw-r--r--xfa/fde/cfde_path.h11
-rw-r--r--xfa/fde/fde_gedevice.cpp15
3 files changed, 21 insertions, 26 deletions
diff --git a/xfa/fde/cfde_path.cpp b/xfa/fde/cfde_path.cpp
index 15d33339bf..825de40bfe 100644
--- a/xfa/fde/cfde_path.cpp
+++ b/xfa/fde/cfde_path.cpp
@@ -20,14 +20,11 @@ bool CFDE_Path::CloseFigure() {
return true;
}
-FX_PATHPOINT* CFDE_Path::GetLastPoint(int32_t iCount) const {
- if (iCount < 1)
- return nullptr;
-
+FX_PATHPOINT* CFDE_Path::GetLastPoint() const {
int32_t iPoints = m_Path.GetPointCount();
- if (iCount > iPoints)
+ if (iPoints == 0)
return nullptr;
- return m_Path.GetPoints() + iPoints - iCount;
+ return m_Path.GetPoints() + iPoints - 1;
}
bool CFDE_Path::FigureClosed() const {
@@ -253,16 +250,16 @@ void CFDE_Path::AddRectangle(const CFX_RectF& rect) {
CloseFigure();
}
-void CFDE_Path::GetBBox(CFX_RectF& bbox) const {
+CFX_RectF CFDE_Path::GetBBox() const {
CFX_FloatRect rect = m_Path.GetBoundingBox();
- bbox = CFX_RectF(rect.left, rect.top, rect.Width(), rect.Height());
+ CFX_RectF bbox = CFX_RectF(rect.left, rect.top, rect.Width(), rect.Height());
bbox.Normalize();
+ return bbox;
}
-void CFDE_Path::GetBBox(CFX_RectF& bbox,
- FX_FLOAT fLineWidth,
- FX_FLOAT fMiterLimit) const {
+CFX_RectF CFDE_Path::GetBBox(FX_FLOAT fLineWidth, FX_FLOAT fMiterLimit) const {
CFX_FloatRect rect = m_Path.GetBoundingBox(fLineWidth, fMiterLimit);
- bbox = CFX_RectF(rect.left, rect.top, rect.Width(), rect.Height());
+ CFX_RectF bbox = CFX_RectF(rect.left, rect.top, rect.Width(), rect.Height());
bbox.Normalize();
+ return bbox;
}
diff --git a/xfa/fde/cfde_path.h b/xfa/fde/cfde_path.h
index d2d8fe99ec..ab5995016a 100644
--- a/xfa/fde/cfde_path.h
+++ b/xfa/fde/cfde_path.h
@@ -28,12 +28,11 @@ class CFDE_Path {
void AddPath(const CFDE_Path* pSrc, bool bConnect);
void AddPolygon(const std::vector<CFX_PointF>& points);
void AddRectangle(const CFX_RectF& rect);
- void GetBBox(CFX_RectF& bbox) const;
- void GetBBox(CFX_RectF& bbox,
- FX_FLOAT fLineWidth,
- FX_FLOAT fMiterLimit) const;
FX_PATHPOINT* AddPoints(int32_t iCount);
- FX_PATHPOINT* GetLastPoint(int32_t iCount = 1) const;
+
+ CFX_RectF GetBBox() const;
+ CFX_RectF GetBBox(FX_FLOAT fLineWidth, FX_FLOAT fMiterLimit) const;
+
bool FigureClosed() const;
void MoveTo(FX_FLOAT fx, FX_FLOAT fy);
void LineTo(FX_FLOAT fx, FX_FLOAT fy);
@@ -46,6 +45,8 @@ class CFDE_Path {
FX_FLOAT endAngle);
void MoveTo(const CFX_PointF& p0) { MoveTo(p0.x, p0.y); }
void LineTo(const CFX_PointF& p1) { LineTo(p1.x, p1.y); }
+
+ FX_PATHPOINT* GetLastPoint() const;
void GetCurveTangents(const std::vector<CFX_PointF>& points,
std::vector<CFX_PointF>* tangents,
bool bClosed,
diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp
index 8b5ef1c40e..db05f76241 100644
--- a/xfa/fde/fde_gedevice.cpp
+++ b/xfa/fde/fde_gedevice.cpp
@@ -168,12 +168,10 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
FxFont.SetFace(pFxFont->GetFace());
m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize,
- (const CFX_Matrix*)pMatrix, argb,
- FXTEXT_CLEARTYPE);
+ pMatrix, argb, FXTEXT_CLEARTYPE);
#else
m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize,
- (const CFX_Matrix*)pMatrix, argb,
- FXTEXT_CLEARTYPE);
+ pMatrix, argb, FXTEXT_CLEARTYPE);
#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
}
pCurFont = pSTFont;
@@ -188,15 +186,14 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush,
pFxFont = pCurFont->GetDevFont();
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
FxFont.SetFace(pFxFont->GetFace());
- bool bRet = m_pDevice->DrawNormalText(
- iCurCount, pCurCP, &FxFont, -fFontSize, (const CFX_Matrix*)pMatrix,
- argb, FXTEXT_CLEARTYPE);
+ bool bRet =
+ m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize,
+ pMatrix, argb, FXTEXT_CLEARTYPE);
FxFont.SetFace(nullptr);
return bRet;
#else
return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize,
- (const CFX_Matrix*)pMatrix, argb,
- FXTEXT_CLEARTYPE);
+ pMatrix, argb, FXTEXT_CLEARTYPE);
#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
}