Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: core/fxge/include/fx_dib.h

Issue 2149903002: Use smart pointers for various Jbig2 decoding contexts (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fxge/dib/fx_dib_transform.cpp ('k') | core/fxge/include/fx_ge_win32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxge/include/fx_dib.h
diff --git a/core/fxge/include/fx_dib.h b/core/fxge/include/fx_dib.h
index 8d9f27e3f7e98e14166c8bac17661f4f9acf179f..c2ca85958514023b0c96b0f847ffa342f774c76f 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 {
« no previous file with comments | « core/fxge/dib/fx_dib_transform.cpp ('k') | core/fxge/include/fx_ge_win32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698