summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfeditimg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdfeditimg.cpp')
-rw-r--r--fpdfsdk/fpdfeditimg.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp
index 4429dcd201..b2c25779c6 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -17,9 +17,9 @@ FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
return nullptr;
+
CPDF_ImageObject* pImageObj = new CPDF_ImageObject;
- CPDF_Image* pImg = new CPDF_Image(pDoc);
- pImageObj->m_pImage = pImg;
+ pImageObj->m_pImage = new CPDF_Image(pDoc);
return pImageObj;
}
@@ -32,13 +32,12 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages,
return FALSE;
IFX_FileRead* pFile = new CPDF_CustomAccess(fileAccess);
- CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object;
+ CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object);
pImgObj->m_GeneralState.GetModify();
for (int index = 0; index < nCount; index++) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]);
- if (!pPage)
- continue;
- pImgObj->m_pImage->ResetCache(pPage, nullptr);
+ if (pPage)
+ pImgObj->m_pImage->ResetCache(pPage, nullptr);
}
pImgObj->m_pImage->SetJpegImage(pFile);
@@ -54,13 +53,14 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
double f) {
if (!image_object)
return FALSE;
- CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object;
- pImgObj->m_Matrix.a = (FX_FLOAT)a;
- pImgObj->m_Matrix.b = (FX_FLOAT)b;
- pImgObj->m_Matrix.c = (FX_FLOAT)c;
- pImgObj->m_Matrix.d = (FX_FLOAT)d;
- pImgObj->m_Matrix.e = (FX_FLOAT)e;
- pImgObj->m_Matrix.f = (FX_FLOAT)f;
+
+ CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object);
+ pImgObj->m_Matrix.a = static_cast<FX_FLOAT>(a);
+ pImgObj->m_Matrix.b = static_cast<FX_FLOAT>(b);
+ pImgObj->m_Matrix.c = static_cast<FX_FLOAT>(c);
+ pImgObj->m_Matrix.d = static_cast<FX_FLOAT>(d);
+ pImgObj->m_Matrix.e = static_cast<FX_FLOAT>(e);
+ pImgObj->m_Matrix.f = static_cast<FX_FLOAT>(f);
pImgObj->CalcBoundingBox();
return TRUE;
}
@@ -71,17 +71,15 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,
FPDF_BITMAP bitmap) {
if (!image_object || !bitmap || !pages)
return FALSE;
- CFX_DIBitmap* pBmp = nullptr;
- pBmp = (CFX_DIBitmap*)bitmap;
- CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object;
+
+ CPDF_ImageObject* pImgObj = reinterpret_cast<CPDF_ImageObject*>(image_object);
pImgObj->m_GeneralState.GetModify();
for (int index = 0; index < nCount; index++) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]);
- if (!pPage)
- continue;
- pImgObj->m_pImage->ResetCache(pPage, nullptr);
+ if (pPage)
+ pImgObj->m_pImage->ResetCache(pPage, nullptr);
}
- pImgObj->m_pImage->SetImage(pBmp, FALSE);
+ pImgObj->m_pImage->SetImage(reinterpret_cast<CFX_DIBitmap*>(bitmap), FALSE);
pImgObj->CalcBoundingBox();
return TRUE;
}