| 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 |
| 11 #include "core/fpdfdoc/include/cpvt_word.h" |
| 11 #include "core/include/fxge/fx_ge.h" | 12 #include "core/include/fxge/fx_ge.h" |
| 13 #include "fpdfsdk/include/fxedit/fx_edit.h" |
| 12 #include "fpdfsdk/pdfwindow/PWL_Icon.h" | 14 #include "fpdfsdk/pdfwindow/PWL_Icon.h" |
| 13 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 15 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
| 14 | 16 |
| 15 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) | 17 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) |
| 16 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) | 18 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) |
| 17 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) | 19 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) |
| 18 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) | 20 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) |
| 19 | 21 |
| 20 CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData, | 22 CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData, |
| 21 int32_t nCount) { | 23 int32_t nCount) { |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 bLatinWord = FALSE; | 570 bLatinWord = FALSE; |
| 569 sWord.Empty(); | 571 sWord.Empty(); |
| 570 } | 572 } |
| 571 } | 573 } |
| 572 } | 574 } |
| 573 | 575 |
| 574 return sRet.GetByteString(); | 576 return sRet.GetByteString(); |
| 575 } | 577 } |
| 576 | 578 |
| 577 CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, | 579 CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, |
| 578 IFX_Edit_FontMap* pFontMap, | 580 IPVT_FontMap* pFontMap, |
| 579 const CFX_WideString& sText, | 581 const CFX_WideString& sText, |
| 580 int32_t nAlignmentH, | 582 int32_t nAlignmentH, |
| 581 int32_t nAlignmentV, | 583 int32_t nAlignmentV, |
| 582 FX_FLOAT fFontSize, | 584 FX_FLOAT fFontSize, |
| 583 FX_BOOL bMultiLine, | 585 FX_BOOL bMultiLine, |
| 584 FX_BOOL bAutoReturn, | 586 FX_BOOL bAutoReturn, |
| 585 const CPWL_Color& crText) { | 587 const CPWL_Color& crText) { |
| 586 CFX_ByteTextBuf sRet; | 588 CFX_ByteTextBuf sRet; |
| 587 | 589 |
| 588 if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { | 590 if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 606 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit | 608 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit |
| 607 << "ET\n"; | 609 << "ET\n"; |
| 608 } | 610 } |
| 609 IFX_Edit::DelEdit(pEdit); | 611 IFX_Edit::DelEdit(pEdit); |
| 610 } | 612 } |
| 611 | 613 |
| 612 return sRet.GetByteString(); | 614 return sRet.GetByteString(); |
| 613 } | 615 } |
| 614 | 616 |
| 615 CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, | 617 CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, |
| 616 IFX_Edit_FontMap* pFontMap, | 618 IPVT_FontMap* pFontMap, |
| 617 CPDF_Stream* pIconStream, | 619 CPDF_Stream* pIconStream, |
| 618 CPDF_IconFit& IconFit, | 620 CPDF_IconFit& IconFit, |
| 619 const CFX_WideString& sLabel, | 621 const CFX_WideString& sLabel, |
| 620 const CPWL_Color& crText, | 622 const CPWL_Color& crText, |
| 621 FX_FLOAT fFontSize, | 623 FX_FLOAT fFontSize, |
| 622 int32_t nLayOut) { | 624 int32_t nLayOut) { |
| 623 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; | 625 const FX_FLOAT fAutoFontScale = 1.0f / 3.0f; |
| 624 | 626 |
| 625 if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { | 627 if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) { |
| 626 pEdit->SetFontMap(pFontMap); | 628 pEdit->SetFontMap(pFontMap); |
| (...skipping 3046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3673 break; | 3675 break; |
| 3674 case COLORTYPE_RGB: | 3676 case COLORTYPE_RGB: |
| 3675 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, | 3677 CPWL_Utils::ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4, |
| 3676 fColor1, fColor2, fColor3); | 3678 fColor1, fColor2, fColor3); |
| 3677 break; | 3679 break; |
| 3678 } | 3680 } |
| 3679 break; | 3681 break; |
| 3680 } | 3682 } |
| 3681 nColorType = other_nColorType; | 3683 nColorType = other_nColorType; |
| 3682 } | 3684 } |
| OLD | NEW |