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

Unified Diff: core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp

Issue 1148353002: Fix four annoying warnings: (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix check. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
index a5a91ebc53ba719e09d0a6705c601a5aa9acfced..bb80196d6f6a15015f1eadb35f59da560b2dbfb5 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -190,8 +190,10 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
}
}
const CFX_DIBitmap* pMaskBitmap = NULL;
+ FX_BOOL bDeleteMask = FALSE;
if (pBitmap->HasAlpha()) {
pMaskBitmap = pBitmap->GetAlphaMask();
+ bDeleteMask = TRUE;
}
if (!pMaskBitmap && pMask) {
FXDIB_Format maskFormat = pMask->GetFormat();
@@ -204,7 +206,6 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
FX_INT32 maskHeight = pMaskBitmap->GetHeight();
FX_LPBYTE mask_buf = NULL;
FX_STRSIZE mask_size;
- FX_BOOL bDeleteMask = TRUE;
CPDF_Dictionary* pMaskDict = new CPDF_Dictionary;
pMaskDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject"));
pMaskDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image"));
@@ -240,7 +241,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
bDeleteMask = FALSE;
pDict->SetAtReference(FX_BSTRC("SMask"), m_pDocument, pMaskStream);
}
- if (pBitmap->HasAlpha()) {
+ if (bDeleteMask) {
delete pMaskBitmap;
}
}
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp » ('j') | core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698