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/xfa_ffwidget.h" | 7 #include "xfa/fxfa/xfa_ffwidget.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 CFX_WideString wsImage; | 1049 CFX_WideString wsImage; |
1050 pImage->GetContent(wsImage); | 1050 pImage->GetContent(wsImage); |
1051 if (wsHref.IsEmpty() && wsImage.IsEmpty()) { | 1051 if (wsHref.IsEmpty() && wsImage.IsEmpty()) { |
1052 return nullptr; | 1052 return nullptr; |
1053 } | 1053 } |
1054 CFX_WideString wsContentType; | 1054 CFX_WideString wsContentType; |
1055 pImage->GetContentType(wsContentType); | 1055 pImage->GetContentType(wsContentType); |
1056 FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType); | 1056 FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType); |
1057 CFX_ByteString bsContent; | 1057 CFX_ByteString bsContent; |
1058 uint8_t* pImageBuffer = nullptr; | 1058 uint8_t* pImageBuffer = nullptr; |
1059 IFX_FileRead* pImageFileRead = nullptr; | 1059 IFX_SeekableReadStream* pImageFileRead = nullptr; |
1060 if (wsImage.GetLength() > 0) { | 1060 if (wsImage.GetLength() > 0) { |
1061 XFA_ATTRIBUTEENUM iEncoding = | 1061 XFA_ATTRIBUTEENUM iEncoding = |
1062 (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding(); | 1062 (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding(); |
1063 if (iEncoding == XFA_ATTRIBUTEENUM_Base64) { | 1063 if (iEncoding == XFA_ATTRIBUTEENUM_Base64) { |
1064 CFX_ByteString bsData = wsImage.UTF8Encode(); | 1064 CFX_ByteString bsData = wsImage.UTF8Encode(); |
1065 int32_t iLength = bsData.GetLength(); | 1065 int32_t iLength = bsData.GetLength(); |
1066 pImageBuffer = FX_Alloc(uint8_t, iLength); | 1066 pImageBuffer = FX_Alloc(uint8_t, iLength); |
1067 int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer); | 1067 int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer); |
1068 if (iRead > 0) { | 1068 if (iRead > 0) { |
1069 pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead); | 1069 pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 if (bpp <= 24) { | 1110 if (bpp <= 24) { |
1111 dibFormat = FXDIB_Rgb; | 1111 dibFormat = FXDIB_Rgb; |
1112 } | 1112 } |
1113 } break; | 1113 } break; |
1114 case FXCODEC_IMAGE_PNG: | 1114 case FXCODEC_IMAGE_PNG: |
1115 default: | 1115 default: |
1116 break; | 1116 break; |
1117 } | 1117 } |
1118 return dibFormat; | 1118 return dibFormat; |
1119 } | 1119 } |
1120 CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_FileRead* pImageFileRead, | 1120 CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_SeekableReadStream* pImageFileRead, |
1121 FXCODEC_IMAGE_TYPE type, | 1121 FXCODEC_IMAGE_TYPE type, |
1122 int32_t& iImageXDpi, | 1122 int32_t& iImageXDpi, |
1123 int32_t& iImageYDpi) { | 1123 int32_t& iImageYDpi) { |
1124 CFX_GEModule* pGeModule = CFX_GEModule::Get(); | 1124 CFX_GEModule* pGeModule = CFX_GEModule::Get(); |
1125 if (!pGeModule) { | 1125 if (!pGeModule) { |
1126 return nullptr; | 1126 return nullptr; |
1127 } | 1127 } |
1128 CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); | 1128 CCodec_ModuleMgr* pCodecMgr = pGeModule->GetCodecModule(); |
1129 if (!pCodecMgr) { | 1129 if (!pCodecMgr) { |
1130 return nullptr; | 1130 return nullptr; |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 } | 2045 } |
2046 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 2046 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); |
2047 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 2047 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); |
2048 } | 2048 } |
2049 | 2049 |
2050 CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {} | 2050 CXFA_CalcData::CXFA_CalcData() : m_iRefCount(0) {} |
2051 | 2051 |
2052 CXFA_CalcData::~CXFA_CalcData() { | 2052 CXFA_CalcData::~CXFA_CalcData() { |
2053 m_Globals.RemoveAll(); | 2053 m_Globals.RemoveAll(); |
2054 } | 2054 } |
OLD | NEW |