diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-03-27 13:51:46 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-28 14:14:50 +0000 |
commit | 0004f29bf6ee3c6060a272c79f14993e92e053c7 (patch) | |
tree | b82385e4853a157e10148af8d95ebb6bae4fb4c7 /core/fxge/win32/win32_int.h | |
parent | 369fe1f7f9f3a424ee3cf8f992c3128db27fa479 (diff) | |
download | pdfium-0004f29bf6ee3c6060a272c79f14993e92e053c7.tar.xz |
Refcount all CFX_DIBSources (and subclasses) all the time.
There are currently several ownership models for these objects,
including ad-hoc logic for sharing and deletion, and the
now-redundant CFX_DIBitmapRef externally-counted handle to the DIBs.
Replace them all with the internal refcount scheme.
Change-Id: I2db399dfc19219eda384f94cc989353b78ce2872
Reviewed-on: https://pdfium-review.googlesource.com/3166
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/win32/win32_int.h')
-rw-r--r-- | core/fxge/win32/win32_int.h | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h index 54ea3716e1..35521d0096 100644 --- a/core/fxge/win32/win32_int.h +++ b/core/fxge/win32/win32_int.h @@ -34,7 +34,7 @@ class CGdiplusExt { bool IsAvailable() { return !!m_hModule; } bool StretchBitMask(HDC hDC, BOOL bMonoDevice, - const CFX_DIBitmap* pBitmap, + const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, int dest_left, int dest_top, int dest_width, @@ -43,7 +43,7 @@ class CGdiplusExt { const FX_RECT* pClipRect, int flags); bool StretchDIBits(HDC hDC, - const CFX_DIBitmap* pBitmap, + const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, int dest_left, int dest_top, int dest_width, @@ -96,7 +96,8 @@ class CGdiplusExt { float font_size, int fontstyle); void GdipDeleteFont(void* pFont); - bool GdipCreateBitmap(CFX_DIBitmap* pBitmap, void** bitmap); + bool GdipCreateBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, + void** bitmap); void GdipDisposeImage(void* bitmap); void GdipGetFontSize(void* pFont, float* size); void* GdiAddFontMemResourceEx(void* pFontdata, @@ -104,7 +105,7 @@ class CGdiplusExt { void* pdv, uint32_t* num_face); bool GdiRemoveFontMemResourceEx(void* handle); - CFX_DIBitmap* LoadDIBitmap(WINDIB_Open_Args_ args); + CFX_RetainPtr<CFX_DIBitmap> LoadDIBitmap(WINDIB_Open_Args_ args); FARPROC m_Functions[100]; FuncType_GdiAddFontMemResourceEx m_pGdiAddFontMemResourceEx; @@ -158,17 +159,17 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver { void DrawLine(float x1, float y1, float x2, float y2); - bool GDI_SetDIBits(CFX_DIBitmap* pBitmap, + bool GDI_SetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, const FX_RECT* pSrcRect, int left, int top); - bool GDI_StretchDIBits(CFX_DIBitmap* pBitmap, + bool GDI_StretchDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, int dest_left, int dest_top, int dest_width, int dest_height, uint32_t flags); - bool GDI_StretchBitMask(CFX_DIBitmap* pBitmap, + bool GDI_StretchBitMask(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, int dest_left, int dest_top, int dest_width, @@ -191,14 +192,16 @@ class CGdiDisplayDriver : public CGdiDeviceDriver { ~CGdiDisplayDriver() override; protected: - bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; - bool SetDIBits(const CFX_DIBSource* pBitmap, + bool GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, + int left, + int top) override; + bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_DIBSource* pBitmap, + bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -207,14 +210,14 @@ class CGdiDisplayDriver : public CGdiDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const CFX_DIBSource* pBitmap, + bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, uint32_t render_flags, void*& handle, int blend_type) override; - bool UseFoxitStretchEngine(const CFX_DIBSource* pSource, + bool UseFoxitStretchEngine(const CFX_RetainPtr<CFX_DIBSource>& pSource, uint32_t color, int dest_left, int dest_top, @@ -231,13 +234,13 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { protected: int GetDeviceCaps(int caps_id) const override; - bool SetDIBits(const CFX_DIBSource* pBitmap, + bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_DIBSource* pBitmap, + bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -246,7 +249,7 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const CFX_DIBSource* pBitmap, + bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -290,13 +293,13 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver { int fill_mode, int blend_type) override; bool GetClipBox(FX_RECT* pRect) override; - bool SetDIBits(const CFX_DIBSource* pBitmap, + bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_DIBSource* pBitmap, + bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -305,7 +308,7 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const CFX_DIBSource* pBitmap, + bool StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, |