| 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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1338     int32_t iHand = box.GetHand(); | 1338     int32_t iHand = box.GetHand(); | 
| 1339     if (iHand == XFA_ATTRIBUTEENUM_Left) { | 1339     if (iHand == XFA_ATTRIBUTEENUM_Left) { | 
| 1340       rtWidget.Inflate(fHalf, fHalf); | 1340       rtWidget.Inflate(fHalf, fHalf); | 
| 1341     } else if (iHand == XFA_ATTRIBUTEENUM_Right) { | 1341     } else if (iHand == XFA_ATTRIBUTEENUM_Right) { | 
| 1342       rtWidget.Deflate(fHalf, fHalf); | 1342       rtWidget.Deflate(fHalf, fHalf); | 
| 1343     } | 1343     } | 
| 1344     XFA_BOX_GetPath_Arc(box, rtWidget, fillPath, dwFlags); | 1344     XFA_BOX_GetPath_Arc(box, rtWidget, fillPath, dwFlags); | 
| 1345     return; | 1345     return; | 
| 1346   } | 1346   } | 
| 1347   FX_BOOL bSameStyles = TRUE; | 1347   FX_BOOL bSameStyles = TRUE; | 
| 1348   int32_t i; |  | 
| 1349   CXFA_Stroke stroke1 = strokes[0]; | 1348   CXFA_Stroke stroke1 = strokes[0]; | 
| 1350   for (i = 1; i < 8; i++) { | 1349   for (int32_t i = 1; i < 8; i++) { | 
| 1351     CXFA_Stroke stroke2 = strokes[i]; | 1350     CXFA_Stroke stroke2 = strokes[i]; | 
| 1352     if (!stroke1.SameStyles(stroke2)) { | 1351     if (!stroke1.SameStyles(stroke2)) { | 
| 1353       bSameStyles = FALSE; | 1352       bSameStyles = FALSE; | 
| 1354       break; | 1353       break; | 
| 1355     } | 1354     } | 
| 1356     stroke1 = stroke2; | 1355     stroke1 = stroke2; | 
| 1357   } | 1356   } | 
| 1358   if (bSameStyles) { | 1357   if (bSameStyles) { | 
| 1359     stroke1 = strokes[0]; | 1358     stroke1 = strokes[0]; | 
| 1360     for (i = 2; i < 8; i += 2) { | 1359     for (int32_t i = 2; i < 8; i += 2) { | 
| 1361       CXFA_Stroke stroke2 = strokes[i]; | 1360       CXFA_Stroke stroke2 = strokes[i]; | 
| 1362       if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence | | 1361       if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence | | 
| 1363                                            XFA_STROKE_SAMESTYLE_Corner)) { | 1362                                            XFA_STROKE_SAMESTYLE_Corner)) { | 
| 1364         bSameStyles = FALSE; | 1363         bSameStyles = FALSE; | 
| 1365         break; | 1364         break; | 
| 1366       } | 1365       } | 
| 1367       stroke1 = stroke2; | 1366       stroke1 = stroke2; | 
| 1368     } | 1367     } | 
| 1369     if (bSameStyles) { | 1368     if (bSameStyles) { | 
| 1370       stroke1 = strokes[0]; | 1369       stroke1 = strokes[0]; | 
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1832         XFA_BOX_Stroke_3DRect_Etched(pGS, rtWidget, fThickness, pMatrix); | 1831         XFA_BOX_Stroke_3DRect_Etched(pGS, rtWidget, fThickness, pMatrix); | 
| 1833         break; | 1832         break; | 
| 1834       case XFA_ATTRIBUTEENUM_Embossed: | 1833       case XFA_ATTRIBUTEENUM_Embossed: | 
| 1835         XFA_BOX_Stroke_3DRect_Embossed(pGS, rtWidget, fThickness, pMatrix); | 1834         XFA_BOX_Stroke_3DRect_Embossed(pGS, rtWidget, fThickness, pMatrix); | 
| 1836         break; | 1835         break; | 
| 1837     } | 1836     } | 
| 1838     return; | 1837     return; | 
| 1839   } | 1838   } | 
| 1840   FX_BOOL bClose = FALSE; | 1839   FX_BOOL bClose = FALSE; | 
| 1841   FX_BOOL bSameStyles = TRUE; | 1840   FX_BOOL bSameStyles = TRUE; | 
| 1842   int32_t i; |  | 
| 1843   CXFA_Stroke stroke1 = strokes[0]; | 1841   CXFA_Stroke stroke1 = strokes[0]; | 
| 1844   for (i = 1; i < 8; i++) { | 1842   for (int32_t i = 1; i < 8; i++) { | 
| 1845     CXFA_Stroke stroke2 = strokes[i]; | 1843     CXFA_Stroke stroke2 = strokes[i]; | 
| 1846     if (!stroke1.SameStyles(stroke2)) { | 1844     if (!stroke1.SameStyles(stroke2)) { | 
| 1847       bSameStyles = FALSE; | 1845       bSameStyles = FALSE; | 
| 1848       break; | 1846       break; | 
| 1849     } | 1847     } | 
| 1850     stroke1 = stroke2; | 1848     stroke1 = stroke2; | 
| 1851   } | 1849   } | 
| 1852   if (bSameStyles) { | 1850   if (bSameStyles) { | 
| 1853     stroke1 = strokes[0]; | 1851     stroke1 = strokes[0]; | 
| 1854     bClose = TRUE; | 1852     bClose = TRUE; | 
| 1855     for (i = 2; i < 8; i += 2) { | 1853     for (int32_t i = 2; i < 8; i += 2) { | 
| 1856       CXFA_Stroke stroke2 = strokes[i]; | 1854       CXFA_Stroke stroke2 = strokes[i]; | 
| 1857       if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence | | 1855       if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence | | 
| 1858                                            XFA_STROKE_SAMESTYLE_Corner)) { | 1856                                            XFA_STROKE_SAMESTYLE_Corner)) { | 
| 1859         bSameStyles = FALSE; | 1857         bSameStyles = FALSE; | 
| 1860         break; | 1858         break; | 
| 1861       } | 1859       } | 
| 1862       stroke1 = stroke2; | 1860       stroke1 = stroke2; | 
| 1863     } | 1861     } | 
| 1864     if (bSameStyles) { | 1862     if (bSameStyles) { | 
| 1865       stroke1 = strokes[0]; | 1863       stroke1 = strokes[0]; | 
| 1866       if (stroke1.IsInverted()) { | 1864       if (stroke1.IsInverted()) { | 
| 1867         bSameStyles = FALSE; | 1865         bSameStyles = FALSE; | 
| 1868       } | 1866       } | 
| 1869       if (stroke1.GetJoinType() != XFA_ATTRIBUTEENUM_Square) { | 1867       if (stroke1.GetJoinType() != XFA_ATTRIBUTEENUM_Square) { | 
| 1870         bSameStyles = FALSE; | 1868         bSameStyles = FALSE; | 
| 1871       } | 1869       } | 
| 1872     } | 1870     } | 
| 1873   } | 1871   } | 
| 1874   FX_BOOL bStart = TRUE; | 1872   FX_BOOL bStart = TRUE; | 
| 1875   CFX_Path path; | 1873   CFX_Path path; | 
| 1876   path.Create(); | 1874   path.Create(); | 
| 1877   for (i = 0; i < 8; i++) { | 1875   for (int32_t i = 0; i < 8; i++) { | 
| 1878     CXFA_Stroke stroke1 = strokes[i]; | 1876     CXFA_Stroke stroke = strokes[i]; | 
| 1879     if ((i % 1) == 0 && stroke1.GetRadius() < 0) { | 1877     if ((i % 1) == 0 && stroke.GetRadius() < 0) { | 
| 1880       FX_BOOL bEmpty = path.IsEmpty(); | 1878       FX_BOOL bEmpty = path.IsEmpty(); | 
| 1881       if (!bEmpty) { | 1879       if (!bEmpty) { | 
| 1882         XFA_BOX_StrokePath(stroke1, &path, pGS, pMatrix); | 1880         XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix); | 
| 1883         path.Clear(); | 1881         path.Clear(); | 
| 1884       } | 1882       } | 
| 1885       bStart = TRUE; | 1883       bStart = TRUE; | 
| 1886       continue; | 1884       continue; | 
| 1887     } | 1885     } | 
| 1888     XFA_BOX_GetPath(box, strokes, rtWidget, path, i, bStart, !bSameStyles); | 1886     XFA_BOX_GetPath(box, strokes, rtWidget, path, i, bStart, !bSameStyles); | 
| 1889     CXFA_Stroke stroke2 = strokes[(i + 1) % 8]; | 1887     CXFA_Stroke stroke2 = strokes[(i + 1) % 8]; | 
| 1890     bStart = !stroke1.SameStyles(stroke2); | 1888     bStart = !stroke.SameStyles(stroke2); | 
| 1891     if (bStart) { | 1889     if (bStart) { | 
| 1892       XFA_BOX_StrokePath(stroke1, &path, pGS, pMatrix); | 1890       XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix); | 
| 1893       path.Clear(); | 1891       path.Clear(); | 
| 1894     } | 1892     } | 
| 1895   } | 1893   } | 
| 1896   FX_BOOL bEmpty = path.IsEmpty(); | 1894   FX_BOOL bEmpty = path.IsEmpty(); | 
| 1897   if (!bEmpty) { | 1895   if (!bEmpty) { | 
| 1898     if (bClose) { | 1896     if (bClose) { | 
| 1899       path.Close(); | 1897       path.Close(); | 
| 1900     } | 1898     } | 
| 1901     XFA_BOX_StrokePath(strokes[7], &path, pGS, pMatrix); | 1899     XFA_BOX_StrokePath(strokes[7], &path, pGS, pMatrix); | 
| 1902   } | 1900   } | 
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1979       iType != XFA_ELEMENT_Rectangle) { | 1977       iType != XFA_ELEMENT_Rectangle) { | 
| 1980     return; | 1978     return; | 
| 1981   } | 1979   } | 
| 1982   CXFA_StrokeArray strokes; | 1980   CXFA_StrokeArray strokes; | 
| 1983   if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) { | 1981   if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) { | 
| 1984     box.GetStrokes(strokes); | 1982     box.GetStrokes(strokes); | 
| 1985   } | 1983   } | 
| 1986   XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 1984   XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 
| 1987   XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 1985   XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 
| 1988 } | 1986 } | 
| OLD | NEW | 
|---|