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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 GetRectWithoutRotate(rtBorder); | 114 GetRectWithoutRotate(rtBorder); |
115 CXFA_Margin margin = border.GetMargin(); | 115 CXFA_Margin margin = border.GetMargin(); |
116 if (margin) { | 116 if (margin) { |
117 XFA_RectWidthoutMargin(rtBorder, margin); | 117 XFA_RectWidthoutMargin(rtBorder, margin); |
118 } | 118 } |
119 rtBorder.Normalize(); | 119 rtBorder.Normalize(); |
120 DrawBorder(pGS, border, rtBorder, pMatrix); | 120 DrawBorder(pGS, border, rtBorder, pMatrix); |
121 } | 121 } |
122 } | 122 } |
123 FX_BOOL CXFA_FFWidget::IsLoaded() { | 123 FX_BOOL CXFA_FFWidget::IsLoaded() { |
124 return m_pPageView != NULL; | 124 return !!m_pPageView; |
125 } | 125 } |
126 FX_BOOL CXFA_FFWidget::LoadWidget() { | 126 FX_BOOL CXFA_FFWidget::LoadWidget() { |
127 PerformLayout(); | 127 PerformLayout(); |
128 return TRUE; | 128 return TRUE; |
129 } | 129 } |
130 void CXFA_FFWidget::UnloadWidget() {} | 130 void CXFA_FFWidget::UnloadWidget() {} |
131 FX_BOOL CXFA_FFWidget::PerformLayout() { | 131 FX_BOOL CXFA_FFWidget::PerformLayout() { |
132 ReCacheWidgetRect(); | 132 ReCacheWidgetRect(); |
133 return TRUE; | 133 return TRUE; |
134 } | 134 } |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 GetRectWithoutRotate(rtLayout); | 340 GetRectWithoutRotate(rtLayout); |
341 return rtLayout.width < 0.1f && rtLayout.height < 0.1f; | 341 return rtLayout.width < 0.1f && rtLayout.height < 0.1f; |
342 } | 342 } |
343 CXFA_FFWidget* CXFA_FFWidget::GetParent() { | 343 CXFA_FFWidget* CXFA_FFWidget::GetParent() { |
344 CXFA_Node* pParentNode = | 344 CXFA_Node* pParentNode = |
345 m_pDataAcc->GetNode()->GetNodeItem(XFA_NODEITEM_Parent); | 345 m_pDataAcc->GetNode()->GetNodeItem(XFA_NODEITEM_Parent); |
346 if (pParentNode) { | 346 if (pParentNode) { |
347 CXFA_WidgetAcc* pParentWidgetAcc = | 347 CXFA_WidgetAcc* pParentWidgetAcc = |
348 (CXFA_WidgetAcc*)pParentNode->GetWidgetData(); | 348 (CXFA_WidgetAcc*)pParentNode->GetWidgetData(); |
349 if (pParentWidgetAcc) { | 349 if (pParentWidgetAcc) { |
350 return pParentWidgetAcc->GetNextWidget(NULL); | 350 return pParentWidgetAcc->GetNextWidget(nullptr); |
351 } | 351 } |
352 } | 352 } |
353 return NULL; | 353 return nullptr; |
354 } | 354 } |
355 FX_BOOL CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) { | 355 FX_BOOL CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) { |
356 if (!pWidget) { | 356 if (!pWidget) { |
357 return FALSE; | 357 return FALSE; |
358 } | 358 } |
359 CXFA_Node* pNode = m_pDataAcc->GetNode(); | 359 CXFA_Node* pNode = m_pDataAcc->GetNode(); |
360 CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode(); | 360 CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode(); |
361 while (pChildNode) { | 361 while (pChildNode) { |
362 if (pChildNode == pNode) { | 362 if (pChildNode == pNode) { |
363 return TRUE; | 363 return TRUE; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 FX_BOOL StartDIBSource(); | 516 FX_BOOL StartDIBSource(); |
517 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, | 517 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, |
518 int left, | 518 int left, |
519 int top, | 519 int top, |
520 FX_ARGB mask_argb, | 520 FX_ARGB mask_argb, |
521 int bitmap_alpha, | 521 int bitmap_alpha, |
522 int blend_mode, | 522 int blend_mode, |
523 int Transparency); | 523 int Transparency); |
524 }; | 524 }; |
525 CXFA_ImageRenderer::CXFA_ImageRenderer() { | 525 CXFA_ImageRenderer::CXFA_ImageRenderer() { |
526 m_pDevice = NULL; | 526 m_pDevice = nullptr; |
527 m_Status = 0; | 527 m_Status = 0; |
528 m_pDIBSource = NULL; | 528 m_pDIBSource = nullptr; |
529 m_pCloneConvert = NULL; | 529 m_pCloneConvert = nullptr; |
530 m_BitmapAlpha = 255; | 530 m_BitmapAlpha = 255; |
531 m_FillArgb = 0; | 531 m_FillArgb = 0; |
532 m_Flags = 0; | 532 m_Flags = 0; |
533 m_DeviceHandle = NULL; | 533 m_DeviceHandle = nullptr; |
534 m_BlendType = FXDIB_BLEND_NORMAL; | 534 m_BlendType = FXDIB_BLEND_NORMAL; |
535 m_Result = TRUE; | 535 m_Result = TRUE; |
536 m_bPrint = FALSE; | 536 m_bPrint = FALSE; |
537 } | 537 } |
538 | 538 |
539 CXFA_ImageRenderer::~CXFA_ImageRenderer() { | 539 CXFA_ImageRenderer::~CXFA_ImageRenderer() { |
540 delete m_pCloneConvert; | 540 delete m_pCloneConvert; |
541 if (m_DeviceHandle) | 541 if (m_DeviceHandle) |
542 m_pDevice->CancelDIBits(m_DeviceHandle); | 542 m_pDevice->CancelDIBits(m_DeviceHandle); |
543 } | 543 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 return FALSE; | 673 return FALSE; |
674 } | 674 } |
675 | 675 |
676 void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, | 676 void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, |
677 int left, | 677 int left, |
678 int top, | 678 int top, |
679 FX_ARGB mask_argb, | 679 FX_ARGB mask_argb, |
680 int bitmap_alpha, | 680 int bitmap_alpha, |
681 int blend_mode, | 681 int blend_mode, |
682 int Transparency) { | 682 int Transparency) { |
683 if (pDIBitmap == NULL) { | 683 if (!pDIBitmap) |
684 return; | 684 return; |
685 } | 685 |
686 bool bIsolated = !!(Transparency & PDFTRANS_ISOLATED); | 686 bool bIsolated = !!(Transparency & PDFTRANS_ISOLATED); |
687 bool bGroup = !!(Transparency & PDFTRANS_GROUP); | 687 bool bGroup = !!(Transparency & PDFTRANS_GROUP); |
688 if (blend_mode == FXDIB_BLEND_NORMAL) { | 688 if (blend_mode == FXDIB_BLEND_NORMAL) { |
689 if (!pDIBitmap->IsAlphaMask()) { | 689 if (!pDIBitmap->IsAlphaMask()) { |
690 if (bitmap_alpha < 255) { | 690 if (bitmap_alpha < 255) { |
691 pDIBitmap->MultiplyAlpha(bitmap_alpha); | 691 pDIBitmap->MultiplyAlpha(bitmap_alpha); |
692 } | 692 } |
693 if (m_pDevice->SetDIBits(pDIBitmap, left, top)) { | 693 if (m_pDevice->SetDIBits(pDIBitmap, left, top)) { |
694 return; | 694 return; |
695 } | 695 } |
(...skipping 16 matching lines...) Expand all Loading... |
712 if (bGetBackGround) { | 712 if (bGetBackGround) { |
713 if (bIsolated || !bGroup) { | 713 if (bIsolated || !bGroup) { |
714 if (pDIBitmap->IsAlphaMask()) { | 714 if (pDIBitmap->IsAlphaMask()) { |
715 return; | 715 return; |
716 } | 716 } |
717 m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, blend_mode); | 717 m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, blend_mode); |
718 } else { | 718 } else { |
719 FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), | 719 FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), |
720 top + pDIBitmap->GetHeight()); | 720 top + pDIBitmap->GetHeight()); |
721 rect.Intersect(m_pDevice->GetClipBox()); | 721 rect.Intersect(m_pDevice->GetClipBox()); |
722 CFX_DIBitmap* pClone = NULL; | 722 CFX_DIBitmap* pClone = nullptr; |
723 FX_BOOL bClone = FALSE; | 723 FX_BOOL bClone = FALSE; |
724 if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { | 724 if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { |
725 bClone = TRUE; | 725 bClone = TRUE; |
726 pClone = m_pDevice->GetBackDrop()->Clone(&rect); | 726 pClone = m_pDevice->GetBackDrop()->Clone(&rect); |
727 CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap(); | 727 CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap(); |
728 pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), | 728 pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), |
729 pForeBitmap, rect.left, rect.top); | 729 pForeBitmap, rect.left, rect.top); |
730 left = left >= 0 ? 0 : left; | 730 left = left >= 0 ? 0 : left; |
731 top = top >= 0 ? 0 : top; | 731 top = top >= 0 ? 0 : top; |
732 if (!pDIBitmap->IsAlphaMask()) | 732 if (!pDIBitmap->IsAlphaMask()) |
(...skipping 22 matching lines...) Expand all Loading... |
755 if (pDIBitmap->HasAlpha() && | 755 if (pDIBitmap->HasAlpha() && |
756 !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) { | 756 !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) { |
757 CFX_DIBitmap* pCloneConvert = pDIBitmap->CloneConvert(FXDIB_Rgb); | 757 CFX_DIBitmap* pCloneConvert = pDIBitmap->CloneConvert(FXDIB_Rgb); |
758 if (!pCloneConvert) { | 758 if (!pCloneConvert) { |
759 return; | 759 return; |
760 } | 760 } |
761 CXFA_ImageRenderer imageRender; | 761 CXFA_ImageRenderer imageRender; |
762 FX_BOOL bRet = imageRender.Start(m_pDevice, pCloneConvert, m_FillArgb, | 762 FX_BOOL bRet = imageRender.Start(m_pDevice, pCloneConvert, m_FillArgb, |
763 m_BitmapAlpha, &m_ImageMatrix, m_Flags); | 763 m_BitmapAlpha, &m_ImageMatrix, m_Flags); |
764 while (bRet) { | 764 while (bRet) { |
765 bRet = imageRender.Continue(NULL); | 765 bRet = imageRender.Continue(nullptr); |
766 } | 766 } |
767 delete pCloneConvert; | 767 delete pCloneConvert; |
768 return; | 768 return; |
769 } | 769 } |
770 } | 770 } |
771 void XFA_DrawImage(CFX_Graphics* pGS, | 771 void XFA_DrawImage(CFX_Graphics* pGS, |
772 const CFX_RectF& rtImage, | 772 const CFX_RectF& rtImage, |
773 CFX_Matrix* pMatrix, | 773 CFX_Matrix* pMatrix, |
774 CFX_DIBitmap* pDIBitmap, | 774 CFX_DIBitmap* pDIBitmap, |
775 int32_t iAspect, | 775 int32_t iAspect, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 CFX_PathData path; | 829 CFX_PathData path; |
830 path.AppendRect(rtImage.left, rtImage.bottom(), rtImage.right(), rtImage.top); | 830 path.AppendRect(rtImage.left, rtImage.bottom(), rtImage.right(), rtImage.top); |
831 pRenderDevice->SetClip_PathFill(&path, pMatrix, FXFILL_WINDING); | 831 pRenderDevice->SetClip_PathFill(&path, pMatrix, FXFILL_WINDING); |
832 CFX_Matrix mtImage(1, 0, 0, -1, 0, 1); | 832 CFX_Matrix mtImage(1, 0, 0, -1, 0, 1); |
833 mtImage.Concat(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top); | 833 mtImage.Concat(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top); |
834 mtImage.Concat(*pMatrix); | 834 mtImage.Concat(*pMatrix); |
835 CXFA_ImageRenderer imageRender; | 835 CXFA_ImageRenderer imageRender; |
836 FX_BOOL bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage, | 836 FX_BOOL bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage, |
837 FXDIB_INTERPOL); | 837 FXDIB_INTERPOL); |
838 while (bRet) { | 838 while (bRet) { |
839 bRet = imageRender.Continue(NULL); | 839 bRet = imageRender.Continue(nullptr); |
840 } | 840 } |
841 pRenderDevice->RestoreState(false); | 841 pRenderDevice->RestoreState(false); |
842 } | 842 } |
843 | 843 |
844 static const uint8_t g_inv_base64[128] = { | 844 static const uint8_t g_inv_base64[128] = { |
845 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, | 845 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, |
846 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, | 846 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, |
847 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, | 847 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, |
848 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, | 848 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, |
849 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, | 849 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, |
(...skipping 14 matching lines...) Expand all Loading... |
864 if ((pStr[i] & 128) == 0) { | 864 if ((pStr[i] & 128) == 0) { |
865 if (g_inv_base64[pStr[i]] != 0xFF || pStr[i] == '=') { | 865 if (g_inv_base64[pStr[i]] != 0xFF || pStr[i] == '=') { |
866 pCP[j++] = pStr[i]; | 866 pCP[j++] = pStr[i]; |
867 } | 867 } |
868 } | 868 } |
869 } | 869 } |
870 pCP[j] = '\0'; | 870 pCP[j] = '\0'; |
871 return pCP; | 871 return pCP; |
872 } | 872 } |
873 static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) { | 873 static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) { |
874 if (pStr == NULL) { | 874 if (!pStr) |
875 return 0; | 875 return 0; |
876 } | 876 |
877 uint8_t* pBuffer = | 877 uint8_t* pBuffer = |
878 XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr)); | 878 XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr)); |
879 if (pBuffer == NULL) { | 879 if (!pBuffer) |
880 return 0; | 880 return 0; |
881 } | 881 |
882 int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer); | 882 int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer); |
883 int32_t i = 0, j = 0; | 883 int32_t i = 0, j = 0; |
884 uint32_t dwLimb = 0; | 884 uint32_t dwLimb = 0; |
885 for (; i + 3 < iLen; i += 4) { | 885 for (; i + 3 < iLen; i += 4) { |
886 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=' || pBuffer[i + 2] == '=' || | 886 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=' || pBuffer[i + 2] == '=' || |
887 pBuffer[i + 3] == '=') { | 887 pBuffer[i + 3] == '=') { |
888 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=') { | 888 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=') { |
889 break; | 889 break; |
890 } | 890 } |
891 if (pBuffer[i + 2] == '=') { | 891 if (pBuffer[i + 2] == '=') { |
(...skipping 21 matching lines...) Expand all Loading... |
913 } | 913 } |
914 } | 914 } |
915 FX_Free(pBuffer); | 915 FX_Free(pBuffer); |
916 return j; | 916 return j; |
917 } | 917 } |
918 | 918 |
919 static const FX_CHAR g_base64_chars[] = | 919 static const FX_CHAR g_base64_chars[] = |
920 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | 920 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
921 | 921 |
922 FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { | 922 FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { |
923 FX_CHAR* out = NULL; | 923 FX_CHAR* out = nullptr; |
924 int i, j; | 924 int i, j; |
925 uint32_t limb; | 925 uint32_t limb; |
926 out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5); | 926 out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5); |
927 for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) { | 927 for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) { |
928 limb = ((uint32_t)buf[i] << 16) | ((uint32_t)buf[i + 1] << 8) | | 928 limb = ((uint32_t)buf[i] << 16) | ((uint32_t)buf[i + 1] << 8) | |
929 ((uint32_t)buf[i + 2]); | 929 ((uint32_t)buf[i + 2]); |
930 out[j] = g_base64_chars[(limb >> 18) & 63]; | 930 out[j] = g_base64_chars[(limb >> 18) & 63]; |
931 out[j + 1] = g_base64_chars[(limb >> 12) & 63]; | 931 out[j + 1] = g_base64_chars[(limb >> 12) & 63]; |
932 out[j + 2] = g_base64_chars[(limb >> 6) & 63]; | 932 out[j + 2] = g_base64_chars[(limb >> 6) & 63]; |
933 out[j + 3] = g_base64_chars[(limb)&63]; | 933 out[j + 3] = g_base64_chars[(limb)&63]; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, | 978 CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, |
979 CXFA_Image* pImage, | 979 CXFA_Image* pImage, |
980 FX_BOOL& bNameImage, | 980 FX_BOOL& bNameImage, |
981 int32_t& iImageXDpi, | 981 int32_t& iImageXDpi, |
982 int32_t& iImageYDpi) { | 982 int32_t& iImageYDpi) { |
983 CFX_WideString wsHref; | 983 CFX_WideString wsHref; |
984 pImage->GetHref(wsHref); | 984 pImage->GetHref(wsHref); |
985 CFX_WideString wsImage; | 985 CFX_WideString wsImage; |
986 pImage->GetContent(wsImage); | 986 pImage->GetContent(wsImage); |
987 if (wsHref.IsEmpty() && wsImage.IsEmpty()) { | 987 if (wsHref.IsEmpty() && wsImage.IsEmpty()) { |
988 return NULL; | 988 return nullptr; |
989 } | 989 } |
990 CFX_WideString wsContentType; | 990 CFX_WideString wsContentType; |
991 pImage->GetContentType(wsContentType); | 991 pImage->GetContentType(wsContentType); |
992 FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType); | 992 FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType); |
993 CFX_ByteString bsContent; | 993 CFX_ByteString bsContent; |
994 uint8_t* pImageBuffer = NULL; | 994 uint8_t* pImageBuffer = nullptr; |
995 IFX_FileRead* pImageFileRead = NULL; | 995 IFX_FileRead* pImageFileRead = nullptr; |
996 if (wsImage.GetLength() > 0) { | 996 if (wsImage.GetLength() > 0) { |
997 XFA_ATTRIBUTEENUM iEncoding = | 997 XFA_ATTRIBUTEENUM iEncoding = |
998 (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding(); | 998 (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding(); |
999 if (iEncoding == XFA_ATTRIBUTEENUM_Base64) { | 999 if (iEncoding == XFA_ATTRIBUTEENUM_Base64) { |
1000 CFX_ByteString bsData = wsImage.UTF8Encode(); | 1000 CFX_ByteString bsData = wsImage.UTF8Encode(); |
1001 int32_t iLength = bsData.GetLength(); | 1001 int32_t iLength = bsData.GetLength(); |
1002 pImageBuffer = FX_Alloc(uint8_t, iLength); | 1002 pImageBuffer = FX_Alloc(uint8_t, iLength); |
1003 int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer); | 1003 int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer); |
1004 if (iRead > 0) { | 1004 if (iRead > 0) { |
1005 pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead); | 1005 pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead); |
(...skipping 11 matching lines...) Expand all Loading... |
1017 pDoc->GetPDFNamedImage(wsURL.AsStringC(), iImageXDpi, iImageYDpi); | 1017 pDoc->GetPDFNamedImage(wsURL.AsStringC(), iImageXDpi, iImageYDpi); |
1018 if (pBitmap) { | 1018 if (pBitmap) { |
1019 bNameImage = TRUE; | 1019 bNameImage = TRUE; |
1020 return pBitmap; | 1020 return pBitmap; |
1021 } | 1021 } |
1022 } | 1022 } |
1023 pImageFileRead = pDoc->GetDocProvider()->OpenLinkedFile(pDoc, wsURL); | 1023 pImageFileRead = pDoc->GetDocProvider()->OpenLinkedFile(pDoc, wsURL); |
1024 } | 1024 } |
1025 if (!pImageFileRead) { | 1025 if (!pImageFileRead) { |
1026 FX_Free(pImageBuffer); | 1026 FX_Free(pImageBuffer); |
1027 return NULL; | 1027 return nullptr; |
1028 } | 1028 } |
1029 bNameImage = FALSE; | 1029 bNameImage = FALSE; |
1030 CFX_DIBitmap* pBitmap = | 1030 CFX_DIBitmap* pBitmap = |
1031 XFA_LoadImageFromBuffer(pImageFileRead, type, iImageXDpi, iImageYDpi); | 1031 XFA_LoadImageFromBuffer(pImageFileRead, type, iImageXDpi, iImageYDpi); |
1032 FX_Free(pImageBuffer); | 1032 FX_Free(pImageBuffer); |
1033 pImageFileRead->Release(); | 1033 pImageFileRead->Release(); |
1034 return pBitmap; | 1034 return pBitmap; |
1035 } | 1035 } |
1036 static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type, | 1036 static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type, |
1037 int32_t iComponents, | 1037 int32_t iComponents, |
(...skipping 14 matching lines...) Expand all Loading... |
1052 break; | 1052 break; |
1053 } | 1053 } |
1054 return dibFormat; | 1054 return dibFormat; |
1055 } | 1055 } |
1056 CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead, | 1056 CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead, |
1057 FXCODEC_IMAGE_TYPE type, | 1057 FXCODEC_IMAGE_TYPE type, |
1058 int32_t& iImageXDpi, | 1058 int32_t& iImageXDpi, |
1059 int32_t& iImageYDpi) { | 1059 int32_t& iImageYDpi) { |
1060 CFX_GEModule* pGeModule = CFX_GEModule::Get(); | 1060 CFX_GEModule* pGeModule = CFX_GEModule::Get(); |
1061 if (!pGeModule) { | 1061 if (!pGeModule) { |
1062 return NULL; | 1062 return nullptr; |
1063 } | 1063 } |
1064 CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); | 1064 CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); |
1065 if (!pCodecMgr) { | 1065 if (!pCodecMgr) { |
1066 return NULL; | 1066 return nullptr; |
1067 } | 1067 } |
1068 CFX_DIBAttribute dibAttr; | 1068 CFX_DIBAttribute dibAttr; |
1069 CFX_DIBitmap* pBitmap = NULL; | 1069 CFX_DIBitmap* pBitmap = nullptr; |
1070 CCodec_ProgressiveDecoder* pProgressiveDecoder = | 1070 CCodec_ProgressiveDecoder* pProgressiveDecoder = |
1071 pCodecMgr->CreateProgressiveDecoder(); | 1071 pCodecMgr->CreateProgressiveDecoder(); |
1072 pProgressiveDecoder->LoadImageInfo(pImageFileRead, type, &dibAttr); | 1072 pProgressiveDecoder->LoadImageInfo(pImageFileRead, type, &dibAttr); |
1073 switch (dibAttr.m_wDPIUnit) { | 1073 switch (dibAttr.m_wDPIUnit) { |
1074 case FXCODEC_RESUNIT_CENTIMETER: | 1074 case FXCODEC_RESUNIT_CENTIMETER: |
1075 dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI * 2.54f); | 1075 dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI * 2.54f); |
1076 dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI * 2.54f); | 1076 dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI * 2.54f); |
1077 break; | 1077 break; |
1078 case FXCODEC_RESUNIT_METER: | 1078 case FXCODEC_RESUNIT_METER: |
1079 dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI / (FX_FLOAT)100 * 2.54f); | 1079 dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI / (FX_FLOAT)100 * 2.54f); |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1977 iType != XFA_ELEMENT_Rectangle) { | 1977 iType != XFA_ELEMENT_Rectangle) { |
1978 return; | 1978 return; |
1979 } | 1979 } |
1980 CXFA_StrokeArray strokes; | 1980 CXFA_StrokeArray strokes; |
1981 if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) { | 1981 if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) { |
1982 box.GetStrokes(strokes); | 1982 box.GetStrokes(strokes); |
1983 } | 1983 } |
1984 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 1984 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); |
1985 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 1985 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); |
1986 } | 1986 } |
OLD | NEW |