diff options
Diffstat (limited to 'core/src/fxge/win32')
-rw-r--r-- | core/src/fxge/win32/fx_win32_device.cpp | 80 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_dib.cpp | 3 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_dwrite.cpp | 20 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_gdipext.cpp | 8 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_print.cpp | 42 |
5 files changed, 75 insertions, 78 deletions
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 2802a7c533..3a328c0e6a 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -267,7 +267,8 @@ void CWin32FontInfo::GetJapanesePreference(CFX_ByteString& face, int weight, int } } return; - } else if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) { + } + 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 { @@ -992,8 +993,10 @@ 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,23 +1005,22 @@ 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); - } 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); + } + 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); } return FALSE; } @@ -1048,9 +1050,10 @@ 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 +1070,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,25 +1079,24 @@ 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; - } 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); + } + 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 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 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 FALSE; } diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp index b6455c3570..da6a2c3ef4 100644 --- a/core/src/fxge/win32/fx_win32_dib.cpp +++ b/core/src/fxge/win32/fx_win32_dib.cpp @@ -153,7 +153,8 @@ 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); - } else if (args.flags == WINDIB_OPEN_MEMORY) { + } + 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 7949888ac2..e5db76d836 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -286,10 +286,9 @@ 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() { @@ -310,16 +309,14 @@ 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) { @@ -345,10 +342,9 @@ 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 3c63efed6a..fff9e88bbb 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -1013,14 +1013,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 163ee84a0a..2be8a30ecb 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -80,33 +80,31 @@ 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); - } else { - ASSERT(pSource != NULL); - if (pSource->HasAlpha()) { + } + 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) { return FALSE; } - 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_width < 0) { + dest_left += dest_width; } - CFX_DIBExtractor temp(pSource); - CFX_DIBitmap* pBitmap = temp; - if (pBitmap == NULL) { - return FALSE; + if (dest_height < 0) { + dest_top += dest_height; } - return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform); + 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); } static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pDestMatrix) { |