From 0b95042db2e6dab5876abd12ce485fff0a8e08fe Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 21 Sep 2017 15:49:49 -0400 Subject: Rename CFX_RetainPtr to RetainPtr This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fxge/agg/fx_agg_driver.cpp | 72 ++++++++--------- core/fxge/agg/fx_agg_driver.h | 18 ++--- core/fxge/android/cfpf_skiafilefont.h | 4 +- core/fxge/android/cfpf_skiafontmgr.cpp | 2 +- core/fxge/android/cfpf_skiafontmgr.h | 2 +- core/fxge/apple/apple_int.h | 2 +- core/fxge/apple/fx_apple_platform.cpp | 2 +- core/fxge/apple/fx_quartz_device.cpp | 2 +- core/fxge/cfx_cliprgn.cpp | 6 +- core/fxge/cfx_cliprgn.h | 12 ++- core/fxge/cfx_defaultrenderdevice.h | 10 +-- core/fxge/cfx_font.cpp | 4 +- core/fxge/cfx_renderdevice.cpp | 50 ++++++------ core/fxge/cfx_renderdevice.h | 49 ++++++------ core/fxge/dib/cfx_bitmapcomposer.cpp | 2 +- core/fxge/dib/cfx_bitmapcomposer.h | 8 +- core/fxge/dib/cfx_bitmapstorer.cpp | 4 +- core/fxge/dib/cfx_bitmapstorer.h | 10 +-- core/fxge/dib/cfx_dibextractor.cpp | 4 +- core/fxge/dib/cfx_dibextractor.h | 8 +- core/fxge/dib/cfx_dibitmap.cpp | 67 ++++++++-------- core/fxge/dib/cfx_dibitmap.h | 18 ++--- core/fxge/dib/cfx_dibsource.cpp | 124 ++++++++++++++--------------- core/fxge/dib/cfx_dibsource.h | 34 ++++---- core/fxge/dib/cfx_filtereddib.cpp | 2 +- core/fxge/dib/cfx_filtereddib.h | 8 +- core/fxge/dib/cfx_imagerenderer.cpp | 19 +++-- core/fxge/dib/cfx_imagerenderer.h | 8 +- core/fxge/dib/cfx_imagestretcher.cpp | 13 ++- core/fxge/dib/cfx_imagestretcher.h | 8 +- core/fxge/dib/cfx_imagetransformer.cpp | 13 ++- core/fxge/dib/cfx_imagetransformer.h | 8 +- core/fxge/dib/cstretchengine.cpp | 2 +- core/fxge/dib/cstretchengine.h | 6 +- core/fxge/fx_font.h | 5 +- core/fxge/ifx_renderdevicedriver.cpp | 15 ++-- core/fxge/ifx_renderdevicedriver.h | 16 ++-- core/fxge/skia/fx_skia_device.cpp | 62 +++++++-------- core/fxge/skia/fx_skia_device.h | 28 +++---- core/fxge/skia/fx_skia_device_unittest.cpp | 2 +- core/fxge/win32/cfx_psrenderer.cpp | 10 +-- core/fxge/win32/cfx_psrenderer.h | 12 +-- core/fxge/win32/cfx_windowsdib.h | 15 ++-- core/fxge/win32/dwrite_int.h | 2 +- core/fxge/win32/fx_win32_device.cpp | 60 +++++++------- core/fxge/win32/fx_win32_dib.cpp | 22 +++-- core/fxge/win32/fx_win32_dwrite.cpp | 11 ++- core/fxge/win32/fx_win32_gdipext.cpp | 28 +++---- core/fxge/win32/fx_win32_print.cpp | 75 +++++++++-------- core/fxge/win32/win32_int.h | 45 +++++------ 50 files changed, 487 insertions(+), 522 deletions(-) (limited to 'core/fxge') diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 5e0308c551..3ba05ce2c0 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -35,7 +35,7 @@ CFX_PointF HardClip(const CFX_PointF& pos) { pdfium::clamp(pos.y, -kMaxPos, kMaxPos)); } -void RgbByteOrderSetPixel(const CFX_RetainPtr& pBitmap, +void RgbByteOrderSetPixel(const RetainPtr& pBitmap, int x, int y, uint32_t argb) { @@ -55,7 +55,7 @@ void RgbByteOrderSetPixel(const CFX_RetainPtr& pBitmap, pos[2] = (FXARGB_B(argb) * alpha + pos[2] * (255 - alpha)) / 255; } -void RgbByteOrderCompositeRect(const CFX_RetainPtr& pBitmap, +void RgbByteOrderCompositeRect(const RetainPtr& pBitmap, int left, int top, int width, @@ -130,12 +130,12 @@ void RgbByteOrderCompositeRect(const CFX_RetainPtr& pBitmap, } } -void RgbByteOrderTransferBitmap(const CFX_RetainPtr& pBitmap, +void RgbByteOrderTransferBitmap(const RetainPtr& pBitmap, int dest_left, int dest_top, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { if (!pBitmap) @@ -228,7 +228,7 @@ void RgbByteOrderTransferBitmap(const CFX_RetainPtr& pBitmap, } } -bool DibSetPixel(const CFX_RetainPtr& pDevice, +bool DibSetPixel(const RetainPtr& pDevice, int x, int y, uint32_t color) { @@ -377,8 +377,8 @@ class CFX_Renderer { uint8_t* clip_scan, uint8_t* dest_extra_alpha_scan); - bool Init(const CFX_RetainPtr& pDevice, - const CFX_RetainPtr& pOriDevice, + bool Init(const RetainPtr& pDevice, + const RetainPtr& pOriDevice, const CFX_ClipRgn* pClipRgn, uint32_t color, bool bFullCover, @@ -434,9 +434,9 @@ class CFX_Renderer { bool m_bFullCover; bool m_bRgbByteOrder; FX_RECT m_ClipBox; - CFX_RetainPtr m_pOriDevice; - CFX_RetainPtr m_pClipMask; - CFX_RetainPtr m_pDevice; + RetainPtr m_pOriDevice; + RetainPtr m_pClipMask; + RetainPtr m_pDevice; CFX_UnownedPtr m_pClipRgn; }; @@ -876,8 +876,8 @@ void CFX_Renderer::CompositeSpanCMYK(uint8_t* dest_scan, } } -bool CFX_Renderer::Init(const CFX_RetainPtr& pDevice, - const CFX_RetainPtr& pOriDevice, +bool CFX_Renderer::Init(const RetainPtr& pDevice, + const RetainPtr& pOriDevice, const CFX_ClipRgn* pClipRgn, uint32_t color, bool bFullCover, @@ -938,7 +938,7 @@ void CFX_Renderer::render(const Scanline& sl) { uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * y; uint8_t* dest_scan_extra_alpha = nullptr; - CFX_RetainPtr pAlphaMask = m_pDevice->m_pAlphaMask; + RetainPtr pAlphaMask = m_pDevice->m_pAlphaMask; if (pAlphaMask) { dest_scan_extra_alpha = pAlphaMask->GetBuffer() + pAlphaMask->GetPitch() * y; @@ -1104,9 +1104,9 @@ void CAgg_PathData::BuildPath(const CFX_PathData* pPathData, } CFX_AggDeviceDriver::CFX_AggDeviceDriver( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, bool bRgbByteOrder, - const CFX_RetainPtr& pOriDevice, + const RetainPtr& pOriDevice, bool bGroupKnockout) : m_pBitmap(pBitmap), #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ @@ -1283,7 +1283,7 @@ bool CFX_AggDeviceDriver::RenderRasterizer( uint32_t color, bool bFullCover, bool bGroupKnockout) { - CFX_RetainPtr pt = bGroupKnockout ? m_pOriDevice : nullptr; + RetainPtr pt = bGroupKnockout ? m_pOriDevice : nullptr; CFX_Renderer render; if (!render.Init(m_pBitmap, pt, m_pClipRgn.get(), color, bFullCover, m_bRgbByteOrder)) { @@ -1445,7 +1445,7 @@ bool CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) { return true; } -bool CFX_AggDeviceDriver::GetDIBits(const CFX_RetainPtr& pBitmap, +bool CFX_AggDeviceDriver::GetDIBits(const RetainPtr& pBitmap, int left, int top) { if (!m_pBitmap || !m_pBitmap->GetBuffer()) @@ -1453,7 +1453,7 @@ bool CFX_AggDeviceDriver::GetDIBits(const CFX_RetainPtr& pBitmap, FX_RECT rect(left, top, left + pBitmap->GetWidth(), top + pBitmap->GetHeight()); - CFX_RetainPtr pBack; + RetainPtr pBack; if (m_pOriDevice) { pBack = m_pOriDevice->Clone(&rect); if (!pBack) @@ -1478,11 +1478,11 @@ bool CFX_AggDeviceDriver::GetDIBits(const CFX_RetainPtr& pBitmap, top); } -CFX_RetainPtr CFX_AggDeviceDriver::GetBackDrop() { +RetainPtr CFX_AggDeviceDriver::GetBackDrop() { return m_pOriDevice; } -bool CFX_AggDeviceDriver::SetDIBits(const CFX_RetainPtr& pBitmap, +bool CFX_AggDeviceDriver::SetDIBits(const RetainPtr& pBitmap, uint32_t argb, const FX_RECT* pSrcRect, int left, @@ -1502,16 +1502,15 @@ bool CFX_AggDeviceDriver::SetDIBits(const CFX_RetainPtr& pBitmap, pSrcRect->top, blend_type, m_pClipRgn.get(), m_bRgbByteOrder); } -bool CFX_AggDeviceDriver::StretchDIBits( - const CFX_RetainPtr& pSource, - uint32_t argb, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) { +bool CFX_AggDeviceDriver::StretchDIBits(const RetainPtr& pSource, + uint32_t argb, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) { if (!m_pBitmap->GetBuffer()) return true; @@ -1537,7 +1536,7 @@ bool CFX_AggDeviceDriver::StretchDIBits( } bool CFX_AggDeviceDriver::StartDIBits( - const CFX_RetainPtr& pSource, + const RetainPtr& pSource, int bitmap_alpha, uint32_t argb, const CFX_Matrix* pMatrix, @@ -1563,11 +1562,10 @@ CFX_DefaultRenderDevice::CFX_DefaultRenderDevice() {} CFX_DefaultRenderDevice::~CFX_DefaultRenderDevice() {} -bool CFX_DefaultRenderDevice::Attach( - const CFX_RetainPtr& pBitmap, - bool bRgbByteOrder, - const CFX_RetainPtr& pOriDevice, - bool bGroupKnockout) { +bool CFX_DefaultRenderDevice::Attach(const RetainPtr& pBitmap, + bool bRgbByteOrder, + const RetainPtr& pOriDevice, + bool bGroupKnockout) { if (!pBitmap) return false; @@ -1581,7 +1579,7 @@ bool CFX_DefaultRenderDevice::Create( int width, int height, FXDIB_Format format, - const CFX_RetainPtr& pOriDevice) { + const RetainPtr& pOriDevice) { auto pBitmap = pdfium::MakeRetain(); if (!pBitmap->Create(width, height, format)) return false; diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h index c6aafebffc..0afc7e3123 100644 --- a/core/fxge/agg/fx_agg_driver.h +++ b/core/fxge/agg/fx_agg_driver.h @@ -32,9 +32,9 @@ class CAgg_PathData { class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { public: - CFX_AggDeviceDriver(const CFX_RetainPtr& pBitmap, + CFX_AggDeviceDriver(const RetainPtr& pBitmap, bool bRgbByteOrder, - const CFX_RetainPtr& pOriDevice, + const RetainPtr& pOriDevice, bool bGroupKnockout); ~CFX_AggDeviceDriver() override; @@ -63,17 +63,17 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { uint32_t fill_color, int blend_type) override; bool GetClipBox(FX_RECT* pRect) override; - bool GetDIBits(const CFX_RetainPtr& pBitmap, + bool GetDIBits(const RetainPtr& pBitmap, int left, int top) override; - CFX_RetainPtr GetBackDrop() override; - bool SetDIBits(const CFX_RetainPtr& pBitmap, + RetainPtr GetBackDrop() override; + bool SetDIBits(const RetainPtr& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_RetainPtr& pBitmap, + bool StretchDIBits(const RetainPtr& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -82,7 +82,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const CFX_RetainPtr& pBitmap, + bool StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -109,7 +109,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { virtual uint8_t* GetBuffer() const; private: - CFX_RetainPtr m_pBitmap; + RetainPtr m_pBitmap; std::unique_ptr m_pClipRgn; std::vector> m_StateStack; #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ @@ -117,7 +117,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { #endif int m_FillFlags; bool m_bRgbByteOrder; - CFX_RetainPtr m_pOriDevice; + RetainPtr m_pOriDevice; bool m_bGroupKnockout; }; diff --git a/core/fxge/android/cfpf_skiafilefont.h b/core/fxge/android/cfpf_skiafilefont.h index 4496fde078..5e2ebbc529 100644 --- a/core/fxge/android/cfpf_skiafilefont.h +++ b/core/fxge/android/cfpf_skiafilefont.h @@ -7,7 +7,7 @@ #ifndef CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_ #define CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_ -#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/android/cfpf_skiafontdescriptor.h" class IFX_SeekableReadStream; @@ -22,7 +22,7 @@ class CFPF_SkiaFileFont : public CFPF_SkiaFontDescriptor { // CFPF_SkiaFontDescriptor int32_t GetType() const override; - CFX_RetainPtr m_pFile; + RetainPtr m_pFile; }; #endif // CORE_FXGE_ANDROID_CFPF_SKIAFILEFONT_H_ diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp index a50b9ead63..4be35668e0 100644 --- a/core/fxge/android/cfpf_skiafontmgr.cpp +++ b/core/fxge/android/cfpf_skiafontmgr.cpp @@ -363,7 +363,7 @@ CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const ByteStringView& bsFamilyname, } FXFT_Face CFPF_SkiaFontMgr::GetFontFace( - const CFX_RetainPtr& pFileRead, + const RetainPtr& pFileRead, int32_t iFaceIndex) { if (!pFileRead) return nullptr; diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h index 78d01717b9..11ad47a360 100644 --- a/core/fxge/android/cfpf_skiafontmgr.h +++ b/core/fxge/android/cfpf_skiafontmgr.h @@ -31,7 +31,7 @@ class CFPF_SkiaFontMgr { uint32_t dwMatch = 0); bool InitFTLibrary(); - FXFT_Face GetFontFace(const CFX_RetainPtr& pFileRead, + FXFT_Face GetFontFace(const RetainPtr& pFileRead, int32_t iFaceIndex = 0); FXFT_Face GetFontFace(const ByteStringView& bsFile, int32_t iFaceIndex = 0); FXFT_Face GetFontFace(const uint8_t* pBuffer, diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h index f1b9fcf2e8..82415ec07f 100644 --- a/core/fxge/apple/apple_int.h +++ b/core/fxge/apple/apple_int.h @@ -19,7 +19,7 @@ class CQuartz2D { public: - void* createGraphics(const CFX_RetainPtr& bitmap); + void* createGraphics(const RetainPtr& bitmap); void destroyGraphics(void* graphics); void* CreateFont(const uint8_t* pFontData, uint32_t dwFontSize); diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp index b3a3f26c99..05ae70a6b7 100644 --- a/core/fxge/apple/fx_apple_platform.cpp +++ b/core/fxge/apple/fx_apple_platform.cpp @@ -131,7 +131,7 @@ bool CFX_AggDeviceDriver::DrawDeviceText(int nChars, rect_cg = CGRectMake(m_pClipRgn->GetBox().left, m_pClipRgn->GetBox().top, m_pClipRgn->GetBox().Width(), m_pClipRgn->GetBox().Height()); - CFX_RetainPtr pClipMask = m_pClipRgn->GetMask(); + RetainPtr pClipMask = m_pClipRgn->GetMask(); if (pClipMask) { CGDataProviderRef pClipMaskDataProvider = CGDataProviderCreateWithData( nullptr, pClipMask->GetBuffer(), diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp index f92db2b30b..1e9fddaad8 100644 --- a/core/fxge/apple/fx_quartz_device.cpp +++ b/core/fxge/apple/fx_quartz_device.cpp @@ -23,7 +23,7 @@ #error Expected CGFLOAT_IS_DOUBLE to be defined by CoreGraphics headers #endif -void* CQuartz2D::createGraphics(const CFX_RetainPtr& pBitmap) { +void* CQuartz2D::createGraphics(const RetainPtr& pBitmap) { if (!pBitmap) return nullptr; CGBitmapInfo bmpInfo = kCGBitmapByteOrder32Little; diff --git a/core/fxge/cfx_cliprgn.cpp b/core/fxge/cfx_cliprgn.cpp index 087c11089a..9569ee909c 100644 --- a/core/fxge/cfx_cliprgn.cpp +++ b/core/fxge/cfx_cliprgn.cpp @@ -41,7 +41,7 @@ void CFX_ClipRgn::IntersectRect(const FX_RECT& rect) { void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, - const CFX_RetainPtr& pMask) { + const RetainPtr& pMask) { m_Type = MaskF; m_Box = rect; m_Box.Intersect(mask_rect); @@ -53,7 +53,7 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, m_Mask = pMask; return; } - CFX_RetainPtr pOldMask(pMask); + RetainPtr pOldMask(pMask); m_Mask = pdfium::MakeRetain(); m_Mask->Create(m_Box.Width(), m_Box.Height(), FXDIB_8bppMask); for (int row = m_Box.top; row < m_Box.bottom; row++) { @@ -68,7 +68,7 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, void CFX_ClipRgn::IntersectMaskF(int left, int top, - const CFX_RetainPtr& pMask) { + const RetainPtr& pMask) { ASSERT(pMask->GetFormat() == FXDIB_8bppMask); FX_RECT mask_box(left, top, left + pMask->GetWidth(), top + pMask->GetHeight()); diff --git a/core/fxge/cfx_cliprgn.h b/core/fxge/cfx_cliprgn.h index 0dfc4991fd..58ebb4de73 100644 --- a/core/fxge/cfx_cliprgn.h +++ b/core/fxge/cfx_cliprgn.h @@ -7,8 +7,8 @@ #ifndef CORE_FXGE_CFX_CLIPRGN_H_ #define CORE_FXGE_CFX_CLIPRGN_H_ -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/retain_ptr.h" class CFX_DIBitmap; @@ -22,22 +22,20 @@ class CFX_ClipRgn { ClipType GetType() const { return m_Type; } const FX_RECT& GetBox() const { return m_Box; } - CFX_RetainPtr GetMask() const { return m_Mask; } + RetainPtr GetMask() const { return m_Mask; } void Reset(const FX_RECT& rect); void IntersectRect(const FX_RECT& rect); - void IntersectMaskF(int left, - int top, - const CFX_RetainPtr& Mask); + void IntersectMaskF(int left, int top, const RetainPtr& Mask); private: void IntersectMaskRect(FX_RECT rect, FX_RECT mask_box, - const CFX_RetainPtr& Mask); + const RetainPtr& Mask); ClipType m_Type; FX_RECT m_Box; - CFX_RetainPtr m_Mask; + RetainPtr m_Mask; }; #endif // CORE_FXGE_CFX_CLIPRGN_H_ diff --git a/core/fxge/cfx_defaultrenderdevice.h b/core/fxge/cfx_defaultrenderdevice.h index e2dc1f3859..59415df641 100644 --- a/core/fxge/cfx_defaultrenderdevice.h +++ b/core/fxge/cfx_defaultrenderdevice.h @@ -17,22 +17,22 @@ class CFX_DefaultRenderDevice : public CFX_RenderDevice { CFX_DefaultRenderDevice(); ~CFX_DefaultRenderDevice() override; - bool Attach(const CFX_RetainPtr& pBitmap, + bool Attach(const RetainPtr& pBitmap, bool bRgbByteOrder, - const CFX_RetainPtr& pOriDevice, + const RetainPtr& pOriDevice, bool bGroupKnockout); bool Create(int width, int height, FXDIB_Format format, - const CFX_RetainPtr& pOriDevice); + const RetainPtr& pOriDevice); #ifdef _SKIA_SUPPORT_ bool AttachRecorder(SkPictureRecorder* recorder); void Clear(uint32_t color); SkPictureRecorder* CreateRecorder(int size_x, int size_y); void DebugVerifyBitmapIsPreMultiplied() const override; - bool SetBitsWithMask(const CFX_RetainPtr& pBitmap, - const CFX_RetainPtr& pMask, + bool SetBitsWithMask(const RetainPtr& pBitmap, + const RetainPtr& pMask, int left, int top, int bitmap_alpha, diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp index 017b120dd4..9e6a2cf982 100644 --- a/core/fxge/cfx_font.cpp +++ b/core/fxge/cfx_font.cpp @@ -54,7 +54,7 @@ void FTStreamClose(FXFT_Stream stream) {} bool LoadFileImp(FXFT_Library library, FXFT_Face* Face, - const CFX_RetainPtr& pFile, + const RetainPtr& pFile, int32_t faceIndex, std::unique_ptr* stream) { auto stream1 = pdfium::MakeUnique(); @@ -311,7 +311,7 @@ void CFX_Font::LoadSubst(const ByteString& face_name, } #ifdef PDF_ENABLE_XFA -bool CFX_Font::LoadFile(const CFX_RetainPtr& pFile, +bool CFX_Font::LoadFile(const RetainPtr& pFile, int nFaceIndex) { m_bEmbedded = false; diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp index 5e9f5ae0c9..c6f9411176 100644 --- a/core/fxge/cfx_renderdevice.cpp +++ b/core/fxge/cfx_renderdevice.cpp @@ -197,8 +197,8 @@ void SetAlpha(bool has_alpha, uint8_t* alpha) { alpha[3] = 255; } -void DrawNormalTextHelper(const CFX_RetainPtr& bitmap, - const CFX_RetainPtr& pGlyph, +void DrawNormalTextHelper(const RetainPtr& bitmap, + const RetainPtr& pGlyph, int nrows, int left, int top, @@ -428,7 +428,7 @@ CFX_Matrix CFX_RenderDevice::GetCTM() const { } bool CFX_RenderDevice::CreateCompatibleBitmap( - const CFX_RetainPtr& pDIB, + const RetainPtr& pDIB, int width, int height) const { if (m_RenderCaps & FXRC_CMYK_OUTPUT) { @@ -707,19 +707,19 @@ bool CFX_RenderDevice::DrawCosmeticLine(const CFX_PointF& ptMoveTo, fill_mode, blend_type); } -bool CFX_RenderDevice::GetDIBits(const CFX_RetainPtr& pBitmap, +bool CFX_RenderDevice::GetDIBits(const RetainPtr& pBitmap, int left, int top) { return (m_RenderCaps & FXRC_GET_BITS) && m_pDeviceDriver->GetDIBits(pBitmap, left, top); } -CFX_RetainPtr CFX_RenderDevice::GetBackDrop() { +RetainPtr CFX_RenderDevice::GetBackDrop() { return m_pDeviceDriver->GetBackDrop(); } bool CFX_RenderDevice::SetDIBitsWithBlend( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, int left, int top, int blend_mode) { @@ -771,7 +771,7 @@ bool CFX_RenderDevice::SetDIBitsWithBlend( } bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, int left, int top, int dest_width, @@ -786,7 +786,7 @@ bool CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend( dest_height, &clip_box, flags, blend_mode); } -bool CFX_RenderDevice::SetBitMask(const CFX_RetainPtr& pBitmap, +bool CFX_RenderDevice::SetBitMask(const RetainPtr& pBitmap, int left, int top, uint32_t argb) { @@ -795,19 +795,18 @@ bool CFX_RenderDevice::SetBitMask(const CFX_RetainPtr& pBitmap, FXDIB_BLEND_NORMAL); } -bool CFX_RenderDevice::StretchBitMask( - const CFX_RetainPtr& pBitmap, - int left, - int top, - int dest_width, - int dest_height, - uint32_t color) { +bool CFX_RenderDevice::StretchBitMask(const RetainPtr& pBitmap, + int left, + int top, + int dest_width, + int dest_height, + uint32_t color) { return StretchBitMaskWithFlags(pBitmap, left, top, dest_width, dest_height, color, 0); } bool CFX_RenderDevice::StretchBitMaskWithFlags( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, int left, int top, int dest_width, @@ -823,7 +822,7 @@ bool CFX_RenderDevice::StretchBitMaskWithFlags( } bool CFX_RenderDevice::StartDIBitsWithBlend( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, int bitmap_alpha, uint32_t argb, const CFX_Matrix* pMatrix, @@ -844,13 +843,12 @@ void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const { SkASSERT(0); } -bool CFX_RenderDevice::SetBitsWithMask( - const CFX_RetainPtr& pBitmap, - const CFX_RetainPtr& pMask, - int left, - int top, - int bitmap_alpha, - int blend_type) { +bool CFX_RenderDevice::SetBitsWithMask(const RetainPtr& pBitmap, + const RetainPtr& pMask, + int left, + int top, + int bitmap_alpha, + int blend_type) { return m_pDeviceDriver->SetBitsWithMask(pBitmap, pMask, left, top, bitmap_alpha, blend_type); } @@ -989,7 +987,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, for (const FXTEXT_GLYPHPOS& glyph : glyphs) { if (!glyph.m_pGlyph) continue; - CFX_RetainPtr pGlyph = glyph.m_pGlyph->m_pBitmap; + RetainPtr pGlyph = glyph.m_pGlyph->m_pBitmap; bitmap->TransferBitmap( glyph.m_Origin.x + glyph.m_pGlyph->m_Left - pixel_left, glyph.m_Origin.y - glyph.m_pGlyph->m_Top - pixel_top, @@ -1038,7 +1036,7 @@ bool CFX_RenderDevice::DrawNormalText(int nChars, if (!top.IsValid()) return false; - CFX_RetainPtr pGlyph = glyph.m_pGlyph->m_pBitmap; + RetainPtr pGlyph = glyph.m_pGlyph->m_pBitmap; int ncols = pGlyph->GetWidth(); int nrows = pGlyph->GetHeight(); if (anti_alias == FXFT_RENDER_MODE_NORMAL) { diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h index 36fb5ed0f9..75b0ef3eec 100644 --- a/core/fxge/cfx_renderdevice.h +++ b/core/fxge/cfx_renderdevice.h @@ -112,11 +112,11 @@ class CFX_RenderDevice { int GetRenderCaps() const { return m_RenderCaps; } int GetDeviceCaps(int id) const; CFX_Matrix GetCTM() const; - CFX_RetainPtr GetBitmap() const { return m_pBitmap; } - void SetBitmap(const CFX_RetainPtr& pBitmap) { + RetainPtr GetBitmap() const { return m_pBitmap; } + void SetBitmap(const RetainPtr& pBitmap) { m_pBitmap = pBitmap; } - bool CreateCompatibleBitmap(const CFX_RetainPtr& pDIB, + bool CreateCompatibleBitmap(const RetainPtr& pDIB, int width, int height) const; const FX_RECT& GetClipBox() const { return m_ClipBox; } @@ -148,18 +148,16 @@ class CFX_RenderDevice { return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL); } - CFX_RetainPtr GetBackDrop(); - bool GetDIBits(const CFX_RetainPtr& pBitmap, int left, int top); - bool SetDIBits(const CFX_RetainPtr& pBitmap, - int left, - int top) { + RetainPtr GetBackDrop(); + bool GetDIBits(const RetainPtr& pBitmap, int left, int top); + bool SetDIBits(const RetainPtr& pBitmap, int left, int top) { return SetDIBitsWithBlend(pBitmap, left, top, FXDIB_BLEND_NORMAL); } - bool SetDIBitsWithBlend(const CFX_RetainPtr& pBitmap, + bool SetDIBitsWithBlend(const RetainPtr& pBitmap, int left, int top, int blend_type); - bool StretchDIBits(const CFX_RetainPtr& pBitmap, + bool StretchDIBits(const RetainPtr& pBitmap, int left, int top, int dest_width, @@ -167,32 +165,31 @@ class CFX_RenderDevice { return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width, dest_height, 0, FXDIB_BLEND_NORMAL); } - bool StretchDIBitsWithFlagsAndBlend( - const CFX_RetainPtr& pBitmap, - int left, - int top, - int dest_width, - int dest_height, - uint32_t flags, - int blend_type); - bool SetBitMask(const CFX_RetainPtr& pBitmap, + bool StretchDIBitsWithFlagsAndBlend(const RetainPtr& pBitmap, + int left, + int top, + int dest_width, + int dest_height, + uint32_t flags, + int blend_type); + bool SetBitMask(const RetainPtr& pBitmap, int left, int top, uint32_t color); - bool StretchBitMask(const CFX_RetainPtr& pBitmap, + bool StretchBitMask(const RetainPtr& pBitmap, int left, int top, int dest_width, int dest_height, uint32_t color); - bool StretchBitMaskWithFlags(const CFX_RetainPtr& pBitmap, + bool StretchBitMaskWithFlags(const RetainPtr& pBitmap, int left, int top, int dest_width, int dest_height, uint32_t color, uint32_t flags); - bool StartDIBits(const CFX_RetainPtr& pBitmap, + bool StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -201,7 +198,7 @@ class CFX_RenderDevice { return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, pMatrix, flags, handle, FXDIB_BLEND_NORMAL); } - bool StartDIBitsWithBlend(const CFX_RetainPtr& pBitmap, + bool StartDIBitsWithBlend(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -267,8 +264,8 @@ class CFX_RenderDevice { #ifdef _SKIA_SUPPORT_ virtual void DebugVerifyBitmapIsPreMultiplied() const; - virtual bool SetBitsWithMask(const CFX_RetainPtr& pBitmap, - const CFX_RetainPtr& pMask, + virtual bool SetBitsWithMask(const RetainPtr& pBitmap, + const RetainPtr& pMask, int left, int top, int bitmap_alpha, @@ -295,7 +292,7 @@ class CFX_RenderDevice { int blend_type); bool FillRectWithBlend(const FX_RECT* pRect, uint32_t color, int blend_type); - CFX_RetainPtr m_pBitmap; + RetainPtr m_pBitmap; int m_Width; int m_Height; int m_bpp; diff --git a/core/fxge/dib/cfx_bitmapcomposer.cpp b/core/fxge/dib/cfx_bitmapcomposer.cpp index 5657190161..3854949207 100644 --- a/core/fxge/dib/cfx_bitmapcomposer.cpp +++ b/core/fxge/dib/cfx_bitmapcomposer.cpp @@ -14,7 +14,7 @@ CFX_BitmapComposer::CFX_BitmapComposer() CFX_BitmapComposer::~CFX_BitmapComposer() {} -void CFX_BitmapComposer::Compose(const CFX_RetainPtr& pDest, +void CFX_BitmapComposer::Compose(const RetainPtr& pDest, const CFX_ClipRgn* pClipRgn, int bitmap_alpha, uint32_t mask_color, diff --git a/core/fxge/dib/cfx_bitmapcomposer.h b/core/fxge/dib/cfx_bitmapcomposer.h index cc4ecb13fe..7fb3037cc1 100644 --- a/core/fxge/dib/cfx_bitmapcomposer.h +++ b/core/fxge/dib/cfx_bitmapcomposer.h @@ -9,9 +9,9 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_scanlinecompositor.h" #include "core/fxge/dib/ifx_scanlinecomposer.h" @@ -23,7 +23,7 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer { CFX_BitmapComposer(); ~CFX_BitmapComposer() override; - void Compose(const CFX_RetainPtr& pDest, + void Compose(const RetainPtr& pDest, const CFX_ClipRgn* pClipRgn, int bitmap_alpha, uint32_t mask_color, @@ -56,7 +56,7 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer { const uint8_t* scanline, const uint8_t* scan_extra_alpha); - CFX_RetainPtr m_pBitmap; + RetainPtr m_pBitmap; CFX_UnownedPtr m_pClipRgn; FXDIB_Format m_SrcFormat; int m_DestLeft; @@ -65,7 +65,7 @@ class CFX_BitmapComposer : public IFX_ScanlineComposer { int m_DestHeight; int m_BitmapAlpha; uint32_t m_MaskColor; - CFX_RetainPtr m_pClipMask; + RetainPtr m_pClipMask; CFX_ScanlineCompositor m_Compositor; bool m_bVertical; bool m_bFlipX; diff --git a/core/fxge/dib/cfx_bitmapstorer.cpp b/core/fxge/dib/cfx_bitmapstorer.cpp index 1e09708098..f649e0caea 100644 --- a/core/fxge/dib/cfx_bitmapstorer.cpp +++ b/core/fxge/dib/cfx_bitmapstorer.cpp @@ -14,11 +14,11 @@ CFX_BitmapStorer::CFX_BitmapStorer() {} CFX_BitmapStorer::~CFX_BitmapStorer() {} -CFX_RetainPtr CFX_BitmapStorer::Detach() { +RetainPtr CFX_BitmapStorer::Detach() { return std::move(m_pBitmap); } -void CFX_BitmapStorer::Replace(CFX_RetainPtr&& pBitmap) { +void CFX_BitmapStorer::Replace(RetainPtr&& pBitmap) { m_pBitmap = std::move(pBitmap); } diff --git a/core/fxge/dib/cfx_bitmapstorer.h b/core/fxge/dib/cfx_bitmapstorer.h index a574493e6e..3d3416daa1 100644 --- a/core/fxge/dib/cfx_bitmapstorer.h +++ b/core/fxge/dib/cfx_bitmapstorer.h @@ -10,8 +10,8 @@ #include #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_dibitmap.h" #include "core/fxge/dib/ifx_scanlinecomposer.h" #include "third_party/base/stl_util.h" @@ -30,12 +30,12 @@ class CFX_BitmapStorer : public IFX_ScanlineComposer { FXDIB_Format src_format, uint32_t* pSrcPalette) override; - CFX_RetainPtr GetBitmap() { return m_pBitmap; } - CFX_RetainPtr Detach(); - void Replace(CFX_RetainPtr&& pBitmap); + RetainPtr GetBitmap() { return m_pBitmap; } + RetainPtr Detach(); + void Replace(RetainPtr&& pBitmap); private: - CFX_RetainPtr m_pBitmap; + RetainPtr m_pBitmap; }; #endif // CORE_FXGE_DIB_CFX_BITMAPSTORER_H_ diff --git a/core/fxge/dib/cfx_dibextractor.cpp b/core/fxge/dib/cfx_dibextractor.cpp index 325454a580..13ad461cb1 100644 --- a/core/fxge/dib/cfx_dibextractor.cpp +++ b/core/fxge/dib/cfx_dibextractor.cpp @@ -8,12 +8,12 @@ #include "core/fxge/dib/cfx_dibsource.h" -CFX_DIBExtractor::CFX_DIBExtractor(const CFX_RetainPtr& pSrc) { +CFX_DIBExtractor::CFX_DIBExtractor(const RetainPtr& pSrc) { if (!pSrc->GetBuffer()) { m_pBitmap = pSrc->Clone(nullptr); return; } - CFX_RetainPtr pOldSrc(pSrc); + RetainPtr pOldSrc(pSrc); m_pBitmap = pdfium::MakeRetain(); if (!m_pBitmap->Create(pOldSrc->GetWidth(), pOldSrc->GetHeight(), pOldSrc->GetFormat(), pOldSrc->GetBuffer())) { diff --git a/core/fxge/dib/cfx_dibextractor.h b/core/fxge/dib/cfx_dibextractor.h index 25d80ecb94..b6c27a7bd7 100644 --- a/core/fxge/dib/cfx_dibextractor.h +++ b/core/fxge/dib/cfx_dibextractor.h @@ -7,20 +7,20 @@ #ifndef CORE_FXGE_DIB_CFX_DIBEXTRACTOR_H_ #define CORE_FXGE_DIB_CFX_DIBEXTRACTOR_H_ -#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_dibitmap.h" class CFX_DIBSource; class CFX_DIBExtractor { public: - explicit CFX_DIBExtractor(const CFX_RetainPtr& pSrc); + explicit CFX_DIBExtractor(const RetainPtr& pSrc); ~CFX_DIBExtractor(); - CFX_RetainPtr GetBitmap() { return m_pBitmap; } + RetainPtr GetBitmap() { return m_pBitmap; } private: - CFX_RetainPtr m_pBitmap; + RetainPtr m_pBitmap; }; #endif // CORE_FXGE_DIB_CFX_DIBEXTRACTOR_H_ diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index fd6defece2..8e105937ee 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -81,7 +81,7 @@ bool CFX_DIBitmap::Create(int width, return false; } -bool CFX_DIBitmap::Copy(const CFX_RetainPtr& pSrc) { +bool CFX_DIBitmap::Copy(const RetainPtr& pSrc) { if (m_pBuffer) return false; @@ -105,7 +105,7 @@ const uint8_t* CFX_DIBitmap::GetScanline(int line) const { return m_pBuffer.Get() ? m_pBuffer.Get() + line * m_Pitch : nullptr; } -void CFX_DIBitmap::TakeOver(CFX_RetainPtr&& pSrcBitmap) { +void CFX_DIBitmap::TakeOver(RetainPtr&& pSrcBitmap) { m_pBuffer = std::move(pSrcBitmap->m_pBuffer); m_pPalette = std::move(pSrcBitmap->m_pPalette); m_pAlphaMask = pSrcBitmap->m_pAlphaMask; @@ -180,14 +180,13 @@ void CFX_DIBitmap::Clear(uint32_t color) { } } -bool CFX_DIBitmap::TransferBitmap( - int dest_left, - int dest_top, - int width, - int height, - const CFX_RetainPtr& pSrcBitmap, - int src_left, - int src_top) { +bool CFX_DIBitmap::TransferBitmap(int dest_left, + int dest_top, + int width, + int height, + const RetainPtr& pSrcBitmap, + int src_left, + int src_top) { if (!m_pBuffer) return false; @@ -243,12 +242,12 @@ bool CFX_DIBitmap::TransferBitmap( } bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, FXDIB_Channel srcChannel) { if (!m_pBuffer) return false; - CFX_RetainPtr pSrcClone = pSrcBitmap; + RetainPtr pSrcClone = pSrcBitmap; int srcOffset; if (srcChannel == FXDIB_Alpha) { if (!pSrcBitmap->HasAlpha() && !pSrcBitmap->IsAlphaMask()) @@ -308,7 +307,7 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, destOffset = g_ChannelOffset[destChannel]; } if (srcChannel == FXDIB_Alpha && pSrcClone->m_pAlphaMask) { - CFX_RetainPtr pAlphaMask = pSrcClone->m_pAlphaMask; + RetainPtr pAlphaMask = pSrcClone->m_pAlphaMask; if (pSrcClone->GetWidth() != m_Width || pSrcClone->GetHeight() != m_Height) { if (pAlphaMask) { @@ -321,14 +320,14 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, srcOffset = 0; } else if (pSrcClone->GetWidth() != m_Width || pSrcClone->GetHeight() != m_Height) { - CFX_RetainPtr pSrcMatched = + RetainPtr pSrcMatched = pSrcClone->StretchTo(m_Width, m_Height, 0, nullptr); if (!pSrcMatched) return false; pSrcClone = std::move(pSrcMatched); } - CFX_RetainPtr pDst(this); + RetainPtr pDst(this); if (destChannel == FXDIB_Alpha && m_pAlphaMask) { pDst = m_pAlphaMask; destOffset = 0; @@ -406,8 +405,7 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) { return true; } -bool CFX_DIBitmap::MultiplyAlpha( - const CFX_RetainPtr& pSrcBitmap) { +bool CFX_DIBitmap::MultiplyAlpha(const RetainPtr& pSrcBitmap) { if (!m_pBuffer) return false; @@ -418,7 +416,7 @@ bool CFX_DIBitmap::MultiplyAlpha( if (!IsAlphaMask() && !HasAlpha()) return LoadChannel(FXDIB_Alpha, pSrcBitmap, FXDIB_Alpha); - CFX_RetainPtr pSrcClone = pSrcBitmap.As(); + RetainPtr pSrcClone = pSrcBitmap.As(); if (pSrcBitmap->GetWidth() != m_Width || pSrcBitmap->GetHeight() != m_Height) { pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height, 0, nullptr); @@ -834,17 +832,16 @@ bool CFX_DIBitmap::CalculatePitchAndSize(int height, return true; } -bool CFX_DIBitmap::CompositeBitmap( - int dest_left, - int dest_top, - int width, - int height, - const CFX_RetainPtr& pSrcBitmap, - int src_left, - int src_top, - int blend_type, - const CFX_ClipRgn* pClipRgn, - bool bRgbByteOrder) { +bool CFX_DIBitmap::CompositeBitmap(int dest_left, + int dest_top, + int width, + int height, + const RetainPtr& pSrcBitmap, + int src_left, + int src_top, + int blend_type, + const CFX_ClipRgn* pClipRgn, + bool bRgbByteOrder) { if (!m_pBuffer) return false; @@ -858,7 +855,7 @@ bool CFX_DIBitmap::CompositeBitmap( if (width == 0 || height == 0) { return true; } - CFX_RetainPtr pClipMask; + RetainPtr pClipMask; FX_RECT clip_box; if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); @@ -874,7 +871,7 @@ bool CFX_DIBitmap::CompositeBitmap( int dest_Bpp = m_bpp / 8; int src_Bpp = pSrcBitmap->GetBPP() / 8; bool bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); - CFX_RetainPtr pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; + RetainPtr pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; for (int row = 0; row < height; row++) { uint8_t* dest_scan = m_pBuffer.Get() + (dest_top + row) * m_Pitch + dest_left * dest_Bpp; @@ -910,7 +907,7 @@ bool CFX_DIBitmap::CompositeMask(int dest_left, int dest_top, int width, int height, - const CFX_RetainPtr& pMask, + const RetainPtr& pMask, uint32_t color, int src_left, int src_top, @@ -936,7 +933,7 @@ bool CFX_DIBitmap::CompositeMask(int dest_left, if (src_alpha == 0) return true; - CFX_RetainPtr pClipMask; + RetainPtr pClipMask; FX_RECT clip_box; if (pClipRgn && pClipRgn->GetType() != CFX_ClipRgn::RectI) { ASSERT(pClipRgn->GetType() == CFX_ClipRgn::MaskF); @@ -1197,7 +1194,7 @@ bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { if (!dest_buf) return false; - CFX_RetainPtr pAlphaMask; + RetainPtr pAlphaMask; if (dest_format == FXDIB_Argb) { memset(dest_buf.get(), 0xff, dest_pitch * m_Height + 4); if (m_pAlphaMask) { @@ -1226,7 +1223,7 @@ bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { } } bool ret = false; - CFX_RetainPtr holder(this); + RetainPtr holder(this); std::unique_ptr 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 79eeaeb273..7240829773 100644 --- a/core/fxge/dib/cfx_dibitmap.h +++ b/core/fxge/dib/cfx_dibitmap.h @@ -7,16 +7,16 @@ #ifndef CORE_FXGE_DIB_CFX_DIBITMAP_H_ #define CORE_FXGE_DIB_CFX_DIBITMAP_H_ -#include "core/fxcrt/cfx_retain_ptr.h" #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 "third_party/base/stl_util.h" class CFX_DIBitmap : public CFX_DIBSource { public: template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); ~CFX_DIBitmap() override; @@ -26,7 +26,7 @@ class CFX_DIBitmap : public CFX_DIBSource { uint8_t* pBuffer = nullptr, uint32_t pitch = 0); - bool Copy(const CFX_RetainPtr& pSrc); + bool Copy(const RetainPtr& pSrc); // CFX_DIBSource uint8_t* GetBuffer() const override; @@ -39,7 +39,7 @@ class CFX_DIBitmap : public CFX_DIBSource { int clip_left, int clip_width) const override; - void TakeOver(CFX_RetainPtr&& pSrcBitmap); + void TakeOver(RetainPtr&& pSrcBitmap); bool ConvertFormat(FXDIB_Format format); void Clear(uint32_t color); @@ -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 CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, FXDIB_Channel srcChannel); bool LoadChannel(FXDIB_Channel destChannel, int value); bool MultiplyAlpha(int alpha); - bool MultiplyAlpha(const CFX_RetainPtr& pAlphaMask); + bool MultiplyAlpha(const RetainPtr& pAlphaMask); bool TransferBitmap(int dest_left, int dest_top, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& 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 CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top, int blend_type = FXDIB_BLEND_NORMAL, @@ -77,7 +77,7 @@ class CFX_DIBitmap : public CFX_DIBSource { int dest_top, int width, int height, - const CFX_RetainPtr& pMask, + const RetainPtr& pMask, uint32_t color, int src_left, int src_top, diff --git a/core/fxge/dib/cfx_dibsource.cpp b/core/fxge/dib/cfx_dibsource.cpp index c0e7841b89..9382917286 100644 --- a/core/fxge/dib/cfx_dibsource.cpp +++ b/core/fxge/dib/cfx_dibsource.cpp @@ -24,7 +24,7 @@ namespace { class CFX_Palette { public: - explicit CFX_Palette(const CFX_RetainPtr& pBitmap); + explicit CFX_Palette(const RetainPtr& pBitmap); ~CFX_Palette(); const uint32_t* GetPalette() { return m_Palette.data(); } @@ -64,7 +64,7 @@ void Obtain_Pal(std::pair* luts, } } -CFX_Palette::CFX_Palette(const CFX_RetainPtr& pBitmap) +CFX_Palette::CFX_Palette(const RetainPtr& pBitmap) : m_Palette(256), m_Luts(4096), m_lut(0) { int bpp = pBitmap->GetBPP() / 8; int width = pBitmap->GetWidth(); @@ -102,7 +102,7 @@ bool ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { uint8_t set_gray, reset_gray; @@ -126,7 +126,7 @@ bool ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { for (int row = 0; row < height; row++) { @@ -141,7 +141,7 @@ bool ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { uint32_t* src_plt = pSrcBitmap->GetPalette(); @@ -188,7 +188,7 @@ bool ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { uint32_t* src_plt = pSrcBitmap->GetPalette(); @@ -220,14 +220,13 @@ bool ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, return true; } -bool ConvertBuffer_RgbOrCmyk2Gray( - uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_RetainPtr& pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const RetainPtr& pSrcBitmap, + int src_left, + int src_top) { int Bpp = pSrcBitmap->GetBPP() / 8; if (pSrcBitmap->IsCmykImage()) { for (int row = 0; row < height; row++) { @@ -265,7 +264,7 @@ void ConvertBuffer_IndexCopy(uint8_t* dest_buf, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { if (pSrcBitmap->GetBPP() == 1) { @@ -296,7 +295,7 @@ bool ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top, uint32_t* dst_plt) { @@ -324,7 +323,7 @@ bool ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top, uint32_t* dst_plt) { @@ -387,7 +386,7 @@ bool ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; @@ -418,7 +417,7 @@ bool ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; @@ -442,7 +441,7 @@ bool ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; @@ -494,7 +493,7 @@ bool ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { int comps = (dst_format & 0xff) / 8; @@ -534,14 +533,13 @@ bool ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, return true; } -bool ConvertBuffer_24bppRgb2Rgb24( - uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_RetainPtr& pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const RetainPtr& pSrcBitmap, + int src_left, + int src_top) { for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; const uint8_t* src_scan = @@ -551,14 +549,13 @@ bool ConvertBuffer_24bppRgb2Rgb24( return true; } -bool ConvertBuffer_32bppRgb2Rgb24( - uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_RetainPtr& pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const RetainPtr& pSrcBitmap, + int src_left, + int src_top) { for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; const uint8_t* src_scan = @@ -577,7 +574,7 @@ bool ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { int comps = pSrcBitmap->GetBPP() / 8; @@ -596,14 +593,13 @@ bool ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, return true; } -bool ConvertBuffer_32bppCmyk2Rgb32( - uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_RetainPtr& pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const RetainPtr& pSrcBitmap, + int src_left, + int src_top) { for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; const uint8_t* src_scan = @@ -633,7 +629,7 @@ bool CFX_DIBSource::SkipToScanline(int line, IFX_PauseIndicator* pPause) const { return false; } -CFX_RetainPtr CFX_DIBSource::Clone(const FX_RECT* pClip) const { +RetainPtr CFX_DIBSource::Clone(const FX_RECT* pClip) const { FX_RECT rect(0, 0, m_Width, m_Height); if (pClip) { rect.Intersect(*pClip); @@ -829,7 +825,7 @@ void CFX_DIBSource::GetPalette(uint32_t* pal, int alpha) const { } } -CFX_RetainPtr CFX_DIBSource::CloneAlphaMask() const { +RetainPtr CFX_DIBSource::CloneAlphaMask() const { ASSERT(GetFormat() == FXDIB_Argb); FX_RECT rect(0, 0, m_Width, m_Height); auto pMask = pdfium::MakeRetain(); @@ -848,7 +844,7 @@ CFX_RetainPtr CFX_DIBSource::CloneAlphaMask() const { return pMask; } -bool CFX_DIBSource::SetAlphaMask(const CFX_RetainPtr& pAlphaMask, +bool CFX_DIBSource::SetAlphaMask(const RetainPtr& pAlphaMask, const FX_RECT* pClip) { if (!HasAlpha() || GetFormat() == FXDIB_Argb) return false; @@ -876,8 +872,8 @@ bool CFX_DIBSource::SetAlphaMask(const CFX_RetainPtr& pAlphaMask, return true; } -CFX_RetainPtr CFX_DIBSource::FlipImage(bool bXFlip, - bool bYFlip) const { +RetainPtr CFX_DIBSource::FlipImage(bool bXFlip, + bool bYFlip) const { auto pFlipped = pdfium::MakeRetain(); if (!pFlipped->Create(m_Width, m_Height, GetFormat())) return nullptr; @@ -948,8 +944,7 @@ CFX_RetainPtr CFX_DIBSource::FlipImage(bool bXFlip, return pFlipped; } -CFX_RetainPtr CFX_DIBSource::CloneConvert( - FXDIB_Format dest_format) { +RetainPtr CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) { if (dest_format == GetFormat()) return Clone(nullptr); @@ -957,7 +952,7 @@ CFX_RetainPtr CFX_DIBSource::CloneConvert( if (!pClone->Create(m_Width, m_Height, dest_format)) return nullptr; - CFX_RetainPtr pSrcAlpha; + RetainPtr pSrcAlpha; if (HasAlpha()) { if (GetFormat() == FXDIB_Argb) pSrcAlpha = CloneAlphaMask(); @@ -979,7 +974,7 @@ CFX_RetainPtr CFX_DIBSource::CloneConvert( if (!ret) return nullptr; - CFX_RetainPtr holder(this); + RetainPtr holder(this); std::unique_ptr pal_8bpp; if (!ConvertBuffer(dest_format, pClone->GetBuffer(), pClone->GetPitch(), m_Width, m_Height, holder, 0, 0, &pal_8bpp)) { @@ -991,8 +986,7 @@ CFX_RetainPtr CFX_DIBSource::CloneConvert( return pClone; } -CFX_RetainPtr CFX_DIBSource::SwapXY(bool bXFlip, - bool bYFlip) const { +RetainPtr CFX_DIBSource::SwapXY(bool bXFlip, bool bYFlip) const { FX_RECT dest_clip(0, 0, m_Height, m_Width); if (dest_clip.IsEmpty()) return nullptr; @@ -1086,11 +1080,11 @@ CFX_RetainPtr CFX_DIBSource::SwapXY(bool bXFlip, return pTransBitmap; } -CFX_RetainPtr CFX_DIBSource::TransformTo( +RetainPtr CFX_DIBSource::TransformTo( const CFX_Matrix* pDestMatrix, int* result_left, int* result_top) { - CFX_RetainPtr holder(this); + RetainPtr holder(this); CFX_ImageTransformer transformer(holder, pDestMatrix, 0, nullptr); transformer.Continue(nullptr); *result_left = transformer.result().left; @@ -1098,11 +1092,11 @@ CFX_RetainPtr CFX_DIBSource::TransformTo( return transformer.DetachBitmap(); } -CFX_RetainPtr CFX_DIBSource::StretchTo(int dest_width, - int dest_height, - uint32_t flags, - const FX_RECT* pClip) { - CFX_RetainPtr holder(this); +RetainPtr CFX_DIBSource::StretchTo(int dest_width, + int dest_height, + uint32_t flags, + const FX_RECT* pClip) { + RetainPtr holder(this); FX_RECT clip_rect(0, 0, abs(dest_width), abs(dest_height)); if (pClip) clip_rect.Intersect(*pClip); @@ -1129,7 +1123,7 @@ bool CFX_DIBSource::ConvertBuffer( int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top, std::unique_ptr* p_pal) { diff --git a/core/fxge/dib/cfx_dibsource.h b/core/fxge/dib/cfx_dibsource.h index 2315318ccb..e2cdfa61ad 100644 --- a/core/fxge/dib/cfx_dibsource.h +++ b/core/fxge/dib/cfx_dibsource.h @@ -9,9 +9,9 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_memory.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/fx_dib.h" enum FXDIB_Channel { @@ -29,7 +29,7 @@ class CFX_ClipRgn; class CFX_DIBitmap; class IFX_PauseIndicator; -class CFX_DIBSource : public CFX_Retainable { +class CFX_DIBSource : public Retainable { public: ~CFX_DIBSource() override; @@ -72,22 +72,22 @@ class CFX_DIBSource : public CFX_Retainable { // Copies into internally-owned palette. void SetPalette(const uint32_t* pSrcPal); - CFX_RetainPtr Clone(const FX_RECT* pClip) const; - CFX_RetainPtr CloneConvert(FXDIB_Format format); - CFX_RetainPtr StretchTo(int dest_width, - int dest_height, - uint32_t flags, - const FX_RECT* pClip); - CFX_RetainPtr TransformTo(const CFX_Matrix* pMatrix, - int* left, - int* top); - CFX_RetainPtr SwapXY(bool bXFlip, bool bYFlip) const; - CFX_RetainPtr FlipImage(bool bXFlip, bool bYFlip) const; + RetainPtr Clone(const FX_RECT* pClip) const; + RetainPtr CloneConvert(FXDIB_Format format); + RetainPtr StretchTo(int dest_width, + int dest_height, + uint32_t flags, + const FX_RECT* pClip); + RetainPtr TransformTo(const CFX_Matrix* pMatrix, + int* left, + int* top); + RetainPtr SwapXY(bool bXFlip, bool bYFlip) const; + RetainPtr FlipImage(bool bXFlip, bool bYFlip) const; - CFX_RetainPtr CloneAlphaMask() const; + RetainPtr CloneAlphaMask() const; // Copies into internally-owned mask. - bool SetAlphaMask(const CFX_RetainPtr& pAlphaMask, + bool SetAlphaMask(const RetainPtr& pAlphaMask, const FX_RECT* pClip); void GetOverlapRect(int& dest_left, @@ -104,7 +104,7 @@ class CFX_DIBSource : public CFX_Retainable { void DebugVerifyBitmapIsPreMultiplied(void* buffer) const; #endif - CFX_RetainPtr m_pAlphaMask; + RetainPtr m_pAlphaMask; protected: CFX_DIBSource(); @@ -114,7 +114,7 @@ class CFX_DIBSource : public CFX_Retainable { int dest_pitch, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top, std::unique_ptr* pal); diff --git a/core/fxge/dib/cfx_filtereddib.cpp b/core/fxge/dib/cfx_filtereddib.cpp index 2d6edd0d60..96fc8062a0 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 CFX_RetainPtr& pSrc) { +void CFX_FilteredDIB::LoadSrc(const RetainPtr& 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 3a16bb0750..e998c7169a 100644 --- a/core/fxge/dib/cfx_filtereddib.h +++ b/core/fxge/dib/cfx_filtereddib.h @@ -9,13 +9,13 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_dibsource.h" class CFX_FilteredDIB : public CFX_DIBSource { public: template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); ~CFX_FilteredDIB() override; @@ -28,7 +28,7 @@ class CFX_FilteredDIB : public CFX_DIBSource { int pixels, int Bpp) const = 0; - void LoadSrc(const CFX_RetainPtr& pSrc); + void LoadSrc(const RetainPtr& pSrc); protected: CFX_FilteredDIB(); @@ -43,7 +43,7 @@ class CFX_FilteredDIB : public CFX_DIBSource { int clip_left, int clip_width) const override; - CFX_RetainPtr m_pSrc; + RetainPtr m_pSrc; mutable std::vector m_Scanline; }; diff --git a/core/fxge/dib/cfx_imagerenderer.cpp b/core/fxge/dib/cfx_imagerenderer.cpp index 2330fe0587..658d363c89 100644 --- a/core/fxge/dib/cfx_imagerenderer.cpp +++ b/core/fxge/dib/cfx_imagerenderer.cpp @@ -13,15 +13,14 @@ #include "core/fxge/dib/cfx_imagetransformer.h" #include "third_party/base/ptr_util.h" -CFX_ImageRenderer::CFX_ImageRenderer( - const CFX_RetainPtr& pDevice, - const CFX_ClipRgn* pClipRgn, - const CFX_RetainPtr& pSource, - int bitmap_alpha, - uint32_t mask_color, - const CFX_Matrix* pMatrix, - uint32_t dib_flags, - bool bRgbByteOrder) +CFX_ImageRenderer::CFX_ImageRenderer(const RetainPtr& pDevice, + const CFX_ClipRgn* pClipRgn, + const RetainPtr& pSource, + int bitmap_alpha, + uint32_t mask_color, + const CFX_Matrix* pMatrix, + uint32_t dib_flags, + bool bRgbByteOrder) : m_pDevice(pDevice), m_pClipRgn(pClipRgn), m_Matrix(*pMatrix), @@ -96,7 +95,7 @@ bool CFX_ImageRenderer::Continue(IFX_PauseIndicator* pPause) { if (m_pTransformer->Continue(pPause)) return true; - CFX_RetainPtr pBitmap = m_pTransformer->DetachBitmap(); + RetainPtr pBitmap = m_pTransformer->DetachBitmap(); if (!pBitmap || !pBitmap->GetBuffer()) return false; diff --git a/core/fxge/dib/cfx_imagerenderer.h b/core/fxge/dib/cfx_imagerenderer.h index 068fe34a89..8a441fcea3 100644 --- a/core/fxge/dib/cfx_imagerenderer.h +++ b/core/fxge/dib/cfx_imagerenderer.h @@ -9,9 +9,9 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_bitmapcomposer.h" #include "core/fxge/dib/cfx_dibitmap.h" #include "core/fxge/dib/cfx_dibsource.h" @@ -23,9 +23,9 @@ class CFX_ImageStretcher; class CFX_ImageRenderer { public: - CFX_ImageRenderer(const CFX_RetainPtr& pDevice, + CFX_ImageRenderer(const RetainPtr& pDevice, const CFX_ClipRgn* pClipRgn, - const CFX_RetainPtr& pSource, + const RetainPtr& pSource, int bitmap_alpha, uint32_t mask_color, const CFX_Matrix* pMatrix, @@ -36,7 +36,7 @@ class CFX_ImageRenderer { bool Continue(IFX_PauseIndicator* pPause); private: - const CFX_RetainPtr m_pDevice; + const RetainPtr m_pDevice; const CFX_UnownedPtr m_pClipRgn; const CFX_Matrix m_Matrix; const int m_BitmapAlpha; diff --git a/core/fxge/dib/cfx_imagestretcher.cpp b/core/fxge/dib/cfx_imagestretcher.cpp index 0b7c542b30..03518c688e 100644 --- a/core/fxge/dib/cfx_imagestretcher.cpp +++ b/core/fxge/dib/cfx_imagestretcher.cpp @@ -42,13 +42,12 @@ std::tuple CmykDecode(const uint32_t cmyk) { } // namespace -CFX_ImageStretcher::CFX_ImageStretcher( - IFX_ScanlineComposer* pDest, - const CFX_RetainPtr& pSource, - int dest_width, - int dest_height, - const FX_RECT& bitmap_rect, - uint32_t flags) +CFX_ImageStretcher::CFX_ImageStretcher(IFX_ScanlineComposer* pDest, + const RetainPtr& pSource, + int dest_width, + int dest_height, + const FX_RECT& bitmap_rect, + uint32_t flags) : m_pDest(pDest), m_pSource(pSource), m_Flags(flags), diff --git a/core/fxge/dib/cfx_imagestretcher.h b/core/fxge/dib/cfx_imagestretcher.h index 84411015dd..5c696b79a7 100644 --- a/core/fxge/dib/cfx_imagestretcher.h +++ b/core/fxge/dib/cfx_imagestretcher.h @@ -9,10 +9,10 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_memory.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/ifx_scanlinecomposer.h" #include "core/fxge/fx_dib.h" @@ -22,7 +22,7 @@ class IFX_PauseIndicator; class CFX_ImageStretcher { public: CFX_ImageStretcher(IFX_ScanlineComposer* pDest, - const CFX_RetainPtr& pSource, + const RetainPtr& pSource, int dest_width, int dest_height, const FX_RECT& bitmap_rect, @@ -32,7 +32,7 @@ class CFX_ImageStretcher { bool Start(); bool Continue(IFX_PauseIndicator* pPause); - CFX_RetainPtr source() { return m_pSource; } + RetainPtr source() { return m_pSource; } private: bool StartQuickStretch(); @@ -41,7 +41,7 @@ class CFX_ImageStretcher { bool ContinueStretch(IFX_PauseIndicator* pPause); CFX_UnownedPtr const m_pDest; - CFX_RetainPtr m_pSource; + RetainPtr m_pSource; std::unique_ptr m_pStretchEngine; std::unique_ptr m_pScanline; std::unique_ptr m_pMaskScanline; diff --git a/core/fxge/dib/cfx_imagetransformer.cpp b/core/fxge/dib/cfx_imagetransformer.cpp index e64a2645da..51b75350e6 100644 --- a/core/fxge/dib/cfx_imagetransformer.cpp +++ b/core/fxge/dib/cfx_imagetransformer.cpp @@ -101,7 +101,7 @@ void bicubic_get_pos_weight(int pos_pixel[], v_w[3] = SDP_Table[512 - res_y]; } -FXDIB_Format GetTransformedFormat(const CFX_RetainPtr& pDrc) { +FXDIB_Format GetTransformedFormat(const RetainPtr& pDrc) { FXDIB_Format format = pDrc->GetFormat(); if (pDrc->IsAlphaMask()) { format = FXDIB_8bppMask; @@ -177,11 +177,10 @@ class CFX_BilinearMatrix : public CPDF_FixedMatrix { } // namespace -CFX_ImageTransformer::CFX_ImageTransformer( - const CFX_RetainPtr& pSrc, - const CFX_Matrix* pMatrix, - int flags, - const FX_RECT* pClip) +CFX_ImageTransformer::CFX_ImageTransformer(const RetainPtr& pSrc, + const CFX_Matrix* pMatrix, + int flags, + const FX_RECT* pClip) : m_pSrc(pSrc), m_pMatrix(pMatrix), m_pClip(pClip), @@ -818,6 +817,6 @@ bool CFX_ImageTransformer::Continue(IFX_PauseIndicator* pPause) { return false; } -CFX_RetainPtr CFX_ImageTransformer::DetachBitmap() { +RetainPtr CFX_ImageTransformer::DetachBitmap() { return m_Storer.Detach(); } diff --git a/core/fxge/dib/cfx_imagetransformer.h b/core/fxge/dib/cfx_imagetransformer.h index 0524a0c713..65c874585e 100644 --- a/core/fxge/dib/cfx_imagetransformer.h +++ b/core/fxge/dib/cfx_imagetransformer.h @@ -9,9 +9,9 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/dib/cfx_bitmapstorer.h" #include "core/fxge/dib/cfx_dibitmap.h" #include "core/fxge/dib/cfx_dibsource.h" @@ -20,7 +20,7 @@ class CFX_ImageStretcher; class CFX_ImageTransformer { public: - CFX_ImageTransformer(const CFX_RetainPtr& pSrc, + CFX_ImageTransformer(const RetainPtr& pSrc, const CFX_Matrix* pMatrix, int flags, const FX_RECT* pClip); @@ -29,10 +29,10 @@ class CFX_ImageTransformer { bool Continue(IFX_PauseIndicator* pPause); const FX_RECT& result() const { return m_result; } - CFX_RetainPtr DetachBitmap(); + RetainPtr DetachBitmap(); private: - const CFX_RetainPtr m_pSrc; + const RetainPtr m_pSrc; CFX_UnownedPtr const m_pMatrix; const FX_RECT* const m_pClip; FX_RECT m_StretchClip; diff --git a/core/fxge/dib/cstretchengine.cpp b/core/fxge/dib/cstretchengine.cpp index 4822d32b83..6803959730 100644 --- a/core/fxge/dib/cstretchengine.cpp +++ b/core/fxge/dib/cstretchengine.cpp @@ -222,7 +222,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, int dest_width, int dest_height, const FX_RECT& clip_rect, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int flags) { m_State = 0; m_DestFormat = dest_format; diff --git a/core/fxge/dib/cstretchengine.h b/core/fxge/dib/cstretchengine.h index 14c0975023..bdf79004a1 100644 --- a/core/fxge/dib/cstretchengine.h +++ b/core/fxge/dib/cstretchengine.h @@ -9,9 +9,9 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/fx_dib.h" class IFX_PauseIndicator; @@ -24,7 +24,7 @@ class CStretchEngine { int dest_width, int dest_height, const FX_RECT& clip_rect, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int flags); ~CStretchEngine(); @@ -68,7 +68,7 @@ class CStretchEngine { std::vector m_DestScanline; std::vector m_DestMaskScanline; FX_RECT m_SrcClip; - CFX_RetainPtr m_pSource; + RetainPtr m_pSource; uint32_t* m_pSrcPalette; int m_SrcWidth; int m_SrcHeight; diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h index 021efee7d9..89cda1ee5d 100644 --- a/core/fxge/fx_font.h +++ b/core/fxge/fx_font.h @@ -100,8 +100,7 @@ class CFX_Font { CFX_SubstFont* GetSubstFont() const { return m_pSubstFont.get(); } #ifdef PDF_ENABLE_XFA - bool LoadFile(const CFX_RetainPtr& pFile, - int nFaceIndex); + bool LoadFile(const RetainPtr& pFile, int nFaceIndex); bool LoadClone(const CFX_Font* pFont); void SetFace(FXFT_Face face); @@ -205,7 +204,7 @@ class CFX_GlyphBitmap { int m_Top; int m_Left; - CFX_RetainPtr m_pBitmap; + RetainPtr m_pBitmap; }; inline CFX_GlyphBitmap::CFX_GlyphBitmap() diff --git a/core/fxge/ifx_renderdevicedriver.cpp b/core/fxge/ifx_renderdevicedriver.cpp index 378c9b89ef..669aadf0d8 100644 --- a/core/fxge/ifx_renderdevicedriver.cpp +++ b/core/fxge/ifx_renderdevicedriver.cpp @@ -46,15 +46,14 @@ bool IFX_RenderDeviceDriver::DrawCosmeticLine(const CFX_PointF& ptMoveTo, return false; } -bool IFX_RenderDeviceDriver::GetDIBits( - const CFX_RetainPtr& pBitmap, - int left, - int top) { +bool IFX_RenderDeviceDriver::GetDIBits(const RetainPtr& pBitmap, + int left, + int top) { return false; } -CFX_RetainPtr IFX_RenderDeviceDriver::GetBackDrop() { - return CFX_RetainPtr(); +RetainPtr IFX_RenderDeviceDriver::GetBackDrop() { + return RetainPtr(); } bool IFX_RenderDeviceDriver::ContinueDIBits(CFX_ImageRenderer* handle, @@ -86,8 +85,8 @@ bool IFX_RenderDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, } bool IFX_RenderDeviceDriver::SetBitsWithMask( - const CFX_RetainPtr& pBitmap, - const CFX_RetainPtr& pMask, + const RetainPtr& pBitmap, + const RetainPtr& pMask, int left, int top, int bitmap_alpha, diff --git a/core/fxge/ifx_renderdevicedriver.h b/core/fxge/ifx_renderdevicedriver.h index cdea22e2db..e9498bdf22 100644 --- a/core/fxge/ifx_renderdevicedriver.h +++ b/core/fxge/ifx_renderdevicedriver.h @@ -9,9 +9,9 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" class CFX_DIBitmap; class CFX_DIBSource; @@ -60,17 +60,17 @@ class IFX_RenderDeviceDriver { int blend_type); virtual bool GetClipBox(FX_RECT* pRect) = 0; - virtual bool GetDIBits(const CFX_RetainPtr& pBitmap, + virtual bool GetDIBits(const RetainPtr& pBitmap, int left, int top); - virtual CFX_RetainPtr GetBackDrop(); - virtual bool SetDIBits(const CFX_RetainPtr& pBitmap, + virtual RetainPtr GetBackDrop(); + virtual bool SetDIBits(const RetainPtr& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int dest_left, int dest_top, int blend_type) = 0; - virtual bool StretchDIBits(const CFX_RetainPtr& pBitmap, + virtual bool StretchDIBits(const RetainPtr& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -79,7 +79,7 @@ class IFX_RenderDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) = 0; - virtual bool StartDIBits(const CFX_RetainPtr& pBitmap, + virtual bool StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -101,8 +101,8 @@ class IFX_RenderDeviceDriver { const FX_RECT& clip_rect, int alpha, bool bAlphaMode); - virtual bool SetBitsWithMask(const CFX_RetainPtr& pBitmap, - const CFX_RetainPtr& pMask, + virtual bool SetBitsWithMask(const RetainPtr& pBitmap, + const RetainPtr& pMask, int left, int top, int bitmap_alpha, diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 8ca7808df3..fe9fd1a852 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -54,12 +54,12 @@ namespace { #ifdef _SKIA_SUPPORT_PATHS_ -void RgbByteOrderTransferBitmap(const CFX_RetainPtr& pBitmap, +void RgbByteOrderTransferBitmap(const RetainPtr& pBitmap, int dest_left, int dest_top, int width, int height, - const CFX_RetainPtr& pSrcBitmap, + const RetainPtr& pSrcBitmap, int src_left, int src_top) { if (!pBitmap) @@ -262,8 +262,8 @@ void DebugDrawSkiaClipPath(SkCanvas* canvas, const SkPath& path) {} #endif // DRAW_SKIA_CLIP #ifdef _SKIA_SUPPORT_ -static void DebugValidate(const CFX_RetainPtr& bitmap, - const CFX_RetainPtr& device) { +static void DebugValidate(const RetainPtr& bitmap, + const RetainPtr& device) { if (bitmap) { SkASSERT(bitmap->GetBPP() == 8 || bitmap->GetBPP() == 32); if (bitmap->GetBPP() == 32) { @@ -564,7 +564,7 @@ void SetBitmapPaint(bool isAlphaMask, paint->setAlpha(bitmap_alpha); } -bool Upsample(const CFX_RetainPtr& pSource, +bool Upsample(const RetainPtr& pSource, std::unique_ptr& dst8Storage, std::unique_ptr& dst32Storage, SkBitmap* skBitmap, @@ -1492,9 +1492,9 @@ void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint, } CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, bool bRgbByteOrder, - const CFX_RetainPtr& pOriDevice, + const RetainPtr& pOriDevice, bool bGroupKnockout) : m_pBitmap(pBitmap), m_pOriDevice(pOriDevice), @@ -2179,7 +2179,7 @@ bool CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) { return true; } -bool CFX_SkiaDeviceDriver::GetDIBits(const CFX_RetainPtr& pBitmap, +bool CFX_SkiaDeviceDriver::GetDIBits(const RetainPtr& pBitmap, int left, int top) { if (!m_pBitmap) @@ -2216,7 +2216,7 @@ bool CFX_SkiaDeviceDriver::GetDIBits(const CFX_RetainPtr& pBitmap, m_pBitmap->UnPreMultiply(); FX_RECT rect(left, top, left + pBitmap->GetWidth(), top + pBitmap->GetHeight()); - CFX_RetainPtr pBack; + RetainPtr pBack; if (m_pOriDevice) { pBack = m_pOriDevice->Clone(&rect); if (!pBack) @@ -2244,17 +2244,16 @@ bool CFX_SkiaDeviceDriver::GetDIBits(const CFX_RetainPtr& pBitmap, #endif // _SKIA_SUPPORT_PATHS_ } -CFX_RetainPtr CFX_SkiaDeviceDriver::GetBackDrop() { +RetainPtr CFX_SkiaDeviceDriver::GetBackDrop() { return m_pOriDevice; } -bool CFX_SkiaDeviceDriver::SetDIBits( - const CFX_RetainPtr& pBitmap, - uint32_t argb, - const FX_RECT* pSrcRect, - int left, - int top, - int blend_type) { +bool CFX_SkiaDeviceDriver::SetDIBits(const RetainPtr& pBitmap, + uint32_t argb, + const FX_RECT* pSrcRect, + int left, + int top, + int blend_type) { if (!m_pBitmap || !m_pBitmap->GetBuffer()) return true; @@ -2280,7 +2279,7 @@ bool CFX_SkiaDeviceDriver::SetDIBits( } bool CFX_SkiaDeviceDriver::StretchDIBits( - const CFX_RetainPtr& pSource, + const RetainPtr& pSource, uint32_t argb, int dest_left, int dest_top, @@ -2332,7 +2331,7 @@ bool CFX_SkiaDeviceDriver::StretchDIBits( } bool CFX_SkiaDeviceDriver::StartDIBits( - const CFX_RetainPtr& pSource, + const RetainPtr& pSource, int bitmap_alpha, uint32_t argb, const CFX_Matrix* pMatrix, @@ -2408,7 +2407,7 @@ bool CFX_SkiaDeviceDriver::ContinueDIBits(CFX_ImageRenderer* handle, #if defined _SKIA_SUPPORT_ void CFX_SkiaDeviceDriver::PreMultiply( - const CFX_RetainPtr& pDIBitmap) { + const RetainPtr& pDIBitmap) { pDIBitmap->PreMultiply(); } #endif // _SKIA_SUPPORT_ @@ -2465,8 +2464,8 @@ void CFX_DIBitmap::UnPreMultiply() { #ifdef _SKIA_SUPPORT_ bool CFX_SkiaDeviceDriver::DrawBitsWithMask( - const CFX_RetainPtr& pSource, - const CFX_RetainPtr& pMask, + const RetainPtr& pSource, + const RetainPtr& pMask, int bitmap_alpha, const CFX_Matrix* pMatrix, int blend_type) { @@ -2506,8 +2505,8 @@ bool CFX_SkiaDeviceDriver::DrawBitsWithMask( } bool CFX_SkiaDeviceDriver::SetBitsWithMask( - const CFX_RetainPtr& pBitmap, - const CFX_RetainPtr& pMask, + const RetainPtr& pBitmap, + const RetainPtr& pMask, int dest_left, int dest_top, int bitmap_alpha, @@ -2555,11 +2554,10 @@ SkPictureRecorder* CFX_DefaultRenderDevice::CreateRecorder(int size_x, } #endif // _SKIA_SUPPORT_ -bool CFX_DefaultRenderDevice::Attach( - const CFX_RetainPtr& pBitmap, - bool bRgbByteOrder, - const CFX_RetainPtr& pOriDevice, - bool bGroupKnockout) { +bool CFX_DefaultRenderDevice::Attach(const RetainPtr& pBitmap, + bool bRgbByteOrder, + const RetainPtr& pOriDevice, + bool bGroupKnockout) { if (!pBitmap) return false; SetBitmap(pBitmap); @@ -2581,7 +2579,7 @@ bool CFX_DefaultRenderDevice::Create( int width, int height, FXDIB_Format format, - const CFX_RetainPtr& pOriDevice) { + const RetainPtr& pOriDevice) { auto pBitmap = pdfium::MakeRetain(); if (!pBitmap->Create(width, height, format)) { return false; @@ -2607,8 +2605,8 @@ void CFX_DefaultRenderDevice::DebugVerifyBitmapIsPreMultiplied() const { } bool CFX_DefaultRenderDevice::SetBitsWithMask( - const CFX_RetainPtr& pBitmap, - const CFX_RetainPtr& pMask, + const RetainPtr& pBitmap, + const RetainPtr& pMask, int left, int top, int bitmap_alpha, diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h index df28479d9a..7dcf362c66 100644 --- a/core/fxge/skia/fx_skia_device.h +++ b/core/fxge/skia/fx_skia_device.h @@ -24,9 +24,9 @@ struct SkIRect; class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { public: - CFX_SkiaDeviceDriver(const CFX_RetainPtr& pBitmap, + CFX_SkiaDeviceDriver(const RetainPtr& pBitmap, bool bRgbByteOrder, - const CFX_RetainPtr& pOriDevice, + const RetainPtr& pOriDevice, bool bGroupKnockout); #ifdef _SKIA_SUPPORT_ explicit CFX_SkiaDeviceDriver(SkPictureRecorder* recorder); @@ -77,21 +77,21 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { bool GetClipBox(FX_RECT* pRect) override; /** Load device buffer into a DIB */ - bool GetDIBits(const CFX_RetainPtr& pBitmap, + bool GetDIBits(const RetainPtr& pBitmap, int left, int top) override; - CFX_RetainPtr GetBackDrop() override; + RetainPtr GetBackDrop() override; - bool SetDIBits(const CFX_RetainPtr& pBitmap, + bool SetDIBits(const RetainPtr& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int dest_left, int dest_top, int blend_type) override; #ifdef _SKIA_SUPPORT_ - bool SetBitsWithMask(const CFX_RetainPtr& pBitmap, - const CFX_RetainPtr& pMask, + bool SetBitsWithMask(const RetainPtr& pBitmap, + const RetainPtr& pMask, int dest_left, int dest_top, int bitmap_alpha, @@ -102,7 +102,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { void SetClipMask(const FX_RECT& clipBox, const SkPath& skClipPath); #endif - bool StretchDIBits(const CFX_RetainPtr& pBitmap, + bool StretchDIBits(const RetainPtr& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -112,7 +112,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { uint32_t flags, int blend_type) override; - bool StartDIBits(const CFX_RetainPtr& pBitmap, + bool StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -123,8 +123,8 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { bool ContinueDIBits(CFX_ImageRenderer* handle, IFX_PauseIndicator* pPause) override; - bool DrawBitsWithMask(const CFX_RetainPtr& pBitmap, - const CFX_RetainPtr& pMask, + bool DrawBitsWithMask(const RetainPtr& pBitmap, + const RetainPtr& pMask, int bitmap_alpha, const CFX_Matrix* pMatrix, int blend_type); @@ -151,7 +151,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { void Flush() override; SkPictureRecorder* GetRecorder() const { return m_pRecorder; } void PreMultiply() { m_pBitmap->PreMultiply(); } - static void PreMultiply(const CFX_RetainPtr& pDIBitmap); + static void PreMultiply(const RetainPtr& pDIBitmap); SkCanvas* SkiaCanvas() { return m_pCanvas; } void DebugVerifyBitmapIsPreMultiplied() const; void Dump() const; @@ -159,8 +159,8 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { private: friend class SkiaState; - CFX_RetainPtr m_pBitmap; - CFX_RetainPtr m_pOriDevice; + RetainPtr m_pBitmap; + RetainPtr m_pOriDevice; SkCanvas* m_pCanvas; SkPictureRecorder* const m_pRecorder; std::unique_ptr m_pCache; diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp index 94d9a0f2cf..a959b6e2dc 100644 --- a/core/fxge/skia/fx_skia_device_unittest.cpp +++ b/core/fxge/skia/fx_skia_device_unittest.cpp @@ -124,7 +124,7 @@ void Harness(void (*Test)(CFX_SkiaDeviceDriver*, const State&), return; FPDFBitmap_FillRect(bitmap, 0, 0, w, h, 0x00000000); CFX_DefaultRenderDevice geDevice; - CFX_RetainPtr pBitmap(CFXBitmapFromFPDFBitmap(bitmap)); + RetainPtr pBitmap(CFXBitmapFromFPDFBitmap(bitmap)); geDevice.Attach(pBitmap, false, nullptr, false); CFX_SkiaDeviceDriver* driver = static_cast(geDevice.GetDeviceDriver()); diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index 7e21b25411..4f79ef31ad 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -101,7 +101,7 @@ CFX_PSRenderer::CFX_PSRenderer() CFX_PSRenderer::~CFX_PSRenderer() {} -void CFX_PSRenderer::Init(const CFX_RetainPtr& pStream, +void CFX_PSRenderer::Init(const RetainPtr& pStream, int pslevel, int width, int height, @@ -342,7 +342,7 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) { m_pStream->WriteBlock(buf.str().c_str(), buf.tellp()); } -bool CFX_PSRenderer::SetDIBits(const CFX_RetainPtr& pSource, +bool CFX_PSRenderer::SetDIBits(const RetainPtr& pSource, uint32_t color, int left, int top) { @@ -353,7 +353,7 @@ bool CFX_PSRenderer::SetDIBits(const CFX_RetainPtr& pSource, return DrawDIBits(pSource, color, &matrix, 0); } -bool CFX_PSRenderer::StretchDIBits(const CFX_RetainPtr& pSource, +bool CFX_PSRenderer::StretchDIBits(const RetainPtr& pSource, uint32_t color, int dest_left, int dest_top, @@ -366,7 +366,7 @@ bool CFX_PSRenderer::StretchDIBits(const CFX_RetainPtr& pSource, return DrawDIBits(pSource, color, &matrix, flags); } -bool CFX_PSRenderer::DrawDIBits(const CFX_RetainPtr& pSource, +bool CFX_PSRenderer::DrawDIBits(const RetainPtr& pSource, uint32_t color, const CFX_Matrix* pMatrix, uint32_t flags) { @@ -428,7 +428,7 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_RetainPtr& pSource, output_buf.release(); } else { CFX_DIBExtractor source_extractor(pSource); - CFX_RetainPtr pConverted = source_extractor.GetBitmap(); + RetainPtr pConverted = source_extractor.GetBitmap(); if (!pConverted) return false; switch (pSource->GetFormat()) { diff --git a/core/fxge/win32/cfx_psrenderer.h b/core/fxge/win32/cfx_psrenderer.h index 01a9001b62..33829ead98 100644 --- a/core/fxge/win32/cfx_psrenderer.h +++ b/core/fxge/win32/cfx_psrenderer.h @@ -10,10 +10,10 @@ #include #include -#include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_stream.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/cfx_graphstatedata.h" class CFX_DIBSource; @@ -30,7 +30,7 @@ class CFX_PSRenderer { CFX_PSRenderer(); ~CFX_PSRenderer(); - void Init(const CFX_RetainPtr& stream, + void Init(const RetainPtr& stream, int pslevel, int width, int height, @@ -52,18 +52,18 @@ class CFX_PSRenderer { uint32_t fill_color, uint32_t stroke_color, int fill_mode); - bool SetDIBits(const CFX_RetainPtr& pBitmap, + bool SetDIBits(const RetainPtr& pBitmap, uint32_t color, int dest_left, int dest_top); - bool StretchDIBits(const CFX_RetainPtr& pBitmap, + bool StretchDIBits(const RetainPtr& pBitmap, uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, uint32_t flags); - bool DrawDIBits(const CFX_RetainPtr& pBitmap, + bool DrawDIBits(const RetainPtr& pBitmap, uint32_t color, const CFX_Matrix* pMatrix, uint32_t flags); @@ -86,7 +86,7 @@ class CFX_PSRenderer { int* ps_glyphindex); void WritePSBinary(const uint8_t* data, int len); - CFX_RetainPtr m_pStream; + RetainPtr m_pStream; int m_PSLevel; CFX_GraphStateData m_CurGraphState; bool m_bGraphStateSet; diff --git a/core/fxge/win32/cfx_windowsdib.h b/core/fxge/win32/cfx_windowsdib.h index 28f152acfa..cc2305001e 100644 --- a/core/fxge/win32/cfx_windowsdib.h +++ b/core/fxge/win32/cfx_windowsdib.h @@ -29,18 +29,17 @@ typedef struct WINDIB_Open_Args_ { class CFX_WindowsDIB : public CFX_DIBitmap { public: template - friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); + friend RetainPtr pdfium::MakeRetain(Args&&... args); ~CFX_WindowsDIB() override; - static ByteString GetBitmapInfo(const CFX_RetainPtr& pBitmap); - static HBITMAP GetDDBitmap(const CFX_RetainPtr& pBitmap, - HDC hDC); + static ByteString GetBitmapInfo(const RetainPtr& pBitmap); + static HBITMAP GetDDBitmap(const RetainPtr& pBitmap, HDC hDC); - static CFX_RetainPtr LoadFromBuf(BITMAPINFO* pbmi, void* pData); - static CFX_RetainPtr LoadFromFile(const wchar_t* filename); - static CFX_RetainPtr LoadFromFile(const char* filename); - static CFX_RetainPtr LoadDIBitmap(WINDIB_Open_Args_ args); + static RetainPtr LoadFromBuf(BITMAPINFO* pbmi, void* pData); + static RetainPtr LoadFromFile(const wchar_t* filename); + static RetainPtr LoadFromFile(const char* filename); + static RetainPtr LoadDIBitmap(WINDIB_Open_Args_ args); HBITMAP GetWindowsBitmap() const { return m_hBitmap; } diff --git a/core/fxge/win32/dwrite_int.h b/core/fxge/win32/dwrite_int.h index 2d1deb6012..7fbb929c08 100644 --- a/core/fxge/win32/dwrite_int.h +++ b/core/fxge/win32/dwrite_int.h @@ -43,7 +43,7 @@ class CDWriteExt { void* DwCreateFontFaceFromStream(uint8_t* pData, uint32_t size, int simulation_style); - bool DwCreateRenderingTarget(const CFX_RetainPtr& pSrc, + bool DwCreateRenderingTarget(const RetainPtr& pSrc, void** renderTarget); void DwDeleteRenderingTarget(void* renderTarget); bool DwRendingString(void* renderTarget, diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index ac13266444..41c3dc3ff1 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -781,13 +781,12 @@ void CGdiDeviceDriver::RestoreState(bool bKeepSaved) { SaveDC(m_hDC); } -bool CGdiDeviceDriver::GDI_SetDIBits( - const CFX_RetainPtr& pBitmap1, - const FX_RECT* pSrcRect, - int left, - int top) { +bool CGdiDeviceDriver::GDI_SetDIBits(const RetainPtr& pBitmap1, + const FX_RECT* pSrcRect, + int left, + int top) { if (m_DeviceClass == FXDC_PRINTER) { - CFX_RetainPtr pBitmap = pBitmap1->FlipImage(false, true); + RetainPtr pBitmap = pBitmap1->FlipImage(false, true); if (!pBitmap) return false; @@ -806,7 +805,7 @@ bool CGdiDeviceDriver::GDI_SetDIBits( dst_height, pBuffer, (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS, SRCCOPY); } else { - CFX_RetainPtr pBitmap = pBitmap1; + RetainPtr pBitmap = pBitmap1; if (pBitmap->IsCmykImage()) { pBitmap = pBitmap->CloneConvert(FXDIB_Rgb); if (!pBitmap) @@ -824,13 +823,13 @@ bool CGdiDeviceDriver::GDI_SetDIBits( } bool CGdiDeviceDriver::GDI_StretchDIBits( - const CFX_RetainPtr& pBitmap1, + const RetainPtr& pBitmap1, int dest_left, int dest_top, int dest_width, int dest_height, uint32_t flags) { - CFX_RetainPtr pBitmap = pBitmap1; + RetainPtr pBitmap = pBitmap1; if (!pBitmap || dest_width == 0 || dest_height == 0) return false; @@ -845,7 +844,7 @@ bool CGdiDeviceDriver::GDI_StretchDIBits( } else { SetStretchBltMode(m_hDC, COLORONCOLOR); } - CFX_RetainPtr pToStrechBitmap = pBitmap; + RetainPtr pToStrechBitmap = pBitmap; if (m_DeviceClass == FXDC_PRINTER && ((int64_t)pBitmap->GetWidth() * pBitmap->GetHeight() > (int64_t)abs(dest_width) * abs(dest_height))) { @@ -862,14 +861,14 @@ bool CGdiDeviceDriver::GDI_StretchDIBits( } bool CGdiDeviceDriver::GDI_StretchBitMask( - const CFX_RetainPtr& pBitmap1, + const RetainPtr& pBitmap1, int dest_left, int dest_top, int dest_width, int dest_height, uint32_t bitmap_color, uint32_t flags) { - CFX_RetainPtr pBitmap = pBitmap1; + RetainPtr pBitmap = pBitmap1; if (!pBitmap || dest_width == 0 || dest_height == 0) return false; @@ -1161,7 +1160,7 @@ CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC) CGdiDisplayDriver::~CGdiDisplayDriver() {} -bool CGdiDisplayDriver::GetDIBits(const CFX_RetainPtr& pBitmap, +bool CGdiDisplayDriver::GetDIBits(const RetainPtr& pBitmap, int left, int top) { bool ret = false; @@ -1201,7 +1200,7 @@ bool CGdiDisplayDriver::GetDIBits(const CFX_RetainPtr& pBitmap, return ret; } -bool CGdiDisplayDriver::SetDIBits(const CFX_RetainPtr& pSource, +bool CGdiDisplayDriver::SetDIBits(const RetainPtr& pSource, uint32_t color, const FX_RECT* pSrcRect, int left, @@ -1242,14 +1241,14 @@ bool CGdiDisplayDriver::SetDIBits(const CFX_RetainPtr& pSource, return SetDIBits(bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL); } CFX_DIBExtractor temp(pSource); - CFX_RetainPtr pBitmap = temp.GetBitmap(); + RetainPtr pBitmap = temp.GetBitmap(); if (!pBitmap) return false; return GDI_SetDIBits(pBitmap, pSrcRect, left, top); } bool CGdiDisplayDriver::UseFoxitStretchEngine( - const CFX_RetainPtr& pSource, + const RetainPtr& pSource, uint32_t color, int dest_left, int dest_top, @@ -1265,7 +1264,7 @@ bool CGdiDisplayDriver::UseFoxitStretchEngine( dest_top += dest_height; bitmap_clip.Offset(-dest_left, -dest_top); - CFX_RetainPtr pStretched = + RetainPtr pStretched = pSource->StretchTo(dest_width, dest_height, render_flags, &bitmap_clip); if (!pStretched) return true; @@ -1275,16 +1274,15 @@ bool CGdiDisplayDriver::UseFoxitStretchEngine( pClipRect->top, FXDIB_BLEND_NORMAL); } -bool CGdiDisplayDriver::StretchDIBits( - const CFX_RetainPtr& pSource, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) { +bool CGdiDisplayDriver::StretchDIBits(const RetainPtr& pSource, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) { ASSERT(pSource && pClipRect); if (flags || dest_width > 10000 || dest_width < -10000 || dest_height > 10000 || dest_height < -10000) { @@ -1301,7 +1299,7 @@ bool CGdiDisplayDriver::StretchDIBits( clip_rect.Intersect(*pClipRect); clip_rect.Offset(-image_rect.left, -image_rect.top); int clip_width = clip_rect.Width(), clip_height = clip_rect.Height(); - CFX_RetainPtr pStretched( + RetainPtr pStretched( pSource->StretchTo(dest_width, dest_height, flags, &clip_rect)); if (!pStretched) return true; @@ -1325,7 +1323,7 @@ bool CGdiDisplayDriver::StretchDIBits( (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); if (pPlatform->m_GdiplusExt.IsAvailable() && !pSource->IsCmykImage()) { CFX_DIBExtractor temp(pSource); - CFX_RetainPtr pBitmap = temp.GetBitmap(); + RetainPtr pBitmap = temp.GetBitmap(); if (!pBitmap) return false; return pPlatform->m_GdiplusExt.StretchDIBits( @@ -1336,14 +1334,14 @@ bool CGdiDisplayDriver::StretchDIBits( dest_width, dest_height, pClipRect, flags); } CFX_DIBExtractor temp(pSource); - CFX_RetainPtr pBitmap = temp.GetBitmap(); + RetainPtr pBitmap = temp.GetBitmap(); if (!pBitmap) return false; return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags); } -bool CGdiDisplayDriver::StartDIBits(const CFX_RetainPtr& pBitmap, +bool CGdiDisplayDriver::StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp index c00543b169..6416b5af36 100644 --- a/core/fxge/win32/fx_win32_dib.cpp +++ b/core/fxge/win32/fx_win32_dib.cpp @@ -12,7 +12,7 @@ #include "core/fxge/win32/win32_int.h" ByteString CFX_WindowsDIB::GetBitmapInfo( - const CFX_RetainPtr& pBitmap) { + const RetainPtr& pBitmap) { ByteString result; int len = sizeof(BITMAPINFOHEADER); if (pBitmap->GetBPP() == 1 || pBitmap->GetBPP() == 8) { @@ -52,9 +52,9 @@ ByteString CFX_WindowsDIB::GetBitmapInfo( return result; } -CFX_RetainPtr _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, - LPVOID pData, - bool bAlpha) { +RetainPtr _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, + LPVOID pData, + bool bAlpha) { int width = pbmi->bmiHeader.biWidth; int height = pbmi->bmiHeader.biHeight; BOOL bBottomUp = true; @@ -95,12 +95,12 @@ CFX_RetainPtr _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, return pBitmap; } -CFX_RetainPtr CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi, - LPVOID pData) { +RetainPtr CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi, + LPVOID pData) { return _FX_WindowsDIB_LoadFromBuf(pbmi, pData, false); } -HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_RetainPtr& pBitmap, +HBITMAP CFX_WindowsDIB::GetDDBitmap(const RetainPtr& pBitmap, HDC hDC) { ByteString info = GetBitmapInfo(pBitmap); return CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT, @@ -115,8 +115,7 @@ void GetBitmapSize(HBITMAP hBitmap, int& w, int& h) { h = bmp.bmHeight; } -CFX_RetainPtr CFX_WindowsDIB::LoadFromFile( - const wchar_t* filename) { +RetainPtr CFX_WindowsDIB::LoadFromFile(const wchar_t* filename) { CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); if (pPlatform->m_GdiplusExt.IsAvailable()) { @@ -148,12 +147,11 @@ CFX_RetainPtr CFX_WindowsDIB::LoadFromFile( return pDIBitmap; } -CFX_RetainPtr CFX_WindowsDIB::LoadFromFile(const char* filename) { +RetainPtr CFX_WindowsDIB::LoadFromFile(const char* filename) { return LoadFromFile(WideString::FromLocal(filename).c_str()); } -CFX_RetainPtr CFX_WindowsDIB::LoadDIBitmap( - WINDIB_Open_Args_ args) { +RetainPtr CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) { CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData(); if (pPlatform->m_GdiplusExt.IsAvailable()) { diff --git a/core/fxge/win32/fx_win32_dwrite.cpp b/core/fxge/win32/fx_win32_dwrite.cpp index 8b1786a088..4d4f45f947 100644 --- a/core/fxge/win32/fx_win32_dwrite.cpp +++ b/core/fxge/win32/fx_win32_dwrite.cpp @@ -103,7 +103,7 @@ class CDwFontContext { class CDwGdiTextRenderer { public: - CDwGdiTextRenderer(const CFX_RetainPtr& pBitmap, + CDwGdiTextRenderer(const RetainPtr& pBitmap, IDWriteBitmapRenderTarget* bitmapRenderTarget, IDWriteRenderingParams* renderingParams); ~CDwGdiTextRenderer(); @@ -118,7 +118,7 @@ class CDwGdiTextRenderer { const COLORREF& textColor); private: - CFX_RetainPtr pBitmap_; + RetainPtr pBitmap_; IDWriteBitmapRenderTarget* pRenderTarget_; IDWriteRenderingParams* pRenderingParams_; }; @@ -180,9 +180,8 @@ failed: return nullptr; } -bool CDWriteExt::DwCreateRenderingTarget( - const CFX_RetainPtr& pBitmap, - void** renderTarget) { +bool CDWriteExt::DwCreateRenderingTarget(const RetainPtr& pBitmap, + void** renderTarget) { if (pBitmap->GetFormat() > FXDIB_Argb) { return false; } @@ -396,7 +395,7 @@ HRESULT CDwFontContext::Initialize() { } CDwGdiTextRenderer::CDwGdiTextRenderer( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, IDWriteBitmapRenderTarget* bitmapRenderTarget, IDWriteRenderingParams* renderingParams) : pBitmap_(pBitmap), diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 8161c5d333..70da194be4 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -462,10 +462,10 @@ static GpBrush* _GdipCreateBrush(DWORD argb) { return solidBrush; } -static CFX_RetainPtr StretchMonoToGray( +static RetainPtr StretchMonoToGray( int dest_width, int dest_height, - const CFX_RetainPtr& pSource, + const RetainPtr& pSource, FX_RECT* pClipRect) { bool bFlipX = dest_width < 0; if (bFlipX) @@ -519,7 +519,7 @@ static CFX_RetainPtr StretchMonoToGray( static void OutputImageMask(GpGraphics* pGraphics, BOOL bMonoDevice, - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, int dest_left, int dest_top, int dest_width, @@ -563,7 +563,7 @@ static void OutputImageMask(GpGraphics* pGraphics, return; image_clip.Offset(-image_rect.left, -image_rect.top); - CFX_RetainPtr pStretched; + RetainPtr pStretched; if (src_width * src_height > 10000) { pStretched = StretchMonoToGray(dest_width, dest_height, pBitmap, &image_clip); @@ -606,7 +606,7 @@ static void OutputImageMask(GpGraphics* pGraphics, CallFunc(GdipDisposeImage)(bitmap); } static void OutputImage(GpGraphics* pGraphics, - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, const FX_RECT* pSrcRect, int dest_left, int dest_top, @@ -617,7 +617,7 @@ static void OutputImage(GpGraphics* pGraphics, ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; if (pBitmap->GetBPP() == 1 && (pSrcRect->left % 8)) { FX_RECT new_rect(0, 0, src_width, src_height); - CFX_RetainPtr pCloned = pBitmap->Clone(pSrcRect); + RetainPtr pCloned = pBitmap->Clone(pSrcRect); if (!pCloned) return; OutputImage(pGraphics, pCloned, &new_rect, dest_left, dest_top, dest_width, @@ -733,7 +733,7 @@ void CGdiplusExt::DeleteMemFont(LPVOID pCollection) { ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; CallFunc(GdipDeletePrivateFontCollection)((GpFontCollection**)&pCollection); } -bool CGdiplusExt::GdipCreateBitmap(const CFX_RetainPtr& pBitmap, +bool CGdiplusExt::GdipCreateBitmap(const RetainPtr& pBitmap, void** bitmap) { CGdiplusExt& GdiplusExt = ((CWin32Platform*)CFX_GEModule::Get()->GetPlatformData())->m_GdiplusExt; @@ -897,7 +897,7 @@ void CGdiplusExt::GdipDeleteGraphics(void* graphics) { } bool CGdiplusExt::StretchBitMask(HDC hDC, BOOL bMonoDevice, - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, int dest_left, int dest_top, int dest_width, @@ -923,7 +923,7 @@ bool CGdiplusExt::StretchBitMask(HDC hDC, return true; } bool CGdiplusExt::StretchDIBits(HDC hDC, - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, int dest_left, int dest_top, int dest_width, @@ -1463,11 +1463,11 @@ static void FreeDIBitmap(PREVIEW3_DIBITMAP* pInfo) { } // TODO(tsepez): Really? Really? Move to header. -CFX_RetainPtr _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, - LPVOID pData, - bool bAlpha); +RetainPtr _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, + LPVOID pData, + bool bAlpha); -CFX_RetainPtr CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) { +RetainPtr CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) { PREVIEW3_DIBITMAP* pInfo = ::LoadDIBitmap(args); if (!pInfo) return nullptr; @@ -1484,7 +1484,7 @@ CFX_RetainPtr CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) { dest_pitch); } } - CFX_RetainPtr pDIBitmap = _FX_WindowsDIB_LoadFromBuf( + RetainPtr pDIBitmap = _FX_WindowsDIB_LoadFromBuf( pInfo->pbmi, pData, pInfo->pbmi->bmiHeader.biBitCount == 32); FX_Free(pData); FreeDIBitmap(pInfo); diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index fa2c8b7ef3..3c08acddda 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -69,7 +69,7 @@ int CGdiPrinterDriver::GetDeviceCaps(int caps_id) const { return CGdiDeviceDriver::GetDeviceCaps(caps_id); } -bool CGdiPrinterDriver::SetDIBits(const CFX_RetainPtr& pSource, +bool CGdiPrinterDriver::SetDIBits(const RetainPtr& pSource, uint32_t color, const FX_RECT* pSrcRect, int left, @@ -89,30 +89,29 @@ bool CGdiPrinterDriver::SetDIBits(const CFX_RetainPtr& pSource, return false; CFX_DIBExtractor temp(pSource); - CFX_RetainPtr pBitmap = temp.GetBitmap(); + RetainPtr pBitmap = temp.GetBitmap(); if (!pBitmap) return false; return GDI_SetDIBits(pBitmap, pSrcRect, left, top); } -bool CGdiPrinterDriver::StretchDIBits( - const CFX_RetainPtr& pSource, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) { +bool CGdiPrinterDriver::StretchDIBits(const RetainPtr& pSource, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) { if (pSource->IsAlphaMask()) { int alpha = FXARGB_A(color); if (pSource->GetBPP() != 1 || alpha != 255) return false; if (dest_width < 0 || dest_height < 0) { - CFX_RetainPtr pFlipped = + RetainPtr pFlipped = pSource->FlipImage(dest_width < 0, dest_height < 0); if (!pFlipped) return false; @@ -127,7 +126,7 @@ bool CGdiPrinterDriver::StretchDIBits( } CFX_DIBExtractor temp(pSource); - CFX_RetainPtr pBitmap = temp.GetBitmap(); + RetainPtr pBitmap = temp.GetBitmap(); if (!pBitmap) return false; return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width, @@ -138,7 +137,7 @@ bool CGdiPrinterDriver::StretchDIBits( return false; if (dest_width < 0 || dest_height < 0) { - CFX_RetainPtr pFlipped = + RetainPtr pFlipped = pSource->FlipImage(dest_width < 0, dest_height < 0); if (!pFlipped) return false; @@ -153,14 +152,14 @@ bool CGdiPrinterDriver::StretchDIBits( } CFX_DIBExtractor temp(pSource); - CFX_RetainPtr pBitmap = temp.GetBitmap(); + RetainPtr pBitmap = temp.GetBitmap(); if (!pBitmap) return false; return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags); } -bool CGdiPrinterDriver::StartDIBits(const CFX_RetainPtr& pSource, +bool CGdiPrinterDriver::StartDIBits(const RetainPtr& pSource, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -187,7 +186,7 @@ bool CGdiPrinterDriver::StartDIBits(const CFX_RetainPtr& pSource, if (fabs(pMatrix->a) >= 0.5f || fabs(pMatrix->d) >= 0.5f) return false; - CFX_RetainPtr pTransformed = + RetainPtr pTransformed = pSource->SwapXY(pMatrix->c > 0, pMatrix->b < 0); if (!pTransformed) return false; @@ -440,7 +439,7 @@ bool CPSPrinterDriver::GetClipBox(FX_RECT* pRect) { return true; } -bool CPSPrinterDriver::SetDIBits(const CFX_RetainPtr& pBitmap, +bool CPSPrinterDriver::SetDIBits(const RetainPtr& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, @@ -451,23 +450,22 @@ bool CPSPrinterDriver::SetDIBits(const CFX_RetainPtr& pBitmap, return m_PSRenderer.SetDIBits(pBitmap, color, left, top); } -bool CPSPrinterDriver::StretchDIBits( - const CFX_RetainPtr& pBitmap, - uint32_t color, - int dest_left, - int dest_top, - int dest_width, - int dest_height, - const FX_RECT* pClipRect, - uint32_t flags, - int blend_type) { +bool CPSPrinterDriver::StretchDIBits(const RetainPtr& pBitmap, + uint32_t color, + int dest_left, + int dest_top, + int dest_width, + int dest_height, + const FX_RECT* pClipRect, + uint32_t flags, + int blend_type) { if (blend_type != FXDIB_BLEND_NORMAL) return false; return m_PSRenderer.StretchDIBits(pBitmap, color, dest_left, dest_top, dest_width, dest_height, flags); } -bool CPSPrinterDriver::StartDIBits(const CFX_RetainPtr& pBitmap, +bool CPSPrinterDriver::StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -552,13 +550,12 @@ bool CTextOnlyPrinterDriver::DrawPath(const CFX_PathData* pPathData, return false; } -bool CTextOnlyPrinterDriver::SetDIBits( - const CFX_RetainPtr& pBitmap, - uint32_t color, - const FX_RECT* pSrcRect, - int left, - int top, - int blend_type) { +bool CTextOnlyPrinterDriver::SetDIBits(const RetainPtr& pBitmap, + uint32_t color, + const FX_RECT* pSrcRect, + int left, + int top, + int blend_type) { return false; } @@ -571,7 +568,7 @@ bool CTextOnlyPrinterDriver::GetClipBox(FX_RECT* pRect) { } bool CTextOnlyPrinterDriver::StretchDIBits( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -584,7 +581,7 @@ bool CTextOnlyPrinterDriver::StretchDIBits( } bool CTextOnlyPrinterDriver::StartDIBits( - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h index f9fcbe83af..c4559f4741 100644 --- a/core/fxge/win32/win32_int.h +++ b/core/fxge/win32/win32_int.h @@ -11,7 +11,7 @@ #include -#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/ifx_renderdevicedriver.h" #include "core/fxge/win32/cfx_psrenderer.h" @@ -36,7 +36,7 @@ class CGdiplusExt { bool IsAvailable() { return !!m_hModule; } bool StretchBitMask(HDC hDC, BOOL bMonoDevice, - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, int dest_left, int dest_top, int dest_width, @@ -45,7 +45,7 @@ class CGdiplusExt { const FX_RECT* pClipRect, int flags); bool StretchDIBits(HDC hDC, - const CFX_RetainPtr& pBitmap, + const RetainPtr& pBitmap, int dest_left, int dest_top, int dest_width, @@ -98,8 +98,7 @@ class CGdiplusExt { float font_size, int fontstyle); void GdipDeleteFont(void* pFont); - bool GdipCreateBitmap(const CFX_RetainPtr& pBitmap, - void** bitmap); + bool GdipCreateBitmap(const RetainPtr& pBitmap, void** bitmap); void GdipDisposeImage(void* bitmap); void GdipGetFontSize(void* pFont, float* size); void* GdiAddFontMemResourceEx(void* pFontdata, @@ -107,7 +106,7 @@ class CGdiplusExt { void* pdv, uint32_t* num_face); bool GdiRemoveFontMemResourceEx(void* handle); - CFX_RetainPtr LoadDIBitmap(WINDIB_Open_Args_ args); + RetainPtr LoadDIBitmap(WINDIB_Open_Args_ args); FARPROC m_Functions[100]; FuncType_GdiAddFontMemResourceEx m_pGdiAddFontMemResourceEx; @@ -158,17 +157,17 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver { void DrawLine(float x1, float y1, float x2, float y2); - bool GDI_SetDIBits(const CFX_RetainPtr& pBitmap, + bool GDI_SetDIBits(const RetainPtr& pBitmap, const FX_RECT* pSrcRect, int left, int top); - bool GDI_StretchDIBits(const CFX_RetainPtr& pBitmap, + bool GDI_StretchDIBits(const RetainPtr& pBitmap, int dest_left, int dest_top, int dest_width, int dest_height, uint32_t flags); - bool GDI_StretchBitMask(const CFX_RetainPtr& pBitmap, + bool GDI_StretchBitMask(const RetainPtr& pBitmap, int dest_left, int dest_top, int dest_width, @@ -191,16 +190,16 @@ class CGdiDisplayDriver : public CGdiDeviceDriver { ~CGdiDisplayDriver() override; protected: - bool GetDIBits(const CFX_RetainPtr& pBitmap, + bool GetDIBits(const RetainPtr& pBitmap, int left, int top) override; - bool SetDIBits(const CFX_RetainPtr& pBitmap, + bool SetDIBits(const RetainPtr& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_RetainPtr& pBitmap, + bool StretchDIBits(const RetainPtr& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -209,14 +208,14 @@ class CGdiDisplayDriver : public CGdiDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const CFX_RetainPtr& pBitmap, + bool StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, uint32_t render_flags, std::unique_ptr* handle, int blend_type) override; - bool UseFoxitStretchEngine(const CFX_RetainPtr& pSource, + bool UseFoxitStretchEngine(const RetainPtr& pSource, uint32_t color, int dest_left, int dest_top, @@ -233,13 +232,13 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { protected: int GetDeviceCaps(int caps_id) const override; - bool SetDIBits(const CFX_RetainPtr& pBitmap, + bool SetDIBits(const RetainPtr& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_RetainPtr& pBitmap, + bool StretchDIBits(const RetainPtr& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -248,7 +247,7 @@ class CGdiPrinterDriver : public CGdiDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const CFX_RetainPtr& pBitmap, + bool StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -292,13 +291,13 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver { int fill_mode, int blend_type) override; bool GetClipBox(FX_RECT* pRect) override; - bool SetDIBits(const CFX_RetainPtr& pBitmap, + bool SetDIBits(const RetainPtr& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_RetainPtr& pBitmap, + bool StretchDIBits(const RetainPtr& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -307,7 +306,7 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const CFX_RetainPtr& pBitmap, + bool StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -355,13 +354,13 @@ class CTextOnlyPrinterDriver : public IFX_RenderDeviceDriver { int fill_mode, int blend_type) override; bool GetClipBox(FX_RECT* pRect) override; - bool SetDIBits(const CFX_RetainPtr& pBitmap, + bool SetDIBits(const RetainPtr& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_RetainPtr& pBitmap, + bool StretchDIBits(const RetainPtr& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -370,7 +369,7 @@ class CTextOnlyPrinterDriver : public IFX_RenderDeviceDriver { const FX_RECT* pClipRect, uint32_t flags, int blend_type) override; - bool StartDIBits(const CFX_RetainPtr& pBitmap, + bool StartDIBits(const RetainPtr& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, -- cgit v1.2.3