diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-08-24 21:55:46 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-24 21:55:46 +0000 |
commit | e6ff2ebfaa19421c8d932f4d275548156ae2e13c (patch) | |
tree | a549775ce9d4e999f8a23542524adba8c5ca42ea /core/fxge/dib | |
parent | 16d18d935d055b74e05f615c0325318a329a7fe1 (diff) | |
download | pdfium-e6ff2ebfaa19421c8d932f4d275548156ae2e13c.tar.xz |
Rename CFX_DIBSource to CFX_DIBBase.
It is not a source from which you can get CFX_DIBs, but rather a
base class from which all DIBs inherit.
Do the same thing for the CPDF_DIBSource wrapper class.
Mechanical change apart from adding a one-line comment in cfx_dibbase.h
Change-Id: Id2bde87813ca301d9fafc55ce08d703dfc6a7184
Reviewed-on: https://pdfium-review.googlesource.com/41352
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxge/dib')
-rw-r--r-- | core/fxge/dib/cfx_dibbase.cpp (renamed from core/fxge/dib/cfx_dibsource.cpp) | 125 | ||||
-rw-r--r-- | core/fxge/dib/cfx_dibbase.h (renamed from core/fxge/dib/cfx_dibsource.h) | 17 | ||||
-rw-r--r-- | core/fxge/dib/cfx_dibextractor.cpp | 6 | ||||
-rw-r--r-- | core/fxge/dib/cfx_dibextractor.h | 4 | ||||
-rw-r--r-- | core/fxge/dib/cfx_dibitmap.cpp | 24 | ||||
-rw-r--r-- | core/fxge/dib/cfx_dibitmap.h | 24 | ||||
-rw-r--r-- | core/fxge/dib/cfx_filtereddib.cpp | 2 | ||||
-rw-r--r-- | core/fxge/dib/cfx_filtereddib.h | 10 | ||||
-rw-r--r-- | core/fxge/dib/cfx_imagerenderer.cpp | 2 | ||||
-rw-r--r-- | core/fxge/dib/cfx_imagerenderer.h | 4 | ||||
-rw-r--r-- | core/fxge/dib/cfx_imagestretcher.cpp | 6 | ||||
-rw-r--r-- | core/fxge/dib/cfx_imagestretcher.h | 8 | ||||
-rw-r--r-- | core/fxge/dib/cfx_imagetransformer.cpp | 4 | ||||
-rw-r--r-- | core/fxge/dib/cfx_imagetransformer.h | 6 | ||||
-rw-r--r-- | core/fxge/dib/cfx_scanlinecompositor.h | 2 | ||||
-rw-r--r-- | core/fxge/dib/cstretchengine.cpp | 4 | ||||
-rw-r--r-- | core/fxge/dib/cstretchengine.h | 4 | ||||
-rw-r--r-- | core/fxge/dib/cstretchengine_unittest.cpp | 4 |
18 files changed, 127 insertions, 129 deletions
diff --git a/core/fxge/dib/cfx_dibsource.cpp b/core/fxge/dib/cfx_dibbase.cpp index 4608b51802..79150ba616 100644 --- a/core/fxge/dib/cfx_dibsource.cpp +++ b/core/fxge/dib/cfx_dibbase.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" #include <algorithm> #include <memory> @@ -49,7 +49,7 @@ void Obtain_Pal(std::pair<uint32_t, uint32_t>* luts, class CFX_Palette { public: - explicit CFX_Palette(const RetainPtr<CFX_DIBSource>& pBitmap); + explicit CFX_Palette(const RetainPtr<CFX_DIBBase>& pBitmap); ~CFX_Palette(); const uint32_t* GetPalette() { return m_Palette.data(); } @@ -64,7 +64,7 @@ class CFX_Palette { int m_lut; }; -CFX_Palette::CFX_Palette(const RetainPtr<CFX_DIBSource>& pBitmap) +CFX_Palette::CFX_Palette(const RetainPtr<CFX_DIBBase>& pBitmap) : m_Palette(256), m_Luts(4096), m_lut(0) { int bpp = pBitmap->GetBPP() / 8; int width = pBitmap->GetWidth(); @@ -102,7 +102,7 @@ void ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { static constexpr uint8_t kSetGray = 0xff; @@ -123,7 +123,7 @@ void ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; ++row) { @@ -137,7 +137,7 @@ void ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { uint32_t* src_plt = pSrcBitmap->GetPalette(); @@ -182,7 +182,7 @@ void ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { uint32_t* src_plt = pSrcBitmap->GetPalette(); @@ -216,7 +216,7 @@ void ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int Bpp = pSrcBitmap->GetBPP() / 8; @@ -255,7 +255,7 @@ void ConvertBuffer_IndexCopy(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { if (pSrcBitmap->GetBPP() == 1) { @@ -286,7 +286,7 @@ void ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, uint32_t* dst_plt) { @@ -313,7 +313,7 @@ void ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, uint32_t* dst_plt) { @@ -372,7 +372,7 @@ void ConvertBuffer_1bppMask2Rgb(FXDIB_Format dest_format, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int comps = GetCompsFromFormat(dest_format); @@ -401,7 +401,7 @@ void ConvertBuffer_8bppMask2Rgb(FXDIB_Format dest_format, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int comps = GetCompsFromFormat(dest_format); @@ -424,7 +424,7 @@ void ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dest_format, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int comps = GetCompsFromFormat(dest_format); @@ -475,7 +475,7 @@ void ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dest_format, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int comps = GetCompsFromFormat(dest_format); @@ -518,7 +518,7 @@ void ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; ++row) { @@ -533,7 +533,7 @@ void ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; ++row) { @@ -553,7 +553,7 @@ void ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int comps = pSrcBitmap->GetBPP() / 8; @@ -575,7 +575,7 @@ void ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; ++row) { @@ -596,7 +596,7 @@ bool ConvertBuffer_8bppMask(int bpp, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { switch (bpp) { @@ -634,7 +634,7 @@ bool ConvertBuffer_Rgb(int bpp, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { switch (bpp) { @@ -676,7 +676,7 @@ bool ConvertBuffer_Argb(int bpp, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { switch (bpp) { @@ -715,21 +715,20 @@ bool ConvertBuffer_Argb(int bpp, } // namespace -CFX_DIBSource::CFX_DIBSource() +CFX_DIBBase::CFX_DIBBase() : m_Width(0), m_Height(0), m_bpp(0), m_AlphaFlag(0), m_Pitch(0) {} -CFX_DIBSource::~CFX_DIBSource() {} +CFX_DIBBase::~CFX_DIBBase() {} -uint8_t* CFX_DIBSource::GetBuffer() const { +uint8_t* CFX_DIBBase::GetBuffer() const { return nullptr; } -bool CFX_DIBSource::SkipToScanline(int line, - PauseIndicatorIface* pPause) const { +bool CFX_DIBBase::SkipToScanline(int line, PauseIndicatorIface* pPause) const { return false; } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::Clone(const FX_RECT* pClip) const { +RetainPtr<CFX_DIBitmap> CFX_DIBBase::Clone(const FX_RECT* pClip) const { FX_RECT rect(0, 0, m_Width, m_Height); if (pClip) { rect.Intersect(*pClip); @@ -770,7 +769,7 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::Clone(const FX_RECT* pClip) const { return pNewBitmap; } -void CFX_DIBSource::BuildPalette() { +void CFX_DIBBase::BuildPalette() { if (m_pPalette) return; @@ -795,7 +794,7 @@ void CFX_DIBSource::BuildPalette() { } } -bool CFX_DIBSource::BuildAlphaMask() { +bool CFX_DIBBase::BuildAlphaMask() { if (m_pAlphaMask) return true; @@ -809,7 +808,7 @@ bool CFX_DIBSource::BuildAlphaMask() { return true; } -uint32_t CFX_DIBSource::GetPaletteArgb(int index) const { +uint32_t CFX_DIBBase::GetPaletteArgb(int index) const { ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask()); if (m_pPalette) return m_pPalette.get()[index]; @@ -826,7 +825,7 @@ uint32_t CFX_DIBSource::GetPaletteArgb(int index) const { return index * 0x10101 | 0xff000000; } -void CFX_DIBSource::SetPaletteArgb(int index, uint32_t color) { +void CFX_DIBBase::SetPaletteArgb(int index, uint32_t color) { ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask()); if (!m_pPalette) { BuildPalette(); @@ -834,7 +833,7 @@ void CFX_DIBSource::SetPaletteArgb(int index, uint32_t color) { m_pPalette.get()[index] = color; } -int CFX_DIBSource::FindPalette(uint32_t color) const { +int CFX_DIBBase::FindPalette(uint32_t color) const { ASSERT((GetBPP() == 1 || GetBPP() == 8) && !IsAlphaMask()); if (!m_pPalette) { if (IsCmykImage()) { @@ -856,15 +855,15 @@ int CFX_DIBSource::FindPalette(uint32_t color) const { return -1; } -void CFX_DIBSource::GetOverlapRect(int& dest_left, - int& dest_top, - int& width, - int& height, - int src_width, - int src_height, - int& src_left, - int& src_top, - const CFX_ClipRgn* pClipRgn) { +void CFX_DIBBase::GetOverlapRect(int& dest_left, + int& dest_top, + int& width, + int& height, + int src_width, + int src_height, + int& src_left, + int& src_top, + const CFX_ClipRgn* pClipRgn) { if (width == 0 || height == 0) return; @@ -893,7 +892,7 @@ void CFX_DIBSource::GetOverlapRect(int& dest_left, height = dest_rect.bottom - dest_rect.top; } -void CFX_DIBSource::SetPalette(const uint32_t* pSrc) { +void CFX_DIBBase::SetPalette(const uint32_t* pSrc) { static const uint32_t kPaletteSize = 256; if (!pSrc || GetBPP() > 8) { m_pPalette.reset(); @@ -906,7 +905,7 @@ void CFX_DIBSource::SetPalette(const uint32_t* pSrc) { memcpy(m_pPalette.get(), pSrc, pal_size * sizeof(uint32_t)); } -void CFX_DIBSource::GetPalette(uint32_t* pal, int alpha) const { +void CFX_DIBBase::GetPalette(uint32_t* pal, int alpha) const { ASSERT(GetBPP() <= 8 && !IsCmykImage()); if (GetBPP() == 1) { pal[0] = ((m_pPalette ? m_pPalette.get()[0] : 0xff000000) & 0xffffff) | @@ -924,7 +923,7 @@ void CFX_DIBSource::GetPalette(uint32_t* pal, int alpha) const { } } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneAlphaMask() const { +RetainPtr<CFX_DIBitmap> CFX_DIBBase::CloneAlphaMask() const { ASSERT(GetFormat() == FXDIB_Argb); FX_RECT rect(0, 0, m_Width, m_Height); auto pMask = pdfium::MakeRetain<CFX_DIBitmap>(); @@ -942,8 +941,8 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneAlphaMask() const { return pMask; } -bool CFX_DIBSource::SetAlphaMask(const RetainPtr<CFX_DIBSource>& pAlphaMask, - const FX_RECT* pClip) { +bool CFX_DIBBase::SetAlphaMask(const RetainPtr<CFX_DIBBase>& pAlphaMask, + const FX_RECT* pClip) { if (!HasAlpha() || GetFormat() == FXDIB_Argb) return false; @@ -970,8 +969,7 @@ bool CFX_DIBSource::SetAlphaMask(const RetainPtr<CFX_DIBSource>& pAlphaMask, return true; } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::FlipImage(bool bXFlip, - bool bYFlip) const { +RetainPtr<CFX_DIBitmap> CFX_DIBBase::FlipImage(bool bXFlip, bool bYFlip) const { auto pFlipped = pdfium::MakeRetain<CFX_DIBitmap>(); if (!pFlipped->Create(m_Width, m_Height, GetFormat())) return nullptr; @@ -1042,7 +1040,7 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::FlipImage(bool bXFlip, return pFlipped; } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) { +RetainPtr<CFX_DIBitmap> CFX_DIBBase::CloneConvert(FXDIB_Format dest_format) { if (dest_format == GetFormat()) return Clone(nullptr); @@ -1068,7 +1066,7 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) { return nullptr; } - RetainPtr<CFX_DIBSource> holder(this); + RetainPtr<CFX_DIBBase> holder(this); std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp; if (!ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(), m_Width, m_Height, holder, 0, 0, &pal_8bpp)) { @@ -1080,7 +1078,7 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) { return pClone; } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY(bool bXFlip, bool bYFlip) const { +RetainPtr<CFX_DIBitmap> CFX_DIBBase::SwapXY(bool bXFlip, bool bYFlip) const { FX_RECT dest_clip(0, 0, m_Height, m_Width); if (dest_clip.IsEmpty()) return nullptr; @@ -1170,11 +1168,10 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY(bool bXFlip, bool bYFlip) const { return pTransBitmap; } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::TransformTo( - const CFX_Matrix* pDestMatrix, - int* result_left, - int* result_top) { - RetainPtr<CFX_DIBSource> holder(this); +RetainPtr<CFX_DIBitmap> CFX_DIBBase::TransformTo(const CFX_Matrix* pDestMatrix, + int* result_left, + int* result_top) { + RetainPtr<CFX_DIBBase> holder(this); CFX_ImageTransformer transformer(holder, pDestMatrix, 0, nullptr); transformer.Continue(nullptr); *result_left = transformer.result().left; @@ -1182,11 +1179,11 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::TransformTo( return transformer.DetachBitmap(); } -RetainPtr<CFX_DIBitmap> CFX_DIBSource::StretchTo(int dest_width, - int dest_height, - uint32_t flags, - const FX_RECT* pClip) { - RetainPtr<CFX_DIBSource> holder(this); +RetainPtr<CFX_DIBitmap> CFX_DIBBase::StretchTo(int dest_width, + int dest_height, + uint32_t flags, + const FX_RECT* pClip) { + RetainPtr<CFX_DIBBase> holder(this); FX_RECT clip_rect(0, 0, abs(dest_width), abs(dest_height)); if (pClip) clip_rect.Intersect(*pClip); @@ -1207,13 +1204,13 @@ RetainPtr<CFX_DIBitmap> CFX_DIBSource::StretchTo(int dest_width, } // static -bool CFX_DIBSource::ConvertBuffer( +bool CFX_DIBBase::ConvertBuffer( FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, std::unique_ptr<uint32_t, FxFreeDeleter>* p_pal) { diff --git a/core/fxge/dib/cfx_dibsource.h b/core/fxge/dib/cfx_dibbase.h index 064dbe2055..ef35fc86e7 100644 --- a/core/fxge/dib/cfx_dibsource.h +++ b/core/fxge/dib/cfx_dibbase.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef CORE_FXGE_DIB_CFX_DIBSOURCE_H_ -#define CORE_FXGE_DIB_CFX_DIBSOURCE_H_ +#ifndef CORE_FXGE_DIB_CFX_DIBBASE_H_ +#define CORE_FXGE_DIB_CFX_DIBBASE_H_ #include <memory> @@ -29,9 +29,10 @@ class CFX_ClipRgn; class CFX_DIBitmap; class PauseIndicatorIface; -class CFX_DIBSource : public Retainable { +// Base class for all Device-Indepenent Bitmaps. +class CFX_DIBBase : public Retainable { public: - ~CFX_DIBSource() override; + ~CFX_DIBBase() override; virtual uint8_t* GetBuffer() const; virtual const uint8_t* GetScanline(int line) const = 0; @@ -90,7 +91,7 @@ class CFX_DIBSource : public Retainable { RetainPtr<CFX_DIBitmap> CloneAlphaMask() const; // Copies into internally-owned mask. - bool SetAlphaMask(const RetainPtr<CFX_DIBSource>& pAlphaMask, + bool SetAlphaMask(const RetainPtr<CFX_DIBBase>& pAlphaMask, const FX_RECT* pClip); void GetOverlapRect(int& dest_left, @@ -110,14 +111,14 @@ class CFX_DIBSource : public Retainable { RetainPtr<CFX_DIBitmap> m_pAlphaMask; protected: - CFX_DIBSource(); + CFX_DIBBase(); static bool ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitch, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, std::unique_ptr<uint32_t, FxFreeDeleter>* pal); @@ -136,4 +137,4 @@ class CFX_DIBSource : public Retainable { std::unique_ptr<uint32_t, FxFreeDeleter> m_pPalette; }; -#endif // CORE_FXGE_DIB_CFX_DIBSOURCE_H_ +#endif // CORE_FXGE_DIB_CFX_DIBBASE_H_ diff --git a/core/fxge/dib/cfx_dibextractor.cpp b/core/fxge/dib/cfx_dibextractor.cpp index 9fe3114b1f..8211dc725a 100644 --- a/core/fxge/dib/cfx_dibextractor.cpp +++ b/core/fxge/dib/cfx_dibextractor.cpp @@ -6,14 +6,14 @@ #include "core/fxge/dib/cfx_dibextractor.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" -CFX_DIBExtractor::CFX_DIBExtractor(const RetainPtr<CFX_DIBSource>& pSrc) { +CFX_DIBExtractor::CFX_DIBExtractor(const RetainPtr<CFX_DIBBase>& pSrc) { if (!pSrc->GetBuffer()) { m_pBitmap = pSrc->Clone(nullptr); return; } - RetainPtr<CFX_DIBSource> pOldSrc(pSrc); + RetainPtr<CFX_DIBBase> pOldSrc(pSrc); m_pBitmap = pdfium::MakeRetain<CFX_DIBitmap>(); if (!m_pBitmap->Create(pOldSrc->GetWidth(), pOldSrc->GetHeight(), pOldSrc->GetFormat(), pOldSrc->GetBuffer(), 0)) { diff --git a/core/fxge/dib/cfx_dibextractor.h b/core/fxge/dib/cfx_dibextractor.h index b6c27a7bd7..cd97f20aac 100644 --- a/core/fxge/dib/cfx_dibextractor.h +++ b/core/fxge/dib/cfx_dibextractor.h @@ -10,11 +10,11 @@ #include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_dibitmap.h" -class CFX_DIBSource; +class CFX_DIBBase; class CFX_DIBExtractor { public: - explicit CFX_DIBExtractor(const RetainPtr<CFX_DIBSource>& pSrc); + explicit CFX_DIBExtractor(const RetainPtr<CFX_DIBBase>& pSrc); ~CFX_DIBExtractor(); RetainPtr<CFX_DIBitmap> GetBitmap() { return m_pBitmap; } diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index 2c99bd16e0..89cfbb68d3 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -85,7 +85,7 @@ bool CFX_DIBitmap::Create(int width, return false; } -bool CFX_DIBitmap::Copy(const RetainPtr<CFX_DIBSource>& pSrc) { +bool CFX_DIBitmap::Copy(const RetainPtr<CFX_DIBBase>& pSrc) { if (m_pBuffer) return false; @@ -188,7 +188,7 @@ bool CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { if (!m_pBuffer) @@ -223,7 +223,7 @@ bool CFX_DIBitmap::TransferWithUnequalFormats( int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { if (m_pPalette) @@ -247,7 +247,7 @@ void CFX_DIBitmap::TransferWithMultipleBPP( int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { int Bpp = GetBPP() / 8; @@ -265,7 +265,7 @@ void CFX_DIBitmap::TransferEqualFormatsOneBPP( int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; ++row) { @@ -283,12 +283,12 @@ void CFX_DIBitmap::TransferEqualFormatsOneBPP( } bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, FXDIB_Channel srcChannel) { if (!m_pBuffer) return false; - RetainPtr<CFX_DIBSource> pSrcClone = pSrcBitmap; + RetainPtr<CFX_DIBBase> pSrcClone = pSrcBitmap; int srcOffset; if (srcChannel == FXDIB_Alpha) { if (!pSrcBitmap->HasAlpha() && !pSrcBitmap->IsAlphaMask()) @@ -348,7 +348,7 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, destOffset = kChannelOffset[destChannel]; } if (srcChannel == FXDIB_Alpha && pSrcClone->m_pAlphaMask) { - RetainPtr<CFX_DIBSource> pAlphaMask = pSrcClone->m_pAlphaMask; + RetainPtr<CFX_DIBBase> pAlphaMask = pSrcClone->m_pAlphaMask; if (pSrcClone->GetWidth() != m_Width || pSrcClone->GetHeight() != m_Height) { if (pAlphaMask) { @@ -446,7 +446,7 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) { return true; } -bool CFX_DIBitmap::MultiplyAlpha(const RetainPtr<CFX_DIBSource>& pSrcBitmap) { +bool CFX_DIBitmap::MultiplyAlpha(const RetainPtr<CFX_DIBBase>& pSrcBitmap) { if (!m_pBuffer) return false; @@ -881,7 +881,7 @@ bool CFX_DIBitmap::CompositeBitmap(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, int blend_type, @@ -952,7 +952,7 @@ bool CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pMask, + const RetainPtr<CFX_DIBBase>& pMask, uint32_t color, int src_left, int src_top, @@ -1266,7 +1266,7 @@ bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { } } bool ret = false; - RetainPtr<CFX_DIBSource> holder(this); + RetainPtr<CFX_DIBBase> holder(this); std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp; ret = ConvertBuffer(dest_format, dest_buf.get(), dest_pitch, m_Width, m_Height, holder, 0, 0, &pal_8bpp); diff --git a/core/fxge/dib/cfx_dibitmap.h b/core/fxge/dib/cfx_dibitmap.h index d9afee6800..dc6720ed96 100644 --- a/core/fxge/dib/cfx_dibitmap.h +++ b/core/fxge/dib/cfx_dibitmap.h @@ -10,10 +10,10 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/maybe_owned.h" #include "core/fxcrt/retain_ptr.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "third_party/base/stl_util.h" -class CFX_DIBitmap : public CFX_DIBSource { +class CFX_DIBitmap : public CFX_DIBBase { public: template <typename T, typename... Args> friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); @@ -26,9 +26,9 @@ class CFX_DIBitmap : public CFX_DIBSource { uint8_t* pBuffer, uint32_t pitch); - bool Copy(const RetainPtr<CFX_DIBSource>& pSrc); + bool Copy(const RetainPtr<CFX_DIBBase>& pSrc); - // CFX_DIBSource + // CFX_DIBBase uint8_t* GetBuffer() const override; const uint8_t* GetScanline(int line) const override; void DownSampleScanline(int line, @@ -47,18 +47,18 @@ class CFX_DIBitmap : public CFX_DIBSource { void SetPixel(int x, int y, uint32_t color); bool LoadChannel(FXDIB_Channel destChannel, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, FXDIB_Channel srcChannel); bool LoadChannel(FXDIB_Channel destChannel, int value); bool MultiplyAlpha(int alpha); - bool MultiplyAlpha(const RetainPtr<CFX_DIBSource>& pAlphaMask); + bool MultiplyAlpha(const RetainPtr<CFX_DIBBase>& pAlphaMask); bool TransferBitmap(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top); @@ -66,7 +66,7 @@ class CFX_DIBitmap : public CFX_DIBSource { int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top, int blend_type, @@ -77,7 +77,7 @@ class CFX_DIBitmap : public CFX_DIBSource { int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pMask, + const RetainPtr<CFX_DIBBase>& pMask, uint32_t color, int src_left, int src_top, @@ -130,21 +130,21 @@ class CFX_DIBitmap : public CFX_DIBSource { int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top); void TransferWithMultipleBPP(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top); void TransferEqualFormatsOneBPP(int dest_left, int dest_top, int width, int height, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int src_left, int src_top); }; diff --git a/core/fxge/dib/cfx_filtereddib.cpp b/core/fxge/dib/cfx_filtereddib.cpp index 1d5ed6200c..297a099a4c 100644 --- a/core/fxge/dib/cfx_filtereddib.cpp +++ b/core/fxge/dib/cfx_filtereddib.cpp @@ -12,7 +12,7 @@ CFX_FilteredDIB::CFX_FilteredDIB() {} CFX_FilteredDIB::~CFX_FilteredDIB() {} -void CFX_FilteredDIB::LoadSrc(const RetainPtr<CFX_DIBSource>& pSrc) { +void CFX_FilteredDIB::LoadSrc(const RetainPtr<CFX_DIBBase>& pSrc) { m_pSrc = pSrc; m_Width = pSrc->GetWidth(); m_Height = pSrc->GetHeight(); diff --git a/core/fxge/dib/cfx_filtereddib.h b/core/fxge/dib/cfx_filtereddib.h index 9c1efa544d..ec32a787c4 100644 --- a/core/fxge/dib/cfx_filtereddib.h +++ b/core/fxge/dib/cfx_filtereddib.h @@ -10,9 +10,9 @@ #include <vector> #include "core/fxcrt/retain_ptr.h" -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" -class CFX_FilteredDIB : public CFX_DIBSource { +class CFX_FilteredDIB : public CFX_DIBBase { public: template <typename T, typename... Args> friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); @@ -26,13 +26,13 @@ class CFX_FilteredDIB : public CFX_DIBSource { int pixels, int Bpp) const = 0; - void LoadSrc(const RetainPtr<CFX_DIBSource>& pSrc); + void LoadSrc(const RetainPtr<CFX_DIBBase>& pSrc); protected: CFX_FilteredDIB(); ~CFX_FilteredDIB() override; - // CFX_DIBSource + // CFX_DIBBase const uint8_t* GetScanline(int line) const override; void DownSampleScanline(int line, uint8_t* dest_scan, @@ -42,7 +42,7 @@ class CFX_FilteredDIB : public CFX_DIBSource { int clip_left, int clip_width) const override; - RetainPtr<CFX_DIBSource> m_pSrc; + RetainPtr<CFX_DIBBase> m_pSrc; mutable std::vector<uint8_t> m_Scanline; }; diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp index a196068a2e..64c484f24d 100644 --- a/core/fxge/dib/cfx_imagerenderer.cpp +++ b/core/fxge/dib/cfx_imagerenderer.cpp @@ -15,7 +15,7 @@ CFX_ImageRenderer::CFX_ImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice, const CFX_ClipRgn* pClipRgn, - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, int bitmap_alpha, uint32_t mask_color, const CFX_Matrix* pMatrix, diff --git a/core/fxge/dib/cfx_imagerenderer.h b/core/fxge/dib/cfx_imagerenderer.h index 14eaf56ff8..905ff8c25d 100644 --- a/core/fxge/dib/cfx_imagerenderer.h +++ b/core/fxge/dib/cfx_imagerenderer.h @@ -13,8 +13,8 @@ #include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" #include "core/fxge/dib/cfx_bitmapcomposer.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/dib/cfx_dibitmap.h" -#include "core/fxge/dib/cfx_dibsource.h" #include "core/fxge/fx_dib.h" #include "third_party/base/stl_util.h" @@ -25,7 +25,7 @@ class CFX_ImageRenderer { public: CFX_ImageRenderer(const RetainPtr<CFX_DIBitmap>& pDevice, const CFX_ClipRgn* pClipRgn, - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, int bitmap_alpha, uint32_t mask_color, const CFX_Matrix* pMatrix, diff --git a/core/fxge/dib/cfx_imagestretcher.cpp b/core/fxge/dib/cfx_imagestretcher.cpp index 1c54e3fdd0..809d3b12dd 100644 --- a/core/fxge/dib/cfx_imagestretcher.cpp +++ b/core/fxge/dib/cfx_imagestretcher.cpp @@ -9,8 +9,8 @@ #include <climits> #include <tuple> +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/dib/cfx_dibitmap.h" -#include "core/fxge/dib/cfx_dibsource.h" #include "core/fxge/dib/cstretchengine.h" #include "core/fxge/fx_dib.h" #include "third_party/base/ptr_util.h" @@ -23,7 +23,7 @@ bool SourceSizeWithinLimit(int width, int height) { return !height || width < kMaxProgressiveStretchPixels / height; } -FXDIB_Format GetStretchedFormat(const CFX_DIBSource& src) { +FXDIB_Format GetStretchedFormat(const CFX_DIBBase& src) { FXDIB_Format format = src.GetFormat(); if (format == FXDIB_1bppMask) return FXDIB_8bppMask; @@ -43,7 +43,7 @@ std::tuple<int, int, int, int> CmykDecode(const uint32_t cmyk) { } // namespace CFX_ImageStretcher::CFX_ImageStretcher(ScanlineComposerIface* pDest, - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, int dest_width, int dest_height, const FX_RECT& bitmap_rect, diff --git a/core/fxge/dib/cfx_imagestretcher.h b/core/fxge/dib/cfx_imagestretcher.h index 113372571b..8e866620fd 100644 --- a/core/fxge/dib/cfx_imagestretcher.h +++ b/core/fxge/dib/cfx_imagestretcher.h @@ -16,13 +16,13 @@ #include "core/fxge/dib/scanlinecomposer_iface.h" #include "core/fxge/fx_dib.h" -class CFX_DIBSource; +class CFX_DIBBase; class PauseIndicatorIface; class CFX_ImageStretcher { public: CFX_ImageStretcher(ScanlineComposerIface* pDest, - const RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBBase>& pSource, int dest_width, int dest_height, const FX_RECT& bitmap_rect, @@ -32,7 +32,7 @@ class CFX_ImageStretcher { bool Start(); bool Continue(PauseIndicatorIface* pPause); - RetainPtr<CFX_DIBSource> source() { return m_pSource; } + RetainPtr<CFX_DIBBase> source() { return m_pSource; } private: bool StartQuickStretch(); @@ -41,7 +41,7 @@ class CFX_ImageStretcher { bool ContinueStretch(PauseIndicatorIface* pPause); UnownedPtr<ScanlineComposerIface> const m_pDest; - RetainPtr<CFX_DIBSource> m_pSource; + RetainPtr<CFX_DIBBase> m_pSource; std::unique_ptr<CStretchEngine> m_pStretchEngine; std::unique_ptr<uint8_t, FxFreeDeleter> m_pScanline; std::unique_ptr<uint8_t, FxFreeDeleter> m_pMaskScanline; diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp index c41ac2bdf2..0042462c89 100644 --- a/core/fxge/dib/cfx_imagetransformer.cpp +++ b/core/fxge/dib/cfx_imagetransformer.cpp @@ -99,7 +99,7 @@ void bicubic_get_pos_weight(int pos_pixel[], v_w[3] = SDP_Table[512 - res_y]; } -FXDIB_Format GetTransformedFormat(const RetainPtr<CFX_DIBSource>& pDrc) { +FXDIB_Format GetTransformedFormat(const RetainPtr<CFX_DIBBase>& pDrc) { if (pDrc->IsAlphaMask()) return FXDIB_8bppMask; @@ -200,7 +200,7 @@ class CFX_BilinearMatrix : public CPDF_FixedMatrix { } // namespace -CFX_ImageTransformer::CFX_ImageTransformer(const RetainPtr<CFX_DIBSource>& pSrc, +CFX_ImageTransformer::CFX_ImageTransformer(const RetainPtr<CFX_DIBBase>& pSrc, const CFX_Matrix* pMatrix, int flags, const FX_RECT* pClip) diff --git a/core/fxge/dib/cfx_imagetransformer.h b/core/fxge/dib/cfx_imagetransformer.h index a5b8841611..61fe1e1ba1 100644 --- a/core/fxge/dib/cfx_imagetransformer.h +++ b/core/fxge/dib/cfx_imagetransformer.h @@ -13,14 +13,14 @@ #include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" #include "core/fxge/dib/cfx_bitmapstorer.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/dib/cfx_dibitmap.h" -#include "core/fxge/dib/cfx_dibsource.h" class CFX_ImageStretcher; class CFX_ImageTransformer { public: - CFX_ImageTransformer(const RetainPtr<CFX_DIBSource>& pSrc, + CFX_ImageTransformer(const RetainPtr<CFX_DIBBase>& pSrc, const CFX_Matrix* pMatrix, int flags, const FX_RECT* pClip); @@ -98,7 +98,7 @@ class CFX_ImageTransformer { int increment, std::function<void(const DownSampleData&, uint8_t*)> func); - const RetainPtr<CFX_DIBSource> m_pSrc; + const RetainPtr<CFX_DIBBase> m_pSrc; UnownedPtr<const CFX_Matrix> const m_pMatrix; const FX_RECT* const m_pClip; FX_RECT m_StretchClip; diff --git a/core/fxge/dib/cfx_scanlinecompositor.h b/core/fxge/dib/cfx_scanlinecompositor.h index 75ab578128..1c373f036b 100644 --- a/core/fxge/dib/cfx_scanlinecompositor.h +++ b/core/fxge/dib/cfx_scanlinecompositor.h @@ -9,7 +9,7 @@ #include <memory> -#include "core/fxge/dib/cfx_dibsource.h" +#include "core/fxge/dib/cfx_dibbase.h" class CFX_ScanlineCompositor { public: diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp index ad9a356f34..41a843de66 100644 --- a/core/fxge/dib/cstretchengine.cpp +++ b/core/fxge/dib/cstretchengine.cpp @@ -10,8 +10,8 @@ #include <utility> #include "core/fxcrt/pauseindicator_iface.h" +#include "core/fxge/dib/cfx_dibbase.h" #include "core/fxge/dib/cfx_dibitmap.h" -#include "core/fxge/dib/cfx_dibsource.h" #include "core/fxge/dib/scanlinecomposer_iface.h" #include "core/fxge/fx_dib.h" @@ -227,7 +227,7 @@ CStretchEngine::CStretchEngine(ScanlineComposerIface* pDestBitmap, int dest_width, int dest_height, const FX_RECT& clip_rect, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int flags) : m_DestFormat(dest_format), m_DestBpp(GetBppFromFormat(dest_format)), diff --git a/core/fxge/dib/cstretchengine.h b/core/fxge/dib/cstretchengine.h index c9f11d6006..db7a2be56d 100644 --- a/core/fxge/dib/cstretchengine.h +++ b/core/fxge/dib/cstretchengine.h @@ -24,7 +24,7 @@ class CStretchEngine { int dest_width, int dest_height, const FX_RECT& clip_rect, - const RetainPtr<CFX_DIBSource>& pSrcBitmap, + const RetainPtr<CFX_DIBBase>& pSrcBitmap, int flags); ~CStretchEngine(); @@ -80,7 +80,7 @@ class CStretchEngine { const int m_DestBpp; const int m_SrcBpp; const int m_bHasAlpha; - RetainPtr<CFX_DIBSource> const m_pSource; + RetainPtr<CFX_DIBBase> const m_pSource; const uint32_t* m_pSrcPalette; const int m_SrcWidth; const int m_SrcHeight; diff --git a/core/fxge/dib/cstretchengine_unittest.cpp b/core/fxge/dib/cstretchengine_unittest.cpp index 2c7e0342de..8169cae328 100644 --- a/core/fxge/dib/cstretchengine_unittest.cpp +++ b/core/fxge/dib/cstretchengine_unittest.cpp @@ -10,7 +10,7 @@ #include "core/fpdfapi/parser/cpdf_dictionary.h" #include "core/fpdfapi/parser/cpdf_number.h" #include "core/fpdfapi/parser/cpdf_stream.h" -#include "core/fpdfapi/render/cpdf_dibsource.h" +#include "core/fpdfapi/render/cpdf_dibbase.h" #include "core/fxcrt/fx_memory.h" #include "core/fxge/fx_dib.h" #include "testing/gtest/include/gtest/gtest.h" @@ -24,7 +24,7 @@ TEST(CStretchEngine, OverflowInCtor) { dict_obj->SetNewFor<CPDF_Number>("Height", 12500); std::unique_ptr<CPDF_Stream> stream = pdfium::MakeUnique<CPDF_Stream>(nullptr, 0, std::move(dict_obj)); - auto dib_source = pdfium::MakeRetain<CPDF_DIBSource>(); + auto dib_source = pdfium::MakeRetain<CPDF_DIBBase>(); dib_source->Load(nullptr, stream.get()); CStretchEngine engine(nullptr, FXDIB_8bppRgb, 500, 500, clip_rect, dib_source, 0); |