summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp9
-rw-r--r--core/fxcrt/fx_memory_unittest.cpp2
-rw-r--r--samples/pdfium_test.cc4
3 files changed, 9 insertions, 6 deletions
diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
index 6f6aa7c404..1f43abec6e 100644
--- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
+++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp
@@ -49,12 +49,9 @@ bool CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext,
m_Matrix.Scale(1.0f, (float)(max_dpi) / (float)dpiv);
}
m_pBitmapDevice = pdfium::MakeUnique<CFX_DefaultRenderDevice>();
- FXDIB_Format dibFormat = FXDIB_Rgb;
- int32_t bpp = 24;
- if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT) {
- dibFormat = FXDIB_Argb;
- bpp = 32;
- }
+ bool bIsAlpha =
+ !!(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT);
+ FXDIB_Format dibFormat = bIsAlpha ? FXDIB_Argb : FXDIB_Rgb;
while (1) {
FX_RECT bitmap_rect =
m_Matrix.TransformRect(CFX_FloatRect(pRect)).GetOuterRect();
diff --git a/core/fxcrt/fx_memory_unittest.cpp b/core/fxcrt/fx_memory_unittest.cpp
index 2856bb9592..8036855898 100644
--- a/core/fxcrt/fx_memory_unittest.cpp
+++ b/core/fxcrt/fx_memory_unittest.cpp
@@ -59,6 +59,7 @@ TEST(fxcrt, DISABLED_FX_TryAllocOOM) {
FX_Free(ptr);
}
+#if !defined(__GNUC__)
TEST(fxcrt, FX_TryAllocOverflow) {
// |ptr| needs to be defined and used to avoid Clang optimizes away the
// calloc() statement overzealously for optimized builds.
@@ -70,6 +71,7 @@ TEST(fxcrt, FX_TryAllocOverflow) {
EXPECT_FALSE(FX_TryRealloc(int, ptr, kOverflowIntAlloc));
FX_Free(ptr);
}
+#endif
TEST(fxcrt, DISABLED_FXMEM_DefaultOOM) {
EXPECT_FALSE(FXMEM_DefaultAlloc(kMaxByteAlloc));
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index b7538a8c6f..e808d640f2 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -157,6 +157,7 @@ void OutputMD5Hash(const char* file_name, const char* buffer, int len) {
printf("MD5:%s:%s\n", file_name, hash.c_str());
}
+#ifdef PDF_ENABLE_V8
// These example JS platform callback handlers are entirely optional,
// and exist here to show the flow of information from a document back
// to the embedder.
@@ -217,6 +218,7 @@ void ExampleDocMail(IPDF_JSPLATFORM*,
GetPlatformWString(BCC).c_str(), GetPlatformWString(Subject).c_str(),
GetPlatformWString(Msg).c_str());
}
+#endif // PDF_ENABLE_V8
void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) {
std::string feature = "Unknown";
@@ -702,6 +704,7 @@ void RenderPdf(const std::string& name,
if (options.save_attachments)
WriteAttachments(doc.get(), name);
+#ifdef PDF_ENABLE_V8
IPDF_JSPLATFORM platform_callbacks = {};
platform_callbacks.version = 3;
platform_callbacks.app_alert = ExampleAppAlert;
@@ -709,6 +712,7 @@ void RenderPdf(const std::string& name,
platform_callbacks.app_beep = ExampleAppBeep;
platform_callbacks.Doc_gotoPage = ExampleDocGotoPage;
platform_callbacks.Doc_mail = ExampleDocMail;
+#endif // PDF_ENABLE_V8
FPDF_FORMFILLINFO_PDFiumTest form_callbacks = {};
#ifdef PDF_ENABLE_XFA