Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Side by Side Diff: xfa/fxfa/app/xfa_ffwidget.cpp

Issue 2095653002: Remove NULL in xfa/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/app/xfa_fftextedit.cpp ('k') | xfa/fxfa/app/xfa_ffwidgetacc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 GetRectWithoutRotate(rtBorder); 116 GetRectWithoutRotate(rtBorder);
117 CXFA_Margin margin = border.GetMargin(); 117 CXFA_Margin margin = border.GetMargin();
118 if (margin) { 118 if (margin) {
119 XFA_RectWidthoutMargin(rtBorder, margin); 119 XFA_RectWidthoutMargin(rtBorder, margin);
120 } 120 }
121 rtBorder.Normalize(); 121 rtBorder.Normalize();
122 DrawBorder(pGS, border, rtBorder, pMatrix); 122 DrawBorder(pGS, border, rtBorder, pMatrix);
123 } 123 }
124 } 124 }
125 FX_BOOL CXFA_FFWidget::IsLoaded() { 125 FX_BOOL CXFA_FFWidget::IsLoaded() {
126 return m_pPageView != NULL; 126 return !!m_pPageView;
127 } 127 }
128 FX_BOOL CXFA_FFWidget::LoadWidget() { 128 FX_BOOL CXFA_FFWidget::LoadWidget() {
129 PerformLayout(); 129 PerformLayout();
130 return TRUE; 130 return TRUE;
131 } 131 }
132 void CXFA_FFWidget::UnloadWidget() {} 132 void CXFA_FFWidget::UnloadWidget() {}
133 FX_BOOL CXFA_FFWidget::PerformLayout() { 133 FX_BOOL CXFA_FFWidget::PerformLayout() {
134 ReCacheWidgetRect(); 134 ReCacheWidgetRect();
135 return TRUE; 135 return TRUE;
136 } 136 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 GetRectWithoutRotate(rtLayout); 398 GetRectWithoutRotate(rtLayout);
399 return rtLayout.width < 0.1f && rtLayout.height < 0.1f; 399 return rtLayout.width < 0.1f && rtLayout.height < 0.1f;
400 } 400 }
401 CXFA_FFWidget* CXFA_FFWidget::GetParent() { 401 CXFA_FFWidget* CXFA_FFWidget::GetParent() {
402 CXFA_Node* pParentNode = 402 CXFA_Node* pParentNode =
403 m_pDataAcc->GetNode()->GetNodeItem(XFA_NODEITEM_Parent); 403 m_pDataAcc->GetNode()->GetNodeItem(XFA_NODEITEM_Parent);
404 if (pParentNode) { 404 if (pParentNode) {
405 CXFA_WidgetAcc* pParentWidgetAcc = 405 CXFA_WidgetAcc* pParentWidgetAcc =
406 static_cast<CXFA_WidgetAcc*>(pParentNode->GetWidgetData()); 406 static_cast<CXFA_WidgetAcc*>(pParentNode->GetWidgetData());
407 if (pParentWidgetAcc) { 407 if (pParentWidgetAcc) {
408 return pParentWidgetAcc->GetNextWidget(NULL); 408 return pParentWidgetAcc->GetNextWidget(nullptr);
409 } 409 }
410 } 410 }
411 return NULL; 411 return nullptr;
412 } 412 }
413 FX_BOOL CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) { 413 FX_BOOL CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) {
414 if (!pWidget) { 414 if (!pWidget) {
415 return FALSE; 415 return FALSE;
416 } 416 }
417 CXFA_Node* pNode = m_pDataAcc->GetNode(); 417 CXFA_Node* pNode = m_pDataAcc->GetNode();
418 CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode(); 418 CXFA_Node* pChildNode = pWidget->GetDataAcc()->GetNode();
419 while (pChildNode) { 419 while (pChildNode) {
420 if (pChildNode == pNode) { 420 if (pChildNode == pNode) {
421 return TRUE; 421 return TRUE;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 FX_BOOL StartDIBSource(); 577 FX_BOOL StartDIBSource();
578 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, 578 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
579 int left, 579 int left,
580 int top, 580 int top,
581 FX_ARGB mask_argb, 581 FX_ARGB mask_argb,
582 int bitmap_alpha, 582 int bitmap_alpha,
583 int blend_mode, 583 int blend_mode,
584 int Transparency); 584 int Transparency);
585 }; 585 };
586 CXFA_ImageRenderer::CXFA_ImageRenderer() { 586 CXFA_ImageRenderer::CXFA_ImageRenderer() {
587 m_pDevice = NULL; 587 m_pDevice = nullptr;
588 m_Status = 0; 588 m_Status = 0;
589 m_pDIBSource = NULL; 589 m_pDIBSource = nullptr;
590 m_pCloneConvert = NULL; 590 m_pCloneConvert = nullptr;
591 m_BitmapAlpha = 255; 591 m_BitmapAlpha = 255;
592 m_FillArgb = 0; 592 m_FillArgb = 0;
593 m_Flags = 0; 593 m_Flags = 0;
594 m_DeviceHandle = NULL; 594 m_DeviceHandle = nullptr;
595 m_BlendType = FXDIB_BLEND_NORMAL; 595 m_BlendType = FXDIB_BLEND_NORMAL;
596 m_Result = TRUE; 596 m_Result = TRUE;
597 m_bPrint = FALSE; 597 m_bPrint = FALSE;
598 } 598 }
599 599
600 CXFA_ImageRenderer::~CXFA_ImageRenderer() { 600 CXFA_ImageRenderer::~CXFA_ImageRenderer() {
601 delete m_pCloneConvert; 601 delete m_pCloneConvert;
602 if (m_DeviceHandle) 602 if (m_DeviceHandle)
603 m_pDevice->CancelDIBits(m_DeviceHandle); 603 m_pDevice->CancelDIBits(m_DeviceHandle);
604 } 604 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 return FALSE; 734 return FALSE;
735 } 735 }
736 736
737 void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, 737 void CXFA_ImageRenderer::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
738 int left, 738 int left,
739 int top, 739 int top,
740 FX_ARGB mask_argb, 740 FX_ARGB mask_argb,
741 int bitmap_alpha, 741 int bitmap_alpha,
742 int blend_mode, 742 int blend_mode,
743 int Transparency) { 743 int Transparency) {
744 if (pDIBitmap == NULL) { 744 if (!pDIBitmap) {
745 return; 745 return;
746 } 746 }
747 bool bIsolated = !!(Transparency & PDFTRANS_ISOLATED); 747 bool bIsolated = !!(Transparency & PDFTRANS_ISOLATED);
748 bool bGroup = !!(Transparency & PDFTRANS_GROUP); 748 bool bGroup = !!(Transparency & PDFTRANS_GROUP);
749 if (blend_mode == FXDIB_BLEND_NORMAL) { 749 if (blend_mode == FXDIB_BLEND_NORMAL) {
750 if (!pDIBitmap->IsAlphaMask()) { 750 if (!pDIBitmap->IsAlphaMask()) {
751 if (bitmap_alpha < 255) { 751 if (bitmap_alpha < 255) {
752 pDIBitmap->MultiplyAlpha(bitmap_alpha); 752 pDIBitmap->MultiplyAlpha(bitmap_alpha);
753 } 753 }
754 if (m_pDevice->SetDIBits(pDIBitmap, left, top)) { 754 if (m_pDevice->SetDIBits(pDIBitmap, left, top)) {
(...skipping 18 matching lines...) Expand all
773 if (bGetBackGround) { 773 if (bGetBackGround) {
774 if (bIsolated || !bGroup) { 774 if (bIsolated || !bGroup) {
775 if (pDIBitmap->IsAlphaMask()) { 775 if (pDIBitmap->IsAlphaMask()) {
776 return; 776 return;
777 } 777 }
778 m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, blend_mode); 778 m_pDevice->SetDIBitsWithBlend(pDIBitmap, left, top, blend_mode);
779 } else { 779 } else {
780 FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), 780 FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
781 top + pDIBitmap->GetHeight()); 781 top + pDIBitmap->GetHeight());
782 rect.Intersect(m_pDevice->GetClipBox()); 782 rect.Intersect(m_pDevice->GetClipBox());
783 CFX_DIBitmap* pClone = NULL; 783 CFX_DIBitmap* pClone = nullptr;
784 FX_BOOL bClone = FALSE; 784 FX_BOOL bClone = FALSE;
785 if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { 785 if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
786 bClone = TRUE; 786 bClone = TRUE;
787 pClone = m_pDevice->GetBackDrop()->Clone(&rect); 787 pClone = m_pDevice->GetBackDrop()->Clone(&rect);
788 CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap(); 788 CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap();
789 pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(), 789 pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
790 pForeBitmap, rect.left, rect.top); 790 pForeBitmap, rect.left, rect.top);
791 left = left >= 0 ? 0 : left; 791 left = left >= 0 ? 0 : left;
792 top = top >= 0 ? 0 : top; 792 top = top >= 0 ? 0 : top;
793 if (!pDIBitmap->IsAlphaMask()) 793 if (!pDIBitmap->IsAlphaMask())
(...skipping 22 matching lines...) Expand all
816 if (pDIBitmap->HasAlpha() && 816 if (pDIBitmap->HasAlpha() &&
817 !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) { 817 !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_IMAGE)) {
818 CFX_DIBitmap* pCloneConvert = pDIBitmap->CloneConvert(FXDIB_Rgb); 818 CFX_DIBitmap* pCloneConvert = pDIBitmap->CloneConvert(FXDIB_Rgb);
819 if (!pCloneConvert) { 819 if (!pCloneConvert) {
820 return; 820 return;
821 } 821 }
822 CXFA_ImageRenderer imageRender; 822 CXFA_ImageRenderer imageRender;
823 FX_BOOL bRet = imageRender.Start(m_pDevice, pCloneConvert, m_FillArgb, 823 FX_BOOL bRet = imageRender.Start(m_pDevice, pCloneConvert, m_FillArgb,
824 m_BitmapAlpha, &m_ImageMatrix, m_Flags); 824 m_BitmapAlpha, &m_ImageMatrix, m_Flags);
825 while (bRet) { 825 while (bRet) {
826 bRet = imageRender.Continue(NULL); 826 bRet = imageRender.Continue(nullptr);
827 } 827 }
828 delete pCloneConvert; 828 delete pCloneConvert;
829 return; 829 return;
830 } 830 }
831 } 831 }
832 void XFA_DrawImage(CFX_Graphics* pGS, 832 void XFA_DrawImage(CFX_Graphics* pGS,
833 const CFX_RectF& rtImage, 833 const CFX_RectF& rtImage,
834 CFX_Matrix* pMatrix, 834 CFX_Matrix* pMatrix,
835 CFX_DIBitmap* pDIBitmap, 835 CFX_DIBitmap* pDIBitmap,
836 int32_t iAspect, 836 int32_t iAspect,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 CFX_PathData path; 890 CFX_PathData path;
891 path.AppendRect(rtImage.left, rtImage.bottom(), rtImage.right(), rtImage.top); 891 path.AppendRect(rtImage.left, rtImage.bottom(), rtImage.right(), rtImage.top);
892 pRenderDevice->SetClip_PathFill(&path, pMatrix, FXFILL_WINDING); 892 pRenderDevice->SetClip_PathFill(&path, pMatrix, FXFILL_WINDING);
893 CFX_Matrix mtImage(1, 0, 0, -1, 0, 1); 893 CFX_Matrix mtImage(1, 0, 0, -1, 0, 1);
894 mtImage.Concat(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top); 894 mtImage.Concat(rtFit.width, 0, 0, rtFit.height, rtFit.left, rtFit.top);
895 mtImage.Concat(*pMatrix); 895 mtImage.Concat(*pMatrix);
896 CXFA_ImageRenderer imageRender; 896 CXFA_ImageRenderer imageRender;
897 FX_BOOL bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage, 897 FX_BOOL bRet = imageRender.Start(pRenderDevice, pDIBitmap, 0, 255, &mtImage,
898 FXDIB_INTERPOL); 898 FXDIB_INTERPOL);
899 while (bRet) { 899 while (bRet) {
900 bRet = imageRender.Continue(NULL); 900 bRet = imageRender.Continue(nullptr);
901 } 901 }
902 pRenderDevice->RestoreState(false); 902 pRenderDevice->RestoreState(false);
903 } 903 }
904 904
905 static const uint8_t g_inv_base64[128] = { 905 static const uint8_t g_inv_base64[128] = {
906 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 906 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
907 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 907 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
908 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255, 908 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 62, 255,
909 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255, 909 255, 255, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 255, 255,
910 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 910 255, 255, 255, 255, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
(...skipping 14 matching lines...) Expand all
925 if ((pStr[i] & 128) == 0) { 925 if ((pStr[i] & 128) == 0) {
926 if (g_inv_base64[pStr[i]] != 0xFF || pStr[i] == '=') { 926 if (g_inv_base64[pStr[i]] != 0xFF || pStr[i] == '=') {
927 pCP[j++] = pStr[i]; 927 pCP[j++] = pStr[i];
928 } 928 }
929 } 929 }
930 } 930 }
931 pCP[j] = '\0'; 931 pCP[j] = '\0';
932 return pCP; 932 return pCP;
933 } 933 }
934 static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) { 934 static int32_t XFA_Base64Decode(const FX_CHAR* pStr, uint8_t* pOutBuffer) {
935 if (pStr == NULL) { 935 if (!pStr) {
936 return 0; 936 return 0;
937 } 937 }
938 uint8_t* pBuffer = 938 uint8_t* pBuffer =
939 XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr)); 939 XFA_RemoveBase64Whitespace((uint8_t*)pStr, FXSYS_strlen((FX_CHAR*)pStr));
940 if (pBuffer == NULL) { 940 if (!pBuffer) {
941 return 0; 941 return 0;
942 } 942 }
943 int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer); 943 int32_t iLen = FXSYS_strlen((FX_CHAR*)pBuffer);
944 int32_t i = 0, j = 0; 944 int32_t i = 0, j = 0;
945 uint32_t dwLimb = 0; 945 uint32_t dwLimb = 0;
946 for (; i + 3 < iLen; i += 4) { 946 for (; i + 3 < iLen; i += 4) {
947 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=' || pBuffer[i + 2] == '=' || 947 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=' || pBuffer[i + 2] == '=' ||
948 pBuffer[i + 3] == '=') { 948 pBuffer[i + 3] == '=') {
949 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=') { 949 if (pBuffer[i] == '=' || pBuffer[i + 1] == '=') {
950 break; 950 break;
(...skipping 23 matching lines...) Expand all
974 } 974 }
975 } 975 }
976 FX_Free(pBuffer); 976 FX_Free(pBuffer);
977 return j; 977 return j;
978 } 978 }
979 979
980 static const FX_CHAR g_base64_chars[] = 980 static const FX_CHAR g_base64_chars[] =
981 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 981 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
982 982
983 FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { 983 FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) {
984 FX_CHAR* out = NULL; 984 FX_CHAR* out = nullptr;
985 int i, j; 985 int i, j;
986 uint32_t limb; 986 uint32_t limb;
987 out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5); 987 out = FX_Alloc(FX_CHAR, ((buf_len * 8 + 5) / 6) + 5);
988 for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) { 988 for (i = 0, j = 0, limb = 0; i + 2 < buf_len; i += 3, j += 4) {
989 limb = ((uint32_t)buf[i] << 16) | ((uint32_t)buf[i + 1] << 8) | 989 limb = ((uint32_t)buf[i] << 16) | ((uint32_t)buf[i + 1] << 8) |
990 ((uint32_t)buf[i + 2]); 990 ((uint32_t)buf[i + 2]);
991 out[j] = g_base64_chars[(limb >> 18) & 63]; 991 out[j] = g_base64_chars[(limb >> 18) & 63];
992 out[j + 1] = g_base64_chars[(limb >> 12) & 63]; 992 out[j + 1] = g_base64_chars[(limb >> 12) & 63];
993 out[j + 2] = g_base64_chars[(limb >> 6) & 63]; 993 out[j + 2] = g_base64_chars[(limb >> 6) & 63];
994 out[j + 3] = g_base64_chars[(limb)&63]; 994 out[j + 3] = g_base64_chars[(limb)&63];
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, 1039 CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc,
1040 CXFA_Image* pImage, 1040 CXFA_Image* pImage,
1041 FX_BOOL& bNameImage, 1041 FX_BOOL& bNameImage,
1042 int32_t& iImageXDpi, 1042 int32_t& iImageXDpi,
1043 int32_t& iImageYDpi) { 1043 int32_t& iImageYDpi) {
1044 CFX_WideString wsHref; 1044 CFX_WideString wsHref;
1045 pImage->GetHref(wsHref); 1045 pImage->GetHref(wsHref);
1046 CFX_WideString wsImage; 1046 CFX_WideString wsImage;
1047 pImage->GetContent(wsImage); 1047 pImage->GetContent(wsImage);
1048 if (wsHref.IsEmpty() && wsImage.IsEmpty()) { 1048 if (wsHref.IsEmpty() && wsImage.IsEmpty()) {
1049 return NULL; 1049 return nullptr;
1050 } 1050 }
1051 CFX_WideString wsContentType; 1051 CFX_WideString wsContentType;
1052 pImage->GetContentType(wsContentType); 1052 pImage->GetContentType(wsContentType);
1053 FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType); 1053 FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType);
1054 CFX_ByteString bsContent; 1054 CFX_ByteString bsContent;
1055 uint8_t* pImageBuffer = NULL; 1055 uint8_t* pImageBuffer = nullptr;
1056 IFX_FileRead* pImageFileRead = NULL; 1056 IFX_FileRead* pImageFileRead = nullptr;
1057 if (wsImage.GetLength() > 0) { 1057 if (wsImage.GetLength() > 0) {
1058 XFA_ATTRIBUTEENUM iEncoding = 1058 XFA_ATTRIBUTEENUM iEncoding =
1059 (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding(); 1059 (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding();
1060 if (iEncoding == XFA_ATTRIBUTEENUM_Base64) { 1060 if (iEncoding == XFA_ATTRIBUTEENUM_Base64) {
1061 CFX_ByteString bsData = wsImage.UTF8Encode(); 1061 CFX_ByteString bsData = wsImage.UTF8Encode();
1062 int32_t iLength = bsData.GetLength(); 1062 int32_t iLength = bsData.GetLength();
1063 pImageBuffer = FX_Alloc(uint8_t, iLength); 1063 pImageBuffer = FX_Alloc(uint8_t, iLength);
1064 int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer); 1064 int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer);
1065 if (iRead > 0) { 1065 if (iRead > 0) {
1066 pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead); 1066 pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead);
(...skipping 11 matching lines...) Expand all
1078 pDoc->GetPDFNamedImage(wsURL.AsStringC(), iImageXDpi, iImageYDpi); 1078 pDoc->GetPDFNamedImage(wsURL.AsStringC(), iImageXDpi, iImageYDpi);
1079 if (pBitmap) { 1079 if (pBitmap) {
1080 bNameImage = TRUE; 1080 bNameImage = TRUE;
1081 return pBitmap; 1081 return pBitmap;
1082 } 1082 }
1083 } 1083 }
1084 pImageFileRead = pDoc->GetDocProvider()->OpenLinkedFile(pDoc, wsURL); 1084 pImageFileRead = pDoc->GetDocProvider()->OpenLinkedFile(pDoc, wsURL);
1085 } 1085 }
1086 if (!pImageFileRead) { 1086 if (!pImageFileRead) {
1087 FX_Free(pImageBuffer); 1087 FX_Free(pImageBuffer);
1088 return NULL; 1088 return nullptr;
1089 } 1089 }
1090 bNameImage = FALSE; 1090 bNameImage = FALSE;
1091 CFX_DIBitmap* pBitmap = 1091 CFX_DIBitmap* pBitmap =
1092 XFA_LoadImageFromBuffer(pImageFileRead, type, iImageXDpi, iImageYDpi); 1092 XFA_LoadImageFromBuffer(pImageFileRead, type, iImageXDpi, iImageYDpi);
1093 FX_Free(pImageBuffer); 1093 FX_Free(pImageBuffer);
1094 pImageFileRead->Release(); 1094 pImageFileRead->Release();
1095 return pBitmap; 1095 return pBitmap;
1096 } 1096 }
1097 static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type, 1097 static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type,
1098 int32_t iComponents, 1098 int32_t iComponents,
(...skipping 14 matching lines...) Expand all
1113 break; 1113 break;
1114 } 1114 }
1115 return dibFormat; 1115 return dibFormat;
1116 } 1116 }
1117 CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead, 1117 CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead,
1118 FXCODEC_IMAGE_TYPE type, 1118 FXCODEC_IMAGE_TYPE type,
1119 int32_t& iImageXDpi, 1119 int32_t& iImageXDpi,
1120 int32_t& iImageYDpi) { 1120 int32_t& iImageYDpi) {
1121 CFX_GEModule* pGeModule = CFX_GEModule::Get(); 1121 CFX_GEModule* pGeModule = CFX_GEModule::Get();
1122 if (!pGeModule) { 1122 if (!pGeModule) {
1123 return NULL; 1123 return nullptr;
1124 } 1124 }
1125 CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); 1125 CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule();
1126 if (!pCodecMgr) { 1126 if (!pCodecMgr) {
1127 return NULL; 1127 return nullptr;
1128 } 1128 }
1129 CFX_DIBAttribute dibAttr; 1129 CFX_DIBAttribute dibAttr;
1130 CFX_DIBitmap* pBitmap = NULL; 1130 CFX_DIBitmap* pBitmap = nullptr;
1131 CCodec_ProgressiveDecoder* pProgressiveDecoder = 1131 CCodec_ProgressiveDecoder* pProgressiveDecoder =
1132 pCodecMgr->CreateProgressiveDecoder(); 1132 pCodecMgr->CreateProgressiveDecoder();
1133 pProgressiveDecoder->LoadImageInfo(pImageFileRead, type, &dibAttr, false); 1133 pProgressiveDecoder->LoadImageInfo(pImageFileRead, type, &dibAttr, false);
1134 switch (dibAttr.m_wDPIUnit) { 1134 switch (dibAttr.m_wDPIUnit) {
1135 case FXCODEC_RESUNIT_CENTIMETER: 1135 case FXCODEC_RESUNIT_CENTIMETER:
1136 dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI * 2.54f); 1136 dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI * 2.54f);
1137 dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI * 2.54f); 1137 dibAttr.m_nYDPI = (int32_t)(dibAttr.m_nYDPI * 2.54f);
1138 break; 1138 break;
1139 case FXCODEC_RESUNIT_METER: 1139 case FXCODEC_RESUNIT_METER:
1140 dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI / (FX_FLOAT)100 * 2.54f); 1140 dibAttr.m_nXDPI = (int32_t)(dibAttr.m_nXDPI / (FX_FLOAT)100 * 2.54f);
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 } 2042 }
2043 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); 2043 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
2044 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); 2044 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags);
2045 } 2045 }
2046 2046
2047 CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {} 2047 CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {}
2048 2048
2049 CXFA_CalcData::~CXFA_CalcData() { 2049 CXFA_CalcData::~CXFA_CalcData() {
2050 m_Globals.RemoveAll(); 2050 m_Globals.RemoveAll();
2051 } 2051 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_fftextedit.cpp ('k') | xfa/fxfa/app/xfa_ffwidgetacc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698