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 "fpdfsdk/pdfwindow/PWL_Utils.h" | 7 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
707 } | 707 } |
708 | 708 |
709 return sColorStream.MakeString(); | 709 return sColorStream.MakeString(); |
710 } | 710 } |
711 | 711 |
712 CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, | 712 CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, |
713 FX_FLOAT fWidth, | 713 FX_FLOAT fWidth, |
714 const CPWL_Color& color, | 714 const CPWL_Color& color, |
715 const CPWL_Color& crLeftTop, | 715 const CPWL_Color& crLeftTop, |
716 const CPWL_Color& crRightBottom, | 716 const CPWL_Color& crRightBottom, |
717 int32_t nStyle, | 717 BorderStyle nStyle, |
718 const CPWL_Dash& dash) { | 718 const CPWL_Dash& dash) { |
719 CFX_ByteTextBuf sAppStream; | 719 CFX_ByteTextBuf sAppStream; |
720 CFX_ByteString sColor; | 720 CFX_ByteString sColor; |
721 | 721 |
722 FX_FLOAT fLeft = rect.left; | 722 FX_FLOAT fLeft = rect.left; |
723 FX_FLOAT fRight = rect.right; | 723 FX_FLOAT fRight = rect.right; |
724 FX_FLOAT fTop = rect.top; | 724 FX_FLOAT fTop = rect.top; |
725 FX_FLOAT fBottom = rect.bottom; | 725 FX_FLOAT fBottom = rect.bottom; |
726 | 726 |
727 if (fWidth > 0.0f) { | 727 if (fWidth > 0.0f) { |
728 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 728 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
729 | 729 |
730 sAppStream << "q\n"; | 730 sAppStream << "q\n"; |
731 | 731 |
732 switch (nStyle) { | 732 switch (nStyle) { |
733 default: | 733 default: |
734 case PBS_SOLID: | 734 case BorderStyle::SOLID: |
735 sColor = CPWL_Utils::GetColorAppStream(color, TRUE); | 735 sColor = CPWL_Utils::GetColorAppStream(color, TRUE); |
736 if (sColor.GetLength() > 0) { | 736 if (sColor.GetLength() > 0) { |
737 sAppStream << sColor; | 737 sAppStream << sColor; |
738 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " | 738 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " |
739 << fTop - fBottom << " re\n"; | 739 << fTop - fBottom << " re\n"; |
740 sAppStream << fLeft + fWidth << " " << fBottom + fWidth << " " | 740 sAppStream << fLeft + fWidth << " " << fBottom + fWidth << " " |
741 << fRight - fLeft - fWidth * 2 << " " | 741 << fRight - fLeft - fWidth * 2 << " " |
742 << fTop - fBottom - fWidth * 2 << " re\n"; | 742 << fTop - fBottom - fWidth * 2 << " re\n"; |
743 sAppStream << "f*\n"; | 743 sAppStream << "f*\n"; |
744 } | 744 } |
745 break; | 745 break; |
746 case PBS_DASH: | 746 case BorderStyle::DASH: |
747 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 747 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); |
748 if (sColor.GetLength() > 0) { | 748 if (sColor.GetLength() > 0) { |
749 sAppStream << sColor; | 749 sAppStream << sColor; |
750 sAppStream << fWidth << " w" | 750 sAppStream << fWidth << " w" |
751 << " [" << dash.nDash << " " << dash.nGap << "] " | 751 << " [" << dash.nDash << " " << dash.nGap << "] " |
752 << dash.nPhase << " d\n"; | 752 << dash.nPhase << " d\n"; |
753 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 | 753 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 |
754 << " m\n"; | 754 << " m\n"; |
755 sAppStream << fLeft + fWidth / 2 << " " << fTop - fWidth / 2 | 755 sAppStream << fLeft + fWidth / 2 << " " << fTop - fWidth / 2 |
756 << " l\n"; | 756 << " l\n"; |
757 sAppStream << fRight - fWidth / 2 << " " << fTop - fWidth / 2 | 757 sAppStream << fRight - fWidth / 2 << " " << fTop - fWidth / 2 |
758 << " l\n"; | 758 << " l\n"; |
759 sAppStream << fRight - fWidth / 2 << " " << fBottom + fWidth / 2 | 759 sAppStream << fRight - fWidth / 2 << " " << fBottom + fWidth / 2 |
760 << " l\n"; | 760 << " l\n"; |
761 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 | 761 sAppStream << fLeft + fWidth / 2 << " " << fBottom + fWidth / 2 |
762 << " l S\n"; | 762 << " l S\n"; |
763 } | 763 } |
764 break; | 764 break; |
765 case PBS_BEVELED: | 765 case BorderStyle::BEVELED: |
766 case PBS_INSET: | 766 case BorderStyle::INSET: |
767 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, TRUE); | 767 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, TRUE); |
768 if (sColor.GetLength() > 0) { | 768 if (sColor.GetLength() > 0) { |
769 sAppStream << sColor; | 769 sAppStream << sColor; |
770 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth | 770 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth |
771 << " m\n"; | 771 << " m\n"; |
772 sAppStream << fLeft + fHalfWidth << " " << fTop - fHalfWidth | 772 sAppStream << fLeft + fHalfWidth << " " << fTop - fHalfWidth |
773 << " l\n"; | 773 << " l\n"; |
774 sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth | 774 sAppStream << fRight - fHalfWidth << " " << fTop - fHalfWidth |
775 << " l\n"; | 775 << " l\n"; |
776 sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 | 776 sAppStream << fRight - fHalfWidth * 2 << " " << fTop - fHalfWidth * 2 |
(...skipping 24 matching lines...) Expand all Loading... | |
801 sColor = CPWL_Utils::GetColorAppStream(color, TRUE); | 801 sColor = CPWL_Utils::GetColorAppStream(color, TRUE); |
802 if (sColor.GetLength() > 0) { | 802 if (sColor.GetLength() > 0) { |
803 sAppStream << sColor; | 803 sAppStream << sColor; |
804 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " | 804 sAppStream << fLeft << " " << fBottom << " " << fRight - fLeft << " " |
805 << fTop - fBottom << " re\n"; | 805 << fTop - fBottom << " re\n"; |
806 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth << " " | 806 sAppStream << fLeft + fHalfWidth << " " << fBottom + fHalfWidth << " " |
807 << fRight - fLeft - fHalfWidth * 2 << " " | 807 << fRight - fLeft - fHalfWidth * 2 << " " |
808 << fTop - fBottom - fHalfWidth * 2 << " re f*\n"; | 808 << fTop - fBottom - fHalfWidth * 2 << " re f*\n"; |
809 } | 809 } |
810 break; | 810 break; |
811 case PBS_UNDERLINED: | 811 case BorderStyle::UNDERLINE: |
812 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 812 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); |
813 if (sColor.GetLength() > 0) { | 813 if (sColor.GetLength() > 0) { |
814 sAppStream << sColor; | 814 sAppStream << sColor; |
815 sAppStream << fWidth << " w\n"; | 815 sAppStream << fWidth << " w\n"; |
816 sAppStream << fLeft << " " << fBottom + fWidth / 2 << " m\n"; | 816 sAppStream << fLeft << " " << fBottom + fWidth / 2 << " m\n"; |
817 sAppStream << fRight << " " << fBottom + fWidth / 2 << " l S\n"; | 817 sAppStream << fRight << " " << fBottom + fWidth / 2 << " l S\n"; |
818 } | 818 } |
819 break; | 819 break; |
820 } | 820 } |
821 | 821 |
822 sAppStream << "Q\n"; | 822 sAppStream << "Q\n"; |
823 } | 823 } |
824 | 824 |
825 return sAppStream.MakeString(); | 825 return sAppStream.MakeString(); |
826 } | 826 } |
827 | 827 |
828 CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( | 828 CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( |
829 const CFX_FloatRect& rect, | 829 const CFX_FloatRect& rect, |
830 FX_FLOAT fWidth, | 830 FX_FLOAT fWidth, |
831 const CPWL_Color& color, | 831 const CPWL_Color& color, |
832 const CPWL_Color& crLeftTop, | 832 const CPWL_Color& crLeftTop, |
833 const CPWL_Color& crRightBottom, | 833 const CPWL_Color& crRightBottom, |
834 int32_t nStyle, | 834 BorderStyle nStyle, |
835 const CPWL_Dash& dash) { | 835 const CPWL_Dash& dash) { |
836 CFX_ByteTextBuf sAppStream; | 836 CFX_ByteTextBuf sAppStream; |
837 CFX_ByteString sColor; | 837 CFX_ByteString sColor; |
838 | 838 |
839 if (fWidth > 0.0f) { | 839 if (fWidth > 0.0f) { |
840 sAppStream << "q\n"; | 840 sAppStream << "q\n"; |
841 | 841 |
842 switch (nStyle) { | 842 switch (nStyle) { |
843 default: | 843 default: |
844 case PBS_SOLID: | 844 case BorderStyle::SOLID: |
845 case PBS_UNDERLINED: { | 845 case BorderStyle::UNDERLINE: { |
846 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 846 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); |
847 if (sColor.GetLength() > 0) { | 847 if (sColor.GetLength() > 0) { |
848 sAppStream << "q\n" << fWidth << " w\n" << sColor | 848 sAppStream << "q\n" << fWidth << " w\n" << sColor |
849 << CPWL_Utils::GetAP_Circle( | 849 << CPWL_Utils::GetAP_Circle( |
850 CPWL_Utils::DeflateRect(rect, fWidth / 2.0f)) | 850 CPWL_Utils::DeflateRect(rect, fWidth / 2.0f)) |
851 << " S\nQ\n"; | 851 << " S\nQ\n"; |
852 } | 852 } |
853 } break; | 853 } break; |
854 case PBS_DASH: { | 854 case BorderStyle::DASH: { |
855 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 855 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); |
856 if (sColor.GetLength() > 0) { | 856 if (sColor.GetLength() > 0) { |
857 sAppStream << "q\n" << fWidth << " w\n" | 857 sAppStream << "q\n" << fWidth << " w\n" |
858 << "[" << dash.nDash << " " << dash.nGap << "] " | 858 << "[" << dash.nDash << " " << dash.nGap << "] " |
859 << dash.nPhase << " d\n" << sColor | 859 << dash.nPhase << " d\n" << sColor |
860 << CPWL_Utils::GetAP_Circle( | 860 << CPWL_Utils::GetAP_Circle( |
861 CPWL_Utils::DeflateRect(rect, fWidth / 2.0f)) | 861 CPWL_Utils::DeflateRect(rect, fWidth / 2.0f)) |
862 << " S\nQ\n"; | 862 << " S\nQ\n"; |
863 } | 863 } |
864 } break; | 864 } break; |
865 case PBS_BEVELED: { | 865 case BorderStyle::BEVELED: { |
866 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 866 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
867 | 867 |
868 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 868 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); |
869 if (sColor.GetLength() > 0) { | 869 if (sColor.GetLength() > 0) { |
870 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor | 870 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor |
871 << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; | 871 << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; |
872 } | 872 } |
873 | 873 |
874 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, FALSE); | 874 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, FALSE); |
875 if (sColor.GetLength() > 0) { | 875 if (sColor.GetLength() > 0) { |
876 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor | 876 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor |
877 << CPWL_Utils::GetAP_HalfCircle( | 877 << CPWL_Utils::GetAP_HalfCircle( |
878 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), | 878 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), |
879 FX_PI / 4.0f) | 879 FX_PI / 4.0f) |
880 << " S\nQ\n"; | 880 << " S\nQ\n"; |
881 } | 881 } |
882 | 882 |
883 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, FALSE); | 883 sColor = CPWL_Utils::GetColorAppStream(crRightBottom, FALSE); |
884 if (sColor.GetLength() > 0) { | 884 if (sColor.GetLength() > 0) { |
885 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor | 885 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor |
886 << CPWL_Utils::GetAP_HalfCircle( | 886 << CPWL_Utils::GetAP_HalfCircle( |
887 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), | 887 CPWL_Utils::DeflateRect(rect, fHalfWidth * 0.75f), |
888 FX_PI * 5 / 4.0f) | 888 FX_PI * 5 / 4.0f) |
889 << " S\nQ\n"; | 889 << " S\nQ\n"; |
890 } | 890 } |
891 } break; | 891 } break; |
892 case PBS_INSET: { | 892 case BorderStyle::INSET: { |
893 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 893 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
894 | 894 |
895 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); | 895 sColor = CPWL_Utils::GetColorAppStream(color, FALSE); |
896 if (sColor.GetLength() > 0) { | 896 if (sColor.GetLength() > 0) { |
897 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor | 897 sAppStream << "q\n" << fHalfWidth << " w\n" << sColor |
898 << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; | 898 << CPWL_Utils::GetAP_Circle(rect) << " S\nQ\n"; |
899 } | 899 } |
900 | 900 |
901 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, FALSE); | 901 sColor = CPWL_Utils::GetColorAppStream(crLeftTop, FALSE); |
902 if (sColor.GetLength() > 0) { | 902 if (sColor.GetLength() > 0) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1071 if (!rcBBox.IsEmpty()) { | 1071 if (!rcBBox.IsEmpty()) { |
1072 sAppStream << "q\n" << CPWL_Utils::GetColorAppStream( | 1072 sAppStream << "q\n" << CPWL_Utils::GetColorAppStream( |
1073 CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, | 1073 CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, |
1074 220.0f / 255.0f, 220.0f / 255.0f), | 1074 220.0f / 255.0f, 220.0f / 255.0f), |
1075 TRUE); | 1075 TRUE); |
1076 sAppStream << rcBBox.left << " " << rcBBox.bottom << " " | 1076 sAppStream << rcBBox.left << " " << rcBBox.bottom << " " |
1077 << rcBBox.right - rcBBox.left << " " | 1077 << rcBBox.right - rcBBox.left << " " |
1078 << rcBBox.top - rcBBox.bottom << " re f\n"; | 1078 << rcBBox.top - rcBBox.bottom << " re f\n"; |
1079 sAppStream << "Q\n"; | 1079 sAppStream << "Q\n"; |
1080 | 1080 |
1081 sAppStream << "q\n" << CPWL_Utils::GetBorderAppStream( | 1081 sAppStream << "q\n" |
1082 rcBBox, 2, CPWL_Color(COLORTYPE_GRAY, 0), | 1082 << CPWL_Utils::GetBorderAppStream( |
1083 CPWL_Color(COLORTYPE_GRAY, 1), | 1083 rcBBox, 2, CPWL_Color(COLORTYPE_GRAY, 0), |
1084 CPWL_Color(COLORTYPE_GRAY, 0.5), PBS_BEVELED, | 1084 CPWL_Color(COLORTYPE_GRAY, 1), |
1085 CPWL_Dash(3, 0, 0)) | 1085 CPWL_Color(COLORTYPE_GRAY, 0.5), BorderStyle::BEVELED, |
1086 CPWL_Dash(3, 0, 0)) | |
1086 << "Q\n"; | 1087 << "Q\n"; |
1087 | 1088 |
1088 CFX_FloatPoint ptCenter = CFX_FloatPoint((rcBBox.left + rcBBox.right) / 2, | 1089 CFX_FloatPoint ptCenter = CFX_FloatPoint((rcBBox.left + rcBBox.right) / 2, |
1089 (rcBBox.top + rcBBox.bottom) / 2); | 1090 (rcBBox.top + rcBBox.bottom) / 2); |
1090 if (IsFloatBigger(rcBBox.right - rcBBox.left, 6) && | 1091 if (IsFloatBigger(rcBBox.right - rcBBox.left, 6) && |
1091 IsFloatBigger(rcBBox.top - rcBBox.bottom, 6)) { | 1092 IsFloatBigger(rcBBox.top - rcBBox.bottom, 6)) { |
1092 sAppStream << "q\n" | 1093 sAppStream << "q\n" |
1093 << " 0 g\n"; | 1094 << " 0 g\n"; |
1094 sAppStream << ptCenter.x - 3 << " " << ptCenter.y + 1.5f << " m\n"; | 1095 sAppStream << ptCenter.x - 3 << " " << ptCenter.y + 1.5f << " m\n"; |
1095 sAppStream << ptCenter.x + 3 << " " << ptCenter.y + 1.5f << " l\n"; | 1096 sAppStream << ptCenter.x + 3 << " " << ptCenter.y + 1.5f << " l\n"; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1315 } | 1316 } |
1316 } | 1317 } |
1317 | 1318 |
1318 void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, | 1319 void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, |
1319 CFX_Matrix* pUser2Device, | 1320 CFX_Matrix* pUser2Device, |
1320 const CFX_FloatRect& rect, | 1321 const CFX_FloatRect& rect, |
1321 FX_FLOAT fWidth, | 1322 FX_FLOAT fWidth, |
1322 const CPWL_Color& color, | 1323 const CPWL_Color& color, |
1323 const CPWL_Color& crLeftTop, | 1324 const CPWL_Color& crLeftTop, |
1324 const CPWL_Color& crRightBottom, | 1325 const CPWL_Color& crRightBottom, |
1325 int32_t nStyle, | 1326 BorderStyle nStyle, |
1326 int32_t nTransparancy) { | 1327 int32_t nTransparancy) { |
1327 FX_FLOAT fLeft = rect.left; | 1328 FX_FLOAT fLeft = rect.left; |
1328 FX_FLOAT fRight = rect.right; | 1329 FX_FLOAT fRight = rect.right; |
1329 FX_FLOAT fTop = rect.top; | 1330 FX_FLOAT fTop = rect.top; |
1330 FX_FLOAT fBottom = rect.bottom; | 1331 FX_FLOAT fBottom = rect.bottom; |
1331 | 1332 |
1332 if (fWidth > 0.0f) { | 1333 if (fWidth > 0.0f) { |
1333 FX_FLOAT fHalfWidth = fWidth / 2.0f; | 1334 FX_FLOAT fHalfWidth = fWidth / 2.0f; |
1334 | 1335 |
1335 switch (nStyle) { | 1336 switch (nStyle) { |
1336 default: | 1337 default: |
1337 case PBS_SOLID: { | 1338 case BorderStyle::SOLID: { |
1338 CFX_PathData path; | 1339 CFX_PathData path; |
1339 path.AppendRect(fLeft, fBottom, fRight, fTop); | 1340 path.AppendRect(fLeft, fBottom, fRight, fTop); |
1340 path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth, | 1341 path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth, |
1341 fTop - fWidth); | 1342 fTop - fWidth); |
1342 pDevice->DrawPath(&path, pUser2Device, NULL, | 1343 pDevice->DrawPath(&path, pUser2Device, NULL, |
1343 PWLColorToFXColor(color, nTransparancy), 0, | 1344 PWLColorToFXColor(color, nTransparancy), 0, |
1344 FXFILL_ALTERNATE); | 1345 FXFILL_ALTERNATE); |
1345 } break; | 1346 break; |
1346 case PBS_DASH: { | 1347 } |
1348 case BorderStyle::DASH: { | |
1347 CFX_PathData path; | 1349 CFX_PathData path; |
1348 | 1350 |
1349 path.SetPointCount(5); | 1351 path.SetPointCount(5); |
1350 path.SetPoint(0, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, | 1352 path.SetPoint(0, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, |
1351 FXPT_MOVETO); | 1353 FXPT_MOVETO); |
1352 path.SetPoint(1, fLeft + fWidth / 2.0f, fTop - fWidth / 2.0f, | 1354 path.SetPoint(1, fLeft + fWidth / 2.0f, fTop - fWidth / 2.0f, |
1353 FXPT_LINETO); | 1355 FXPT_LINETO); |
1354 path.SetPoint(2, fRight - fWidth / 2.0f, fTop - fWidth / 2.0f, | 1356 path.SetPoint(2, fRight - fWidth / 2.0f, fTop - fWidth / 2.0f, |
1355 FXPT_LINETO); | 1357 FXPT_LINETO); |
1356 path.SetPoint(3, fRight - fWidth / 2.0f, fBottom + fWidth / 2.0f, | 1358 path.SetPoint(3, fRight - fWidth / 2.0f, fBottom + fWidth / 2.0f, |
1357 FXPT_LINETO); | 1359 FXPT_LINETO); |
1358 path.SetPoint(4, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, | 1360 path.SetPoint(4, fLeft + fWidth / 2.0f, fBottom + fWidth / 2.0f, |
1359 FXPT_LINETO); | 1361 FXPT_LINETO); |
1360 | 1362 |
1361 CFX_GraphStateData gsd; | 1363 CFX_GraphStateData gsd; |
1362 gsd.SetDashCount(2); | 1364 gsd.SetDashCount(2); |
1363 gsd.m_DashArray[0] = 3.0f; | 1365 gsd.m_DashArray[0] = 3.0f; |
1364 gsd.m_DashArray[1] = 3.0f; | 1366 gsd.m_DashArray[1] = 3.0f; |
1365 gsd.m_DashPhase = 0; | 1367 gsd.m_DashPhase = 0; |
1366 | 1368 |
1367 gsd.m_LineWidth = fWidth; | 1369 gsd.m_LineWidth = fWidth; |
1368 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, | 1370 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, |
1369 PWLColorToFXColor(color, nTransparancy), | 1371 PWLColorToFXColor(color, nTransparancy), |
1370 FXFILL_WINDING); | 1372 FXFILL_WINDING); |
1371 } break; | 1373 break; |
1372 case PBS_BEVELED: | 1374 } |
1373 case PBS_INSET: { | 1375 case BorderStyle::BEVELED: |
1376 case BorderStyle::INSET: { | |
1374 CFX_GraphStateData gsd; | 1377 CFX_GraphStateData gsd; |
1375 gsd.m_LineWidth = fHalfWidth; | 1378 gsd.m_LineWidth = fHalfWidth; |
1376 | 1379 |
1377 CFX_PathData pathLT; | 1380 CFX_PathData pathLT; |
1378 | 1381 |
1379 pathLT.SetPointCount(7); | 1382 pathLT.SetPointCount(7); |
1380 pathLT.SetPoint(0, fLeft + fHalfWidth, fBottom + fHalfWidth, | 1383 pathLT.SetPoint(0, fLeft + fHalfWidth, fBottom + fHalfWidth, |
1381 FXPT_MOVETO); | 1384 FXPT_MOVETO); |
1382 pathLT.SetPoint(1, fLeft + fHalfWidth, fTop - fHalfWidth, FXPT_LINETO); | 1385 pathLT.SetPoint(1, fLeft + fHalfWidth, fTop - fHalfWidth, FXPT_LINETO); |
1383 pathLT.SetPoint(2, fRight - fHalfWidth, fTop - fHalfWidth, FXPT_LINETO); | 1386 pathLT.SetPoint(2, fRight - fHalfWidth, fTop - fHalfWidth, FXPT_LINETO); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1416 | 1419 |
1417 CFX_PathData path; | 1420 CFX_PathData path; |
1418 | 1421 |
1419 path.AppendRect(fLeft, fBottom, fRight, fTop); | 1422 path.AppendRect(fLeft, fBottom, fRight, fTop); |
1420 path.AppendRect(fLeft + fHalfWidth, fBottom + fHalfWidth, | 1423 path.AppendRect(fLeft + fHalfWidth, fBottom + fHalfWidth, |
1421 fRight - fHalfWidth, fTop - fHalfWidth); | 1424 fRight - fHalfWidth, fTop - fHalfWidth); |
1422 | 1425 |
1423 pDevice->DrawPath(&path, pUser2Device, &gsd, | 1426 pDevice->DrawPath(&path, pUser2Device, &gsd, |
1424 PWLColorToFXColor(color, nTransparancy), 0, | 1427 PWLColorToFXColor(color, nTransparancy), 0, |
1425 FXFILL_ALTERNATE); | 1428 FXFILL_ALTERNATE); |
1426 } break; | 1429 break; |
1427 case PBS_UNDERLINED: { | 1430 } |
1431 case BorderStyle::UNDERLINE: { | |
1428 CFX_PathData path; | 1432 CFX_PathData path; |
1429 | 1433 |
1430 path.SetPointCount(2); | 1434 path.SetPointCount(2); |
1431 path.SetPoint(0, fLeft, fBottom + fWidth / 2, FXPT_MOVETO); | 1435 path.SetPoint(0, fLeft, fBottom + fWidth / 2, FXPT_MOVETO); |
1432 path.SetPoint(1, fRight, fBottom + fWidth / 2, FXPT_LINETO); | 1436 path.SetPoint(1, fRight, fBottom + fWidth / 2, FXPT_LINETO); |
1433 | 1437 |
1434 CFX_GraphStateData gsd; | 1438 CFX_GraphStateData gsd; |
1435 gsd.m_LineWidth = fWidth; | 1439 gsd.m_LineWidth = fWidth; |
1436 | 1440 |
1437 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, | 1441 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, |
1438 PWLColorToFXColor(color, nTransparancy), | 1442 PWLColorToFXColor(color, nTransparancy), |
1439 FXFILL_ALTERNATE); | 1443 FXFILL_ALTERNATE); |
1440 } break; | 1444 break; |
1441 case PBS_SHADOW: { | 1445 } |
dsinclair
2016/05/16 18:04:24
We never assigned a value of _SHADOW, so removed.
| |
1442 CFX_PathData path; | |
1443 path.AppendRect(fLeft, fBottom, fRight, fTop); | |
1444 path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth, | |
1445 fTop - fWidth); | |
1446 pDevice->DrawPath(&path, pUser2Device, NULL, | |
1447 PWLColorToFXColor(color, nTransparancy / 2), 0, | |
1448 FXFILL_ALTERNATE); | |
1449 } break; | |
1450 } | 1446 } |
1451 } | 1447 } |
1452 } | 1448 } |
1453 | 1449 |
1454 FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { | 1450 FX_BOOL CPWL_Utils::IsBlackOrWhite(const CPWL_Color& color) { |
1455 switch (color.nColorType) { | 1451 switch (color.nColorType) { |
1456 case COLORTYPE_TRANSPARENT: | 1452 case COLORTYPE_TRANSPARENT: |
1457 return FALSE; | 1453 return FALSE; |
1458 case COLORTYPE_GRAY: | 1454 case COLORTYPE_GRAY: |
1459 return color.fColor1 < 0.5f; | 1455 return color.fColor1 < 0.5f; |
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3351 break; | 3347 break; |
3352 case COLORTYPE_RGB: | 3348 case COLORTYPE_RGB: |
3353 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, | 3349 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, |
3354 fColor1, fColor2, fColor3); | 3350 fColor1, fColor2, fColor3); |
3355 break; | 3351 break; |
3356 } | 3352 } |
3357 break; | 3353 break; |
3358 } | 3354 } |
3359 nColorType = other_nColorType; | 3355 nColorType = other_nColorType; |
3360 } | 3356 } |
OLD | NEW |