diff options
Diffstat (limited to 'core/src/fxge/dib')
-rw-r--r-- | core/src/fxge/dib/fx_dib_composite.cpp | 37 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_convert.cpp | 12 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_engine.cpp | 6 | ||||
-rw-r--r-- | core/src/fxge/dib/fx_dib_main.cpp | 15 |
4 files changed, 3 insertions, 67 deletions
diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp index ae72fc5a43..e385bc9ffe 100644 --- a/core/src/fxge/dib/fx_dib_composite.cpp +++ b/core/src/fxge/dib/fx_dib_composite.cpp @@ -3601,9 +3601,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count); - if (!gray_pal) { - return; - } pDestPalette = (FX_DWORD*)gray_pal; for (int i = 0; i < pal_count; i ++) { FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]); @@ -3613,9 +3610,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } else { int palsize = 1 << (src_format & 0xff); pDestPalette = FX_Alloc(FX_DWORD, palsize); - if (!pDestPalette) { - return; - } for (int i = 0; i < palsize; i ++) { FX_DWORD color = isSrcCmyk ? FXCMYK_TODIB(pSrcPalette[i]) : FXARGB_TODIB(pSrcPalette[i]); pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&color, (FX_LPCBYTE)&color, 1); @@ -3625,9 +3619,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } else { int pal_count = 1 << (src_format & 0xff); FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count); - if (!gray_pal) { - return; - } if (pal_count == 2) { gray_pal[0] = 0; gray_pal[1] = 255; @@ -3641,10 +3632,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB pDestPalette = (FX_DWORD*)gray_pal; } else { pDestPalette = FX_Alloc(FX_DWORD, pal_count); - if (!pDestPalette) { - FX_Free(gray_pal); - return; - } for (int i = 0; i < pal_count; i ++) { pIccModule->TranslateScanline(pIccTransform, (FX_LPBYTE)&pDestPalette[i], &gray_pal[i], 1); pDestPalette[i] = isDstCmyk ? FXCMYK_TODIB(pDestPalette[i]) : FXARGB_TODIB(pDestPalette[i]); @@ -3657,9 +3644,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count); - if (!gray_pal) { - return; - } pDestPalette = (FX_DWORD*)gray_pal; if (isSrcCmyk) { for (int i = 0; i < pal_count; i ++) { @@ -3677,9 +3661,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } else { int palsize = 1 << (src_format & 0xff); pDestPalette = FX_Alloc(FX_DWORD, palsize); - if (!pDestPalette) { - return; - } if (isDstCmyk == isSrcCmyk) { FXSYS_memcpy32(pDestPalette, pSrcPalette, palsize * sizeof(FX_DWORD)); } else { @@ -3696,9 +3677,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB if ((dest_format & 0xff) == 8) { int pal_count = 1 << (src_format & 0xff); FX_LPBYTE gray_pal = FX_Alloc(FX_BYTE, pal_count); - if (!gray_pal) { - return; - } if (pal_count == 2) { gray_pal[0] = 0; gray_pal[1] = 255; @@ -3711,9 +3689,6 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, FXDIB } else { int palsize = 1 << (src_format & 0xff); pDestPalette = FX_Alloc(FX_DWORD, palsize); - if (!pDestPalette) { - return; - } if (palsize == 2) { pDestPalette[0] = isSrcCmyk ? 255 : 0xff000000; pDestPalette[1] = isSrcCmyk ? 0 : 0xffffffff; @@ -4463,25 +4438,13 @@ FX_BOOL CFX_BitmapComposer::SetInfo(int width, int height, FXDIB_Format src_form } if (m_bVertical) { m_pScanlineV = FX_Alloc(FX_BYTE, m_pBitmap->GetBPP() / 8 * width + 4); - if (!m_pScanlineV) { - return FALSE; - } m_pClipScanV = FX_Alloc(FX_BYTE, m_pBitmap->GetHeight()); - if (!m_pClipScanV) { - return FALSE; - } if (m_pBitmap->m_pAlphaMask) { m_pScanlineAlphaV = FX_Alloc(FX_BYTE, width + 4); - if (!m_pScanlineAlphaV) { - return FALSE; - } } } if (m_BitmapAlpha < 255) { m_pAddClipScan = FX_Alloc(FX_BYTE, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); - if (!m_pAddClipScan) { - return FALSE; - } } return TRUE; } diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index 69432fde4d..7ab2417a57 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -236,9 +236,6 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) FX_Free(m_pPalette); } m_pPalette = FX_Alloc(FX_DWORD, 256); - if (!m_pPalette) { - return FALSE; - } int bpp = pBitmap->GetBPP() / 8; int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); @@ -251,13 +248,7 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap, int pal_type) m_aLut = NULL; } m_cLut = FX_Alloc(FX_DWORD, 4096); - if (!m_cLut) { - return FALSE; - } m_aLut = FX_Alloc(FX_DWORD, 4096); - if (!m_aLut) { - return FALSE; - } int row, col; m_lut = 0; for (row = 0; row < height; row++) { @@ -872,9 +863,6 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, FX_LPBYTE dest_buf, int dest_pit return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); } d_pal = FX_Alloc(FX_DWORD, 256); - if (!d_pal) { - return FALSE; - } if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) && pSrcBitmap->GetPalette()) { return _ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform); } else if ((src_format & 0xff) >= 24) { diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index 7b08386ae2..6f8621e2a5 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -799,14 +799,8 @@ FX_BOOL CFX_ImageStretcher::StartQuickStretch() } size *= m_DestBPP; m_pScanline = FX_Alloc(FX_BYTE, (size / 8 + 3) / 4 * 4); - if (!m_pScanline) { - return FALSE; - } if (m_pSource->m_pAlphaMask) { m_pMaskScanline = FX_Alloc(FX_BYTE, (m_ClipRect.Width() + 3) / 4 * 4); - if (!m_pMaskScanline) { - return FALSE; - } } if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) { ContinueQuickStretch(NULL); diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index d9e401897b..12812b2f8d 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -85,12 +85,12 @@ FX_BOOL CFX_DIBitmap::Create(int width, int height, FXDIB_Format format, FX_LPBY int oomlimit = _MAX_OOM_LIMIT_; if (oomlimit >= 0 && size >= oomlimit) { m_pBuffer = FX_TryAlloc(FX_BYTE, size); + if (m_pBuffer == NULL) { + return FALSE; + } } else { m_pBuffer = FX_Alloc(FX_BYTE, size); } - if (m_pBuffer == NULL) { - return FALSE; - } } m_Width = width; m_Height = height; @@ -205,9 +205,6 @@ void CFX_DIBSource::BuildPalette() } if (GetBPP() == 1) { m_pPalette = FX_Alloc(FX_DWORD, 2); - if (!m_pPalette) { - return; - } if(IsCmykImage()) { m_pPalette[0] = 0xff; m_pPalette[1] = 0; @@ -217,9 +214,6 @@ void CFX_DIBSource::BuildPalette() } } else if (GetBPP() == 8) { m_pPalette = FX_Alloc(FX_DWORD, 256); - if (!m_pPalette) { - return; - } if(IsCmykImage()) { for (int i = 0; i < 256; i ++) { m_pPalette[i] = 0xff - i; @@ -537,9 +531,6 @@ void CFX_DIBSource::CopyPalette(const FX_DWORD* pSrc, FX_DWORD size) if (m_pPalette == NULL) { m_pPalette = FX_Alloc(FX_DWORD, pal_size); } - if (!m_pPalette) { - return; - } if (pal_size > size) { pal_size = size; } |