summaryrefslogtreecommitdiff
path: root/core/fxge/include/fx_dib.h
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-07-19 16:06:10 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-19 16:06:10 -0700
commit8ca60b2cda3efc112c987c1d57d1eb8568667da9 (patch)
treeb9170a729249b4f4aa8751e2f713afed77fca15b /core/fxge/include/fx_dib.h
parent5b36f0a0eff7f3666a0e642640db3c89e4bb6748 (diff)
downloadpdfium-8ca60b2cda3efc112c987c1d57d1eb8568667da9.tar.xz
Use smart pointers for various Jbig2 decoding contexts
Use unique_ptr for class owned member variables, and remove unnecessary or unused functions and member variable. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2149903002
Diffstat (limited to 'core/fxge/include/fx_dib.h')
-rw-r--r--core/fxge/include/fx_dib.h34
1 files changed, 17 insertions, 17 deletions
diff --git a/core/fxge/include/fx_dib.h b/core/fxge/include/fx_dib.h
index 8d9f27e3f7..c2ca859585 100644
--- a/core/fxge/include/fx_dib.h
+++ b/core/fxge/include/fx_dib.h
@@ -164,21 +164,12 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format,
const CFX_DIBSource* pSrcBitmap,
int src_left,
int src_top,
- uint32_t*& pal);
+ std::unique_ptr<uint32_t, FxFreeDeleter>* pal);
class CFX_DIBSource {
public:
virtual ~CFX_DIBSource();
- int GetWidth() const { return m_Width; }
- int GetHeight() const { return m_Height; }
-
- FXDIB_Format GetFormat() const {
- return (FXDIB_Format)(m_AlphaFlag * 0x100 + m_bpp);
- }
- uint32_t GetPitch() const { return m_Pitch; }
- uint32_t* GetPalette() const { return m_pPalette; }
-
virtual uint8_t* GetBuffer() const;
virtual const uint8_t* GetScanline(int line) const = 0;
virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const;
@@ -190,6 +181,14 @@ class CFX_DIBSource {
int clip_left,
int clip_width) const = 0;
+ int GetWidth() const { return m_Width; }
+ int GetHeight() const { return m_Height; }
+
+ FXDIB_Format GetFormat() const {
+ return (FXDIB_Format)(m_AlphaFlag * 0x100 + m_bpp);
+ }
+ uint32_t GetPitch() const { return m_Pitch; }
+ uint32_t* GetPalette() const { return m_pPalette.get(); }
int GetBPP() const { return m_bpp; }
// TODO(thestig): Investigate this. Given the possible values of FXDIB_Format,
@@ -212,7 +211,7 @@ class CFX_DIBSource {
SetPaletteEntry(index, color);
}
- void CopyPalette(const uint32_t* pSrcPal, uint32_t size = 256);
+ void CopyPalette(const uint32_t* pSrcPal);
CFX_DIBitmap* Clone(const FX_RECT* pClip = nullptr) const;
CFX_DIBitmap* CloneConvert(FXDIB_Format format) const;
@@ -256,17 +255,18 @@ class CFX_DIBSource {
protected:
CFX_DIBSource();
+ void BuildPalette();
+ FX_BOOL BuildAlphaMask();
+ int FindPalette(uint32_t color) const;
+ void GetPalette(uint32_t* pal, int alpha) const;
+
int m_Width;
int m_Height;
int m_bpp;
uint32_t m_AlphaFlag;
uint32_t m_Pitch;
- uint32_t* m_pPalette;
-
- void BuildPalette();
- FX_BOOL BuildAlphaMask();
- int FindPalette(uint32_t color) const;
- void GetPalette(uint32_t* pal, int alpha) const;
+ // TODO(weili): Use std::vector for this.
+ std::unique_ptr<uint32_t, FxFreeDeleter> m_pPalette;
};
class CFX_DIBitmap : public CFX_DIBSource {