summaryrefslogtreecommitdiff
path: root/core/src/fxge/win32
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-22 15:04:26 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-22 15:04:26 -0700
commit4eb4d7f6c707cc2c23c806aa540d055c8832b55d (patch)
tree43b7a7fac7b4ce08c287bfc03d09e5e1201e20d0 /core/src/fxge/win32
parent7cc97521db1e52d5927f5605de5f9a7102f8af40 (diff)
downloadpdfium-4eb4d7f6c707cc2c23c806aa540d055c8832b55d.tar.xz
Revert "Fix else-after-returns throughout pdfium."
This reverts commit 7cc97521db1e52d5927f5605de5f9a7102f8af40.
Diffstat (limited to 'core/src/fxge/win32')
-rw-r--r--core/src/fxge/win32/fx_win32_device.cpp80
-rw-r--r--core/src/fxge/win32/fx_win32_dib.cpp3
-rw-r--r--core/src/fxge/win32/fx_win32_dwrite.cpp20
-rw-r--r--core/src/fxge/win32/fx_win32_gdipext.cpp8
-rw-r--r--core/src/fxge/win32/fx_win32_print.cpp42
5 files changed, 78 insertions, 75 deletions
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index 18bcc595a4..b0dbc14ebc 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -267,8 +267,7 @@ void CWin32FontInfo::GetJapanesePreference(CFX_ByteString& face, int weight, int
}
}
return;
- }
- if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) {
+ } else if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) {
if (face.Find("PMincho") >= 0 || face.Find("\x82\x6f\x96\xbe\x92\xa9") >= 0) {
face = "MS PMincho";
} else {
@@ -990,10 +989,8 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD colo
if (!bGDI) {
CFX_DIBitmap background;
if (!background.Create(width, height, FXDIB_Rgb32) ||
- !GetDIBits(&background, left, top, NULL) ||
- !background.CompositeMask(0, 0, width, height, pSource, color,
- 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE,
- alpha_flag, pIccTransform)) {
+ !GetDIBits(&background, left, top, NULL) ||
+ !background.CompositeMask(0, 0, width, height, pSource, color, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, alpha_flag, pIccTransform)) {
return FALSE;
}
FX_RECT src_rect(0, 0, width, height);
@@ -1002,22 +999,23 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD colo
FX_RECT clip_rect(left, top, left + pSrcRect->Width(), top + pSrcRect->Height());
return StretchDIBits(pSource, color, left - pSrcRect->left, top - pSrcRect->top, width, height,
&clip_rect, 0, alpha_flag, pIccTransform, FXDIB_BLEND_NORMAL);
- }
- int width = pSrcRect->Width(), height = pSrcRect->Height();
- if (pSource->HasAlpha()) {
- CFX_DIBitmap bitmap;
- if (!bitmap.Create(width, height, FXDIB_Rgb) ||
- !GetDIBits(&bitmap, left, top, NULL) ||
- !bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left, pSrcRect->top, FXDIB_BLEND_NORMAL, NULL, FALSE, pIccTransform)) {
- return FALSE;
+ } else {
+ int width = pSrcRect->Width(), height = pSrcRect->Height();
+ if (pSource->HasAlpha()) {
+ CFX_DIBitmap bitmap;
+ if (!bitmap.Create(width, height, FXDIB_Rgb) ||
+ !GetDIBits(&bitmap, left, top, NULL) ||
+ !bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left, pSrcRect->top, FXDIB_BLEND_NORMAL, NULL, FALSE, pIccTransform)) {
+ return FALSE;
+ }
+ FX_RECT src_rect(0, 0, width, height);
+ return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL, 0, NULL);
+ }
+ CFX_DIBExtractor temp(pSource);
+ CFX_DIBitmap* pBitmap = temp;
+ if (pBitmap) {
+ return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform);
}
- FX_RECT src_rect(0, 0, width, height);
- return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL, 0, NULL);
- }
- CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp;
- if (pBitmap) {
- return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform);
}
return FALSE;
}
@@ -1047,10 +1045,9 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD
int alpha_flag, void* pIccTransform, int blend_type)
{
ASSERT(pSource != NULL && pClipRect != NULL);
- if (flags || dest_width > 10000 || dest_width < -10000 || dest_height > 10000 || dest_height < -10000) {
+ if (flags || dest_width > 10000 || dest_width < -10000 || dest_height > 10000 || dest_height < -10000)
return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, dest_width, dest_height,
pClipRect, flags, alpha_flag, pIccTransform, blend_type);
- }
if (pSource->IsAlphaMask()) {
FX_RECT image_rect;
image_rect.left = dest_width > 0 ? dest_left : dest_left + dest_width;
@@ -1067,8 +1064,8 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD
}
CFX_DIBitmap background;
if (!background.Create(clip_width, clip_height, FXDIB_Rgb32) ||
- !GetDIBits(&background, image_rect.left + clip_rect.left, image_rect.top + clip_rect.top, NULL) ||
- !background.CompositeMask(0, 0, clip_width, clip_height, pStretched, color, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, alpha_flag, pIccTransform)) {
+ !GetDIBits(&background, image_rect.left + clip_rect.left, image_rect.top + clip_rect.top, NULL) ||
+ !background.CompositeMask(0, 0, clip_width, clip_height, pStretched, color, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, alpha_flag, pIccTransform)) {
delete pStretched;
return FALSE;
}
@@ -1076,24 +1073,25 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD
FX_BOOL ret = SetDIBits(&background, 0, &src_rect, image_rect.left + clip_rect.left, image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL, 0, NULL);
delete pStretched;
return ret;
- }
- if (pSource->HasAlpha()) {
- CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
- if (pPlatform->m_GdiplusExt.IsAvailable() && pIccTransform == NULL && !pSource->IsCmykImage()) {
- CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp;
- if (pBitmap == NULL) {
- return FALSE;
+ } else {
+ if (pSource->HasAlpha()) {
+ CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
+ if (pPlatform->m_GdiplusExt.IsAvailable() && pIccTransform == NULL && !pSource->IsCmykImage()) {
+ CFX_DIBExtractor temp(pSource);
+ CFX_DIBitmap* pBitmap = temp;
+ if (pBitmap == NULL) {
+ return FALSE;
+ }
+ return pPlatform->m_GdiplusExt.StretchDIBits(m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height, pClipRect, flags);
}
- return pPlatform->m_GdiplusExt.StretchDIBits(m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height, pClipRect, flags);
+ return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, dest_width, dest_height,
+ pClipRect, flags, alpha_flag, pIccTransform, blend_type);
+ }
+ CFX_DIBExtractor temp(pSource);
+ CFX_DIBitmap* pBitmap = temp;
+ if (pBitmap) {
+ return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform);
}
- return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, dest_width, dest_height,
- pClipRect, flags, alpha_flag, pIccTransform, blend_type);
- }
- CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp;
- if (pBitmap) {
- return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform);
}
return FALSE;
}
diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp
index 3dcfce4802..191c2dc9cd 100644
--- a/core/src/fxge/win32/fx_win32_dib.cpp
+++ b/core/src/fxge/win32/fx_win32_dib.cpp
@@ -146,8 +146,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args)
CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
if (pPlatform->m_GdiplusExt.IsAvailable()) {
return pPlatform->m_GdiplusExt.LoadDIBitmap(args);
- }
- if (args.flags == WINDIB_OPEN_MEMORY) {
+ } else if (args.flags == WINDIB_OPEN_MEMORY) {
return NULL;
}
HBITMAP hBitmap = (HBITMAP)LoadImageW(NULL, (wchar_t*)args.path_name, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp
index 65a35d86a1..889a5684b7 100644
--- a/core/src/fxge/win32/fx_win32_dwrite.cpp
+++ b/core/src/fxge/win32/fx_win32_dwrite.cpp
@@ -282,9 +282,10 @@ HRESULT STDMETHODCALLTYPE CDwFontFileStream::QueryInterface(REFIID iid, void** p
*ppvObject = this;
AddRef();
return S_OK;
+ } else {
+ *ppvObject = NULL;
+ return E_NOINTERFACE;
}
- *ppvObject = NULL;
- return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE CDwFontFileStream::AddRef()
{
@@ -305,14 +306,16 @@ HRESULT STDMETHODCALLTYPE CDwFontFileStream::ReadFileFragment(
OUT void** fragmentContext
)
{
- if (fileOffset <= resourceSize_ && fragmentSize <= resourceSize_ - fileOffset) {
+ if (fileOffset <= resourceSize_ &&
+ fragmentSize <= resourceSize_ - fileOffset) {
*fragmentStart = static_cast<uint8_t const*>(resourcePtr_) + static_cast<size_t>(fileOffset);
*fragmentContext = NULL;
return S_OK;
+ } else {
+ *fragmentStart = NULL;
+ *fragmentContext = NULL;
+ return E_FAIL;
}
- *fragmentStart = NULL;
- *fragmentContext = NULL;
- return E_FAIL;
}
void STDMETHODCALLTYPE CDwFontFileStream::ReleaseFileFragment(void* fragmentContext)
{
@@ -338,9 +341,10 @@ HRESULT STDMETHODCALLTYPE CDwFontFileLoader::QueryInterface(REFIID iid, void** p
*ppvObject = this;
AddRef();
return S_OK;
+ } else {
+ *ppvObject = NULL;
+ return E_NOINTERFACE;
}
- *ppvObject = NULL;
- return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE CDwFontFileLoader::AddRef()
{
diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp
index d76d52e50b..8fef914cd8 100644
--- a/core/src/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/src/fxge/win32/fx_win32_gdipext.cpp
@@ -1010,14 +1010,14 @@ public:
virtual HRESULT STDMETHODCALLTYPE
QueryInterface(REFIID iid, void ** ppvObject)
{
- if (iid == __uuidof(IUnknown) ||
- iid == __uuidof(IStream) ||
- iid == __uuidof(ISequentialStream)) {
+ if (iid == __uuidof(IUnknown) || iid == __uuidof(IStream) ||
+ iid == __uuidof(ISequentialStream)) {
*ppvObject = static_cast<IStream*>(this);
AddRef();
return S_OK;
+ } else {
+ return E_NOINTERFACE;
}
- return E_NOINTERFACE;
}
virtual ULONG STDMETHODCALLTYPE AddRef(void)
{
diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp
index 86dbf9bb0a..199ab78d9f 100644
--- a/core/src/fxge/win32/fx_win32_print.cpp
+++ b/core/src/fxge/win32/fx_win32_print.cpp
@@ -80,31 +80,33 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD
return FALSE;
}
return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width, dest_height, color, flags, alpha_flag, pIccTransform);
- }
- if (pSource->HasAlpha()) {
- return FALSE;
- }
- if (dest_width < 0 || dest_height < 0) {
- CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_height < 0);
- if (pFlipped == NULL) {
+ } else {
+ ASSERT(pSource != NULL);
+ if (pSource->HasAlpha()) {
return FALSE;
}
- if (dest_width < 0) {
- dest_left += dest_width;
+ if (dest_width < 0 || dest_height < 0) {
+ CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_height < 0);
+ if (pFlipped == NULL) {
+ return FALSE;
+ }
+ if (dest_width < 0) {
+ dest_left += dest_width;
+ }
+ if (dest_height < 0) {
+ dest_top += dest_height;
+ }
+ FX_BOOL ret = GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(dest_width), abs(dest_height), flags, pIccTransform);
+ delete pFlipped;
+ return ret;
}
- if (dest_height < 0) {
- dest_top += dest_height;
+ CFX_DIBExtractor temp(pSource);
+ CFX_DIBitmap* pBitmap = temp;
+ if (pBitmap == NULL) {
+ return FALSE;
}
- FX_BOOL ret = GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(dest_width), abs(dest_height), flags, pIccTransform);
- delete pFlipped;
- return ret;
- }
- CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp;
- if (pBitmap == NULL) {
- return FALSE;
+ return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform);
}
- return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform);
}
static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pDestMatrix)
{