diff options
author | weili <weili@chromium.org> | 2016-07-21 14:44:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-21 14:44:17 -0700 |
commit | c38cd6eb274429a5755e04d2e22a606375851717 (patch) | |
tree | 158c1e58b7d66a715cd7ba1459c55d329f08c49d /core/fxge/include | |
parent | 1d3348ce0092d6d2a40de5f8433c0d0c16a1e12e (diff) | |
download | pdfium-c38cd6eb274429a5755e04d2e22a606375851717.tar.xz |
Use smart pointers for graphics device classes
Use unique_ptr for class owned member variables. Also clean up some
style issues such as removing unused functions and casting to raw pointer.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2163103002
Diffstat (limited to 'core/fxge/include')
-rw-r--r-- | core/fxge/include/fx_dib.h | 16 | ||||
-rw-r--r-- | core/fxge/include/fx_ge.h | 10 |
2 files changed, 14 insertions, 12 deletions
diff --git a/core/fxge/include/fx_dib.h b/core/fxge/include/fx_dib.h index c2ca859585..540996cfc1 100644 --- a/core/fxge/include/fx_dib.h +++ b/core/fxge/include/fx_dib.h @@ -8,6 +8,7 @@ #define CORE_FXGE_INCLUDE_FX_DIB_H_ #include <memory> +#include <vector> #include "core/fxcrt/include/fx_basic.h" #include "core/fxcrt/include/fx_coordinates.h" @@ -381,10 +382,10 @@ class CFX_DIBExtractor { explicit CFX_DIBExtractor(const CFX_DIBSource* pSrc); ~CFX_DIBExtractor(); - operator CFX_DIBitmap*() { return m_pBitmap; } + CFX_DIBitmap* GetBitmap() { return m_pBitmap.get(); } private: - CFX_DIBitmap* m_pBitmap; + std::unique_ptr<CFX_DIBitmap> m_pBitmap; }; typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef; @@ -399,8 +400,8 @@ class CFX_FilteredDIB : public CFX_DIBSource { virtual uint32_t* GetDestPalette() = 0; - virtual void TranslateScanline(uint8_t* dest_buf, - const uint8_t* src_buf) const = 0; + virtual void TranslateScanline(const uint8_t* src_buf, + std::vector<uint8_t>* dest_buf) const = 0; virtual void TranslateDownSamples(uint8_t* dest_buf, const uint8_t* src_buf, @@ -419,10 +420,8 @@ class CFX_FilteredDIB : public CFX_DIBSource { int clip_width) const override; const CFX_DIBSource* m_pSrc; - FX_BOOL m_bAutoDropSrc; - - uint8_t* m_pScanline; + mutable std::vector<uint8_t> m_Scanline; }; class IFX_ScanlineComposer { @@ -438,6 +437,7 @@ class IFX_ScanlineComposer { FXDIB_Format src_format, uint32_t* pSrcPalette) = 0; }; + class CFX_ScanlineCompositor { public: CFX_ScanlineCompositor(); @@ -663,7 +663,7 @@ class CFX_ImageRenderer { int m_BitmapAlpha; uint32_t m_MaskColor; CFX_Matrix m_Matrix; - CFX_ImageTransformer* m_pTransformer; + std::unique_ptr<CFX_ImageTransformer> m_pTransformer; std::unique_ptr<CFX_ImageStretcher> m_Stretcher; CFX_BitmapComposer m_Composer; int m_Status; diff --git a/core/fxge/include/fx_ge.h b/core/fxge/include/fx_ge.h index dbc4fd0a43..aceaa76a94 100644 --- a/core/fxge/include/fx_ge.h +++ b/core/fxge/include/fx_ge.h @@ -214,9 +214,11 @@ class CFX_RenderDevice { CFX_RenderDevice(); virtual ~CFX_RenderDevice(); - void Flush(); - void SetDeviceDriver(IFX_RenderDeviceDriver* pDriver); - IFX_RenderDeviceDriver* GetDeviceDriver() const { return m_pDeviceDriver; } + // Take ownership of |pDriver|. + void SetDeviceDriver(std::unique_ptr<IFX_RenderDeviceDriver> pDriver); + IFX_RenderDeviceDriver* GetDeviceDriver() const { + return m_pDeviceDriver.get(); + } FX_BOOL StartRendering(); void EndRendering(); @@ -400,7 +402,7 @@ class CFX_RenderDevice { int m_RenderCaps; int m_DeviceClass; FX_RECT m_ClipBox; - IFX_RenderDeviceDriver* m_pDeviceDriver; + std::unique_ptr<IFX_RenderDeviceDriver> m_pDeviceDriver; }; class CFX_FxgeDevice : public CFX_RenderDevice { |