diff options
Diffstat (limited to 'core/fxge/dib/fx_dib_transform.cpp')
-rw-r--r-- | core/fxge/dib/fx_dib_transform.cpp | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp index 3d8ddf8783..72de148ecb 100644 --- a/core/fxge/dib/fx_dib_transform.cpp +++ b/core/fxge/dib/fx_dib_transform.cpp @@ -179,105 +179,6 @@ class CFX_BilinearMatrix : public CPDF_FixedMatrix { } }; -CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY( - bool bXFlip, - bool bYFlip, - const FX_RECT* pDestClip) const { - FX_RECT dest_clip(0, 0, m_Height, m_Width); - if (pDestClip) - dest_clip.Intersect(*pDestClip); - if (dest_clip.IsEmpty()) - return nullptr; - - auto pTransBitmap = pdfium::MakeRetain<CFX_DIBitmap>(); - int result_height = dest_clip.Height(); - int result_width = dest_clip.Width(); - if (!pTransBitmap->Create(result_width, result_height, GetFormat())) - return nullptr; - - pTransBitmap->SetPalette(m_pPalette.get()); - int dest_pitch = pTransBitmap->GetPitch(); - uint8_t* dest_buf = pTransBitmap->GetBuffer(); - int row_start = bXFlip ? m_Height - dest_clip.right : dest_clip.left; - int row_end = bXFlip ? m_Height - dest_clip.left : dest_clip.right; - int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top; - int col_end = bYFlip ? m_Width - dest_clip.top : dest_clip.bottom; - if (GetBPP() == 1) { - FXSYS_memset(dest_buf, 0xff, dest_pitch * result_height); - for (int row = row_start; row < row_end; row++) { - const uint8_t* src_scan = GetScanline(row); - int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - - dest_clip.left; - uint8_t* dest_scan = dest_buf; - if (bYFlip) { - dest_scan += (result_height - 1) * dest_pitch; - } - int dest_step = bYFlip ? -dest_pitch : dest_pitch; - for (int col = col_start; col < col_end; col++) { - if (!(src_scan[col / 8] & (1 << (7 - col % 8)))) { - dest_scan[dest_col / 8] &= ~(1 << (7 - dest_col % 8)); - } - dest_scan += dest_step; - } - } - } else { - int nBytes = GetBPP() / 8; - int dest_step = bYFlip ? -dest_pitch : dest_pitch; - if (nBytes == 3) { - dest_step -= 2; - } - for (int row = row_start; row < row_end; row++) { - int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - - dest_clip.left; - uint8_t* dest_scan = dest_buf + dest_col * nBytes; - if (bYFlip) { - dest_scan += (result_height - 1) * dest_pitch; - } - if (nBytes == 4) { - uint32_t* src_scan = (uint32_t*)GetScanline(row) + col_start; - for (int col = col_start; col < col_end; col++) { - *(uint32_t*)dest_scan = *src_scan++; - dest_scan += dest_step; - } - } else { - const uint8_t* src_scan = GetScanline(row) + col_start * nBytes; - if (nBytes == 1) { - for (int col = col_start; col < col_end; col++) { - *dest_scan = *src_scan++; - dest_scan += dest_step; - } - } else { - for (int col = col_start; col < col_end; col++) { - *dest_scan++ = *src_scan++; - *dest_scan++ = *src_scan++; - *dest_scan = *src_scan++; - dest_scan += dest_step; - } - } - } - } - } - if (m_pAlphaMask) { - dest_pitch = pTransBitmap->m_pAlphaMask->GetPitch(); - dest_buf = pTransBitmap->m_pAlphaMask->GetBuffer(); - int dest_step = bYFlip ? -dest_pitch : dest_pitch; - for (int row = row_start; row < row_end; row++) { - int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - - dest_clip.left; - uint8_t* dest_scan = dest_buf + dest_col; - if (bYFlip) { - dest_scan += (result_height - 1) * dest_pitch; - } - const uint8_t* src_scan = m_pAlphaMask->GetScanline(row) + col_start; - for (int col = col_start; col < col_end; col++) { - *dest_scan = *src_scan++; - dest_scan += dest_step; - } - } - } - return pTransBitmap; -} - #define FIX16_005 0.05f FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, int width, @@ -303,45 +204,6 @@ FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, return rect; } -CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::TransformTo( - const CFX_Matrix* pDestMatrix, - int& result_left, - int& result_top, - uint32_t flags, - const FX_RECT* pDestClip) { - CFX_RetainPtr<CFX_DIBSource> holder(this); - CFX_ImageTransformer transformer(holder, pDestMatrix, flags, pDestClip); - transformer.Start(); - transformer.Continue(nullptr); - result_left = transformer.result().left; - result_top = transformer.result().top; - return transformer.DetachBitmap(); -} - -CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::StretchTo(int dest_width, - int dest_height, - uint32_t flags, - const FX_RECT* pClip) { - CFX_RetainPtr<CFX_DIBSource> holder(this); - FX_RECT clip_rect(0, 0, FXSYS_abs(dest_width), FXSYS_abs(dest_height)); - if (pClip) - clip_rect.Intersect(*pClip); - - if (clip_rect.IsEmpty()) - return nullptr; - - if (dest_width == m_Width && dest_height == m_Height) - return Clone(&clip_rect); - - CFX_BitmapStorer storer; - CFX_ImageStretcher stretcher(&storer, holder, dest_width, dest_height, - clip_rect, flags); - if (stretcher.Start()) - stretcher.Continue(nullptr); - - return storer.Detach(); -} - CFX_ImageTransformer::CFX_ImageTransformer( const CFX_RetainPtr<CFX_DIBSource>& pSrc, const CFX_Matrix* pMatrix, |