| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/include/xfa_ffwidget.h" | 7 #include "xfa/fxfa/include/xfa_ffwidget.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 return; | 1172 return; |
| 1173 } | 1173 } |
| 1174 FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset; | 1174 FX_FLOAT fLeftInset, fTopInset, fRightInset, fBottomInset; |
| 1175 mg.GetLeftInset(fLeftInset); | 1175 mg.GetLeftInset(fLeftInset); |
| 1176 mg.GetTopInset(fTopInset); | 1176 mg.GetTopInset(fTopInset); |
| 1177 mg.GetRightInset(fRightInset); | 1177 mg.GetRightInset(fRightInset); |
| 1178 mg.GetBottomInset(fBottomInset); | 1178 mg.GetBottomInset(fBottomInset); |
| 1179 rt.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset); | 1179 rt.Deflate(fLeftInset, fTopInset, fRightInset, fBottomInset); |
| 1180 } | 1180 } |
| 1181 CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem) { | 1181 CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem) { |
| 1182 XFA_Element iType = pLayoutItem->GetFormNode()->GetElementType(); | 1182 if (XFA_IsCreateWidget(pLayoutItem->GetFormNode()->GetElementType())) |
| 1183 if (XFA_IsCreateWidget(iType)) { | |
| 1184 return static_cast<CXFA_FFWidget*>(pLayoutItem); | 1183 return static_cast<CXFA_FFWidget*>(pLayoutItem); |
| 1185 } | |
| 1186 return nullptr; | 1184 return nullptr; |
| 1187 } | 1185 } |
| 1188 FX_BOOL XFA_IsCreateWidget(XFA_Element iType) { | 1186 FX_BOOL XFA_IsCreateWidget(XFA_Element eType) { |
| 1189 return iType == XFA_Element::Field || iType == XFA_Element::Draw || | 1187 return eType == XFA_Element::Field || eType == XFA_Element::Draw || |
| 1190 iType == XFA_Element::Subform || iType == XFA_Element::ExclGroup; | 1188 eType == XFA_Element::Subform || eType == XFA_Element::ExclGroup; |
| 1191 } | 1189 } |
| 1192 static void XFA_BOX_GetPath_Arc(CXFA_Box box, | 1190 static void XFA_BOX_GetPath_Arc(CXFA_Box box, |
| 1193 CFX_RectF rtDraw, | 1191 CFX_RectF rtDraw, |
| 1194 CFX_Path& fillPath, | 1192 CFX_Path& fillPath, |
| 1195 uint32_t dwFlags) { | 1193 uint32_t dwFlags) { |
| 1196 FX_FLOAT a, b; | 1194 FX_FLOAT a, b; |
| 1197 a = rtDraw.width / 2.0f; | 1195 a = rtDraw.width / 2.0f; |
| 1198 b = rtDraw.height / 2.0f; | 1196 b = rtDraw.height / 2.0f; |
| 1199 if (box.IsCircular() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) { | 1197 if (box.IsCircular() || (dwFlags & XFA_DRAWBOX_ForceRound) != 0) { |
| 1200 a = b = std::min(a, b); | 1198 a = b = std::min(a, b); |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 XFA_BOX_Stroke_Rect(box, strokes, pGS, rtWidget, pMatrix); | 2024 XFA_BOX_Stroke_Rect(box, strokes, pGS, rtWidget, pMatrix); |
| 2027 } | 2025 } |
| 2028 void XFA_DrawBox(CXFA_Box box, | 2026 void XFA_DrawBox(CXFA_Box box, |
| 2029 CFX_Graphics* pGS, | 2027 CFX_Graphics* pGS, |
| 2030 const CFX_RectF& rtWidget, | 2028 const CFX_RectF& rtWidget, |
| 2031 CFX_Matrix* pMatrix, | 2029 CFX_Matrix* pMatrix, |
| 2032 uint32_t dwFlags) { | 2030 uint32_t dwFlags) { |
| 2033 if (!box || box.GetPresence() != XFA_ATTRIBUTEENUM_Visible) | 2031 if (!box || box.GetPresence() != XFA_ATTRIBUTEENUM_Visible) |
| 2034 return; | 2032 return; |
| 2035 | 2033 |
| 2036 XFA_Element iType = box.GetElementType(); | 2034 XFA_Element eType = box.GetElementType(); |
| 2037 if (iType != XFA_Element::Arc && iType != XFA_Element::Border && | 2035 if (eType != XFA_Element::Arc && eType != XFA_Element::Border && |
| 2038 iType != XFA_Element::Rectangle) { | 2036 eType != XFA_Element::Rectangle) { |
| 2039 return; | 2037 return; |
| 2040 } | 2038 } |
| 2041 CXFA_StrokeArray strokes; | 2039 CXFA_StrokeArray strokes; |
| 2042 if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_Element::Arc) { | 2040 if (!(dwFlags & XFA_DRAWBOX_ForceRound) && eType != XFA_Element::Arc) { |
| 2043 box.GetStrokes(strokes); | 2041 box.GetStrokes(strokes); |
| 2044 } | 2042 } |
| 2045 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 2043 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); |
| 2046 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 2044 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); |
| 2047 } | 2045 } |
| 2048 | 2046 |
| 2049 CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {} | 2047 CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {} |
| 2050 | 2048 |
| 2051 CXFA_CalcData::~CXFA_CalcData() { | 2049 CXFA_CalcData::~CXFA_CalcData() { |
| 2052 m_Globals.RemoveAll(); | 2050 m_Globals.RemoveAll(); |
| 2053 } | 2051 } |
| OLD | NEW |