diff options
author | thestig <thestig@chromium.org> | 2016-05-26 20:15:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-26 20:15:19 -0700 |
commit | befa4506dc9d2a679c526aff96c09bcb0e9daecb (patch) | |
tree | 3c1d3e11d9802b2db95e35f4ab81ff449492ee10 /core/fxge/dib | |
parent | 7aed76f53137a71491040c776ab2f8931e91061b (diff) | |
download | pdfium-befa4506dc9d2a679c526aff96c09bcb0e9daecb.tar.xz |
Remove default arguments from CFX_FxgeDevice.
Remove unused dithering code.
Review-Url: https://codereview.chromium.org/2010813003
Diffstat (limited to 'core/fxge/dib')
-rw-r--r-- | core/fxge/dib/fx_dib_main.cpp | 85 |
1 files changed, 1 insertions, 84 deletions
diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp index ad6ee0c4e7..85df71e11d 100644 --- a/core/fxge/dib/fx_dib_main.cpp +++ b/core/fxge/dib/fx_dib_main.cpp @@ -1371,90 +1371,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, } return TRUE; } -FX_BOOL CFX_DIBitmap::DitherFS(const uint32_t* pPalette, - int pal_size, - const FX_RECT* pRect) { - if (!m_pBuffer) { - return FALSE; - } - if (m_bpp != 8 && m_pPalette && m_AlphaFlag != 0) { - return FALSE; - } - if (m_Width < 4 && m_Height < 4) { - return FALSE; - } - FX_RECT rect(0, 0, m_Width, m_Height); - if (pRect) { - rect.Intersect(*pRect); - } - uint8_t translate[256]; - for (int i = 0; i < 256; i++) { - int err2 = 65536; - for (int j = 0; j < pal_size; j++) { - uint8_t entry = (uint8_t)pPalette[j]; - int err = (int)entry - i; - if (err * err < err2) { - err2 = err * err; - translate[i] = entry; - } - } - } - for (int row = rect.top; row < rect.bottom; row++) { - uint8_t* scan = m_pBuffer + row * m_Pitch; - uint8_t* next_scan = m_pBuffer + (row + 1) * m_Pitch; - for (int col = rect.left; col < rect.right; col++) { - int src_pixel = scan[col]; - int dest_pixel = translate[src_pixel]; - scan[col] = (uint8_t)dest_pixel; - int error = -dest_pixel + src_pixel; - if (col < rect.right - 1) { - int src = scan[col + 1]; - src += error * 7 / 16; - if (src > 255) { - scan[col + 1] = 255; - } else if (src < 0) { - scan[col + 1] = 0; - } else { - scan[col + 1] = src; - } - } - if (col < rect.right - 1 && row < rect.bottom - 1) { - int src = next_scan[col + 1]; - src += error * 1 / 16; - if (src > 255) { - next_scan[col + 1] = 255; - } else if (src < 0) { - next_scan[col + 1] = 0; - } else { - next_scan[col + 1] = src; - } - } - if (row < rect.bottom - 1) { - int src = next_scan[col]; - src += error * 5 / 16; - if (src > 255) { - next_scan[col] = 255; - } else if (src < 0) { - next_scan[col] = 0; - } else { - next_scan[col] = src; - } - } - if (col > rect.left && row < rect.bottom - 1) { - int src = next_scan[col - 1]; - src += error * 3 / 16; - if (src > 255) { - next_scan[col - 1] = 255; - } else if (src < 0) { - next_scan[col - 1] = 0; - } else { - next_scan[col - 1] = src; - } - } - } - } - return TRUE; -} + CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const { CFX_DIBitmap* pFlipped = new CFX_DIBitmap; if (!pFlipped->Create(m_Width, m_Height, GetFormat())) { |