diff --git a/DesktopEditor/raster/BgraFrame.cpp b/DesktopEditor/raster/BgraFrame.cpp index 1b32860e9c..9a7e18e64d 100644 --- a/DesktopEditor/raster/BgraFrame.cpp +++ b/DesktopEditor/raster/BgraFrame.cpp @@ -569,7 +569,7 @@ bool CBgraFrame::SaveFile(const std::wstring& strFileName, unsigned int nFileTyp bool CBgraFrame::Encode(BYTE*& pBuffer, int& nSize, unsigned int nFileType) { CxImage oCxImage; - if (!oCxImage.CreateFromArray(m_pData, m_lWidth, m_lHeight, 32, 4 * m_lWidth, (m_lStride >= 0) ? true : false)) + if (!oCxImage.CreateFromArray(m_pData, m_lWidth, m_lHeight, 32, 4 * m_lWidth, (m_lStride >= 0) ? true : false, !m_bIsRGBA)) return false; if (CXIMAGE_FORMAT_JPG == nFileType && -1 != m_dJpegSaveQuality) diff --git a/PdfFile/PdfReader.cpp b/PdfFile/PdfReader.cpp index 0c675c0345..a7171d0cff 100644 --- a/PdfFile/PdfReader.cpp +++ b/PdfFile/PdfReader.cpp @@ -1043,11 +1043,34 @@ BYTE* CPdfReader::GetButtonIcon(int nRasterW, int nRasterH, int nBackgroundColor if (sIconView && strcmp(sIconView, arrMKName[j]) != 0) continue; std::string sMKName(arrMKName[j]); - Object oStr; + Object oStr, oStrRef; + int nView; if (!oMK.dictLookup(sMKName.c_str(), &oStr)->isStream()) { oStr.free(); - continue; + + Object oIF; + if (!oMK.dictLookup("IF", &oIF)->isDict()) + { + oIF.free(); + continue; + } + oIF.free(); + + Object oAP; + if (!pField->fieldLookup("AP", &oAP)->isDict() || !oAP.dictLookup("N", &oStr)->isStream()) + { + oAP.free(); oStr.free(); + continue; + } + oAP.dictLookupNF("N", &oStrRef); + nView = oStrRef.getRefNum(); + oAP.free(); + } + else + { + oMK.dictLookupNF(sMKName.c_str(), &oStrRef); + nView = oStrRef.getRefNum(); } if (bFirst) @@ -1276,13 +1299,10 @@ BYTE* CPdfReader::GetButtonIcon(int nRasterW, int nRasterH, int nBackgroundColor // else if (bImage) { - oStr.free(); oResources.free(); + oStr.free(); oStrRef.free(); oResources.free(); continue; } - Object oStrRef; - oMK.dictLookupNF(sMKName.c_str(), &oStrRef); - int nView = oStrRef.getRefNum(); oRes.AddInt(nView); if (std::find(arrUniqueImage.begin(), arrUniqueImage.end(), nView) != arrUniqueImage.end()) { @@ -1352,6 +1372,7 @@ BYTE* CPdfReader::GetButtonIcon(int nRasterW, int nRasterH, int nBackgroundColor pFrame->put_Width(nWidth); pFrame->put_Height(nHeight); pFrame->put_Stride(4 * nWidth); + pFrame->put_IsRGBA(true); NSGraphics::IGraphicsRenderer* pRenderer = NSGraphics::Create(); pRenderer->SetFontManager(m_pFontManager); @@ -1392,6 +1413,7 @@ BYTE* CPdfReader::GetButtonIcon(int nRasterW, int nRasterH, int nBackgroundColor oRes.WriteString((BYTE*)cData64, nData64Dst); RELEASEARRAYOBJECTS(cData64); + RELEASEARRAYOBJECTS(pPngBuffer); } else { diff --git a/PdfFile/PdfWriter_empty.cpp b/PdfFile/PdfWriter_empty.cpp index 0b85e4e82d..8261f706a2 100644 --- a/PdfFile/PdfWriter_empty.cpp +++ b/PdfFile/PdfWriter_empty.cpp @@ -130,7 +130,7 @@ HRESULT CPdfWriter::GetTransform(double* dM11, double* dM12, double* dM21, doubl HRESULT CPdfWriter::ResetTransform() { return 0; } HRESULT CPdfWriter::AddHyperlink(const double& dX, const double& dY, const double& dW, const double& dH, const std::wstring& wsUrl, const std::wstring& wsTooltip) { return 0; } HRESULT CPdfWriter::AddLink(const double& dX, const double& dY, const double& dW, const double& dH, const double& dDestX, const double& dDestY, const int& nPage) { return 0; } -HRESULT CPdfWriter::AddFormField(NSFonts::IApplicationFonts* pAppFonts, CFormFieldInfo* pInfo) { return 0; } +HRESULT CPdfWriter::AddFormField(NSFonts::IApplicationFonts* pAppFonts, CFormFieldInfo* pInfo, const std::wstring& wsTempDirectory) { return 0; } HRESULT CPdfWriter::AddAnnotField(NSFonts::IApplicationFonts* pAppFonts, CAnnotFieldInfo* pFieldInfo) { return 0; } HRESULT CPdfWriter::DrawImage1bpp(NSImages::CPixJbig2* pImageBuffer, const unsigned int& unWidth, const unsigned int& unHeight, const double& dX, const double& dY, const double& dW, const double& dH) { return 0; } HRESULT CPdfWriter::EnableBrushRect(const LONG& lEnable) { return 0; }