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

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

Issue 818363006: fix a few linux compilation warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Restore origina cmslut.c Created 5 years, 11 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 d73d7614dadc9d4e0b1967defd00e7229d86359f..d2f2c5072fc2ba4d5657beeb09f6f1078bed2029 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -195,9 +195,13 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
opType = 0;
}
}
+ FX_BOOL bDeleteMask = FALSE;
const CFX_DIBitmap* pMaskBitmap = NULL;
if (pBitmap->HasAlpha()) {
pMaskBitmap = pBitmap->GetAlphaMask();
+ if (pMaskBitmap) {
+ bDeleteMask = TRUE;
+ }
}
if (!pMaskBitmap && pMask) {
FXDIB_Format maskFormat = pMask->GetFormat();
@@ -210,7 +214,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 = FX_NEW CPDF_Dictionary;
pMaskDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject"));
pMaskDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image"));
@@ -243,10 +246,9 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F
}
pMaskStream = FX_NEW CPDF_Stream(mask_buf, mask_size, pMaskDict);
m_pDocument->AddIndirectObject(pMaskStream);
- bDeleteMask = FALSE;
pDict->SetAtReference(FX_BSTRC("SMask"), m_pDocument, pMaskStream);
}
- if (pBitmap->HasAlpha()) {
+ if (bDeleteMask) {
delete pMaskBitmap;
}
}

Powered by Google App Engine
This is Rietveld 408576698