From 4eb4d7f6c707cc2c23c806aa540d055c8832b55d Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 22 Jul 2015 15:04:26 -0700 Subject: Revert "Fix else-after-returns throughout pdfium." This reverts commit 7cc97521db1e52d5927f5605de5f9a7102f8af40. --- core/src/fxge/win32/fx_win32_device.cpp | 80 ++++++++++++++++----------------- 1 file changed, 39 insertions(+), 41 deletions(-) (limited to 'core/src/fxge/win32/fx_win32_device.cpp') 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; } -- cgit v1.2.3