diff options
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 29 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.h | 7 |
2 files changed, 12 insertions, 24 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index c83c118e73..c3fbf62eb7 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -2907,10 +2907,9 @@ bool CXFA_Node::CalculatePushButtonAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) { CFX_SizeF CXFA_Node::CalculateImageSize(float img_width, float img_height, - float dpi_x, - float dpi_y) { - CFX_RectF rtImage(0, 0, XFA_UnitPx2Pt(img_width, dpi_x), - XFA_UnitPx2Pt(img_height, dpi_y)); + const CFX_Size& dpi) { + CFX_RectF rtImage(0, 0, XFA_UnitPx2Pt(img_width, dpi.width), + XFA_UnitPx2Pt(img_height, dpi.height)); CFX_RectF rtFit; Optional<float> width = TryWidth(); @@ -2941,12 +2940,8 @@ bool CXFA_Node::CalculateImageAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) { if (!pBitmap) return CalculateWidgetAutoSize(pSize); - int32_t iImageXDpi = 0; - int32_t iImageYDpi = 0; - GetImageDpi(iImageXDpi, iImageYDpi); - *pSize = CalculateImageSize(pBitmap->GetWidth(), pBitmap->GetHeight(), - iImageXDpi, iImageYDpi); + GetImageDpi()); return CalculateWidgetAutoSize(pSize); } @@ -2959,12 +2954,8 @@ bool CXFA_Node::CalculateImageEditAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize) { if (!pBitmap) return CalculateFieldAutoSize(doc, pSize); - int32_t iImageXDpi = 0; - int32_t iImageYDpi = 0; - GetImageEditDpi(iImageXDpi, iImageYDpi); - *pSize = CalculateImageSize(pBitmap->GetWidth(), pBitmap->GetHeight(), - iImageXDpi, iImageYDpi); + GetImageEditDpi()); return CalculateFieldAutoSize(doc, pSize); } @@ -2980,18 +2971,16 @@ bool CXFA_Node::LoadImageEditImage(CXFA_FFDoc* doc) { ->LoadImageData(doc, this); } -void CXFA_Node::GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) { +CFX_Size CXFA_Node::GetImageDpi() const { CXFA_ImageLayoutData* pData = static_cast<CXFA_ImageLayoutData*>(m_pLayoutData.get()); - iImageXDpi = pData->m_iImageXDpi; - iImageYDpi = pData->m_iImageYDpi; + return CFX_Size(pData->m_iImageXDpi, pData->m_iImageYDpi); } -void CXFA_Node::GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi) { +CFX_Size CXFA_Node::GetImageEditDpi() const { CXFA_ImageEditData* pData = static_cast<CXFA_ImageEditData*>(m_pLayoutData.get()); - iImageXDpi = pData->m_iImageXDpi; - iImageYDpi = pData->m_iImageYDpi; + return CFX_Size(pData->m_iImageXDpi, pData->m_iImageYDpi); } float CXFA_Node::CalculateWidgetAutoWidth(float fWidthCalc) { diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index 32e5cfd861..b12a26ef3b 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -312,8 +312,8 @@ class CXFA_Node : public CXFA_Object { bool LoadImageImage(CXFA_FFDoc* doc); bool LoadImageEditImage(CXFA_FFDoc* doc); - void GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi); - void GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi); + CFX_Size GetImageDpi() const; + CFX_Size GetImageEditDpi() const; RetainPtr<CFX_DIBitmap> GetImageImage(); RetainPtr<CFX_DIBitmap> GetImageEditImage(); @@ -452,8 +452,7 @@ class CXFA_Node : public CXFA_Object { bool CalculatePushButtonAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize); CFX_SizeF CalculateImageSize(float img_width, float img_height, - float dpi_x, - float dpi_y); + const CFX_Size& dpi); bool CalculateImageEditAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize); bool CalculateImageAutoSize(CXFA_FFDoc* doc, CFX_SizeF* pSize); float CalculateWidgetAutoHeight(float fHeightCalc); |