diff options
Diffstat (limited to 'core/fxge/win32')
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.cpp | 10 | ||||
-rw-r--r-- | core/fxge/win32/cfx_psrenderer.h | 12 | ||||
-rw-r--r-- | core/fxge/win32/cfx_windowsdib.h | 15 | ||||
-rw-r--r-- | core/fxge/win32/dwrite_int.h | 2 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_device.cpp | 60 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_dib.cpp | 22 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_dwrite.cpp | 11 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_gdipext.cpp | 28 | ||||
-rw-r--r-- | core/fxge/win32/fx_win32_print.cpp | 75 | ||||
-rw-r--r-- | core/fxge/win32/win32_int.h | 45 |
10 files changed, 135 insertions, 145 deletions
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<IFX_WriteStream>& pStream, +void CFX_PSRenderer::Init(const RetainPtr<IFX_WriteStream>& 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<CFX_DIBSource>& pSource, +bool CFX_PSRenderer::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource, uint32_t color, int left, int top) { @@ -353,7 +353,7 @@ bool CFX_PSRenderer::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, return DrawDIBits(pSource, color, &matrix, 0); } -bool CFX_PSRenderer::StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, +bool CFX_PSRenderer::StretchDIBits(const RetainPtr<CFX_DIBSource>& pSource, uint32_t color, int dest_left, int dest_top, @@ -366,7 +366,7 @@ bool CFX_PSRenderer::StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, return DrawDIBits(pSource, color, &matrix, flags); } -bool CFX_PSRenderer::DrawDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, +bool CFX_PSRenderer::DrawDIBits(const RetainPtr<CFX_DIBSource>& pSource, uint32_t color, const CFX_Matrix* pMatrix, uint32_t flags) { @@ -428,7 +428,7 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, output_buf.release(); } else { CFX_DIBExtractor source_extractor(pSource); - CFX_RetainPtr<CFX_DIBSource> pConverted = source_extractor.GetBitmap(); + RetainPtr<CFX_DIBSource> 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 <memory> #include <vector> -#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<IFX_WriteStream>& stream, + void Init(const RetainPtr<IFX_WriteStream>& 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<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, int dest_left, int dest_top); - bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, uint32_t flags); - bool DrawDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + bool DrawDIBits(const RetainPtr<CFX_DIBSource>& 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<IFX_WriteStream> m_pStream; + RetainPtr<IFX_WriteStream> 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 <typename T, typename... Args> - friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args); + friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); ~CFX_WindowsDIB() override; - static ByteString GetBitmapInfo(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap); - static HBITMAP GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, - HDC hDC); + static ByteString GetBitmapInfo(const RetainPtr<CFX_DIBitmap>& pBitmap); + static HBITMAP GetDDBitmap(const RetainPtr<CFX_DIBitmap>& pBitmap, HDC hDC); - static CFX_RetainPtr<CFX_DIBitmap> LoadFromBuf(BITMAPINFO* pbmi, void* pData); - static CFX_RetainPtr<CFX_DIBitmap> LoadFromFile(const wchar_t* filename); - static CFX_RetainPtr<CFX_DIBitmap> LoadFromFile(const char* filename); - static CFX_RetainPtr<CFX_DIBitmap> LoadDIBitmap(WINDIB_Open_Args_ args); + static RetainPtr<CFX_DIBitmap> LoadFromBuf(BITMAPINFO* pbmi, void* pData); + static RetainPtr<CFX_DIBitmap> LoadFromFile(const wchar_t* filename); + static RetainPtr<CFX_DIBitmap> LoadFromFile(const char* filename); + static RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap>& pSrc, + bool DwCreateRenderingTarget(const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap>& pBitmap1, - const FX_RECT* pSrcRect, - int left, - int top) { +bool CGdiDeviceDriver::GDI_SetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap1, + const FX_RECT* pSrcRect, + int left, + int top) { if (m_DeviceClass == FXDC_PRINTER) { - CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1->FlipImage(false, true); + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap> pBitmap = pBitmap1; + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap>& pBitmap1, + const RetainPtr<CFX_DIBitmap>& pBitmap1, int dest_left, int dest_top, int dest_width, int dest_height, uint32_t flags) { - CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1; + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap> pToStrechBitmap = pBitmap; + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap>& pBitmap1, + const RetainPtr<CFX_DIBitmap>& pBitmap1, int dest_left, int dest_top, int dest_width, int dest_height, uint32_t bitmap_color, uint32_t flags) { - CFX_RetainPtr<CFX_DIBitmap> pBitmap = pBitmap1; + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap>& pBitmap, +bool CGdiDisplayDriver::GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap, int left, int top) { bool ret = false; @@ -1201,7 +1200,7 @@ bool CGdiDisplayDriver::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, return ret; } -bool CGdiDisplayDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, +bool CGdiDisplayDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource, uint32_t color, const FX_RECT* pSrcRect, int left, @@ -1242,14 +1241,14 @@ bool CGdiDisplayDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, return SetDIBits(bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL); } CFX_DIBExtractor temp(pSource); - CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap(); + RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap(); if (!pBitmap) return false; return GDI_SetDIBits(pBitmap, pSrcRect, left, top); } bool CGdiDisplayDriver::UseFoxitStretchEngine( - const CFX_RetainPtr<CFX_DIBSource>& pSource, + const RetainPtr<CFX_DIBSource>& 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<CFX_DIBitmap> pStretched = + RetainPtr<CFX_DIBitmap> 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<CFX_DIBSource>& 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<CFX_DIBSource>& 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<CFX_DIBitmap> pStretched( + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap> pBitmap = temp.GetBitmap(); + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap> pBitmap = temp.GetBitmap(); + RetainPtr<CFX_DIBitmap> 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<CFX_DIBSource>& pBitmap, +bool CGdiDisplayDriver::StartDIBits(const RetainPtr<CFX_DIBSource>& 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<CFX_DIBitmap>& pBitmap) { + const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, - LPVOID pData, - bool bAlpha) { +RetainPtr<CFX_DIBitmap> _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<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, return pBitmap; } -CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi, - LPVOID pData) { +RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi, + LPVOID pData) { return _FX_WindowsDIB_LoadFromBuf(pbmi, pData, false); } -HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, +HBITMAP CFX_WindowsDIB::GetDDBitmap(const RetainPtr<CFX_DIBitmap>& 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_DIBitmap> CFX_WindowsDIB::LoadFromFile( - const wchar_t* filename) { +RetainPtr<CFX_DIBitmap> 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_DIBitmap> CFX_WindowsDIB::LoadFromFile( return pDIBitmap; } -CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(const char* filename) { +RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadFromFile(const char* filename) { return LoadFromFile(WideString::FromLocal(filename).c_str()); } -CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadDIBitmap( - WINDIB_Open_Args_ args) { +RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap>& pBitmap, + CDwGdiTextRenderer(const RetainPtr<CFX_DIBitmap>& pBitmap, IDWriteBitmapRenderTarget* bitmapRenderTarget, IDWriteRenderingParams* renderingParams); ~CDwGdiTextRenderer(); @@ -118,7 +118,7 @@ class CDwGdiTextRenderer { const COLORREF& textColor); private: - CFX_RetainPtr<CFX_DIBitmap> pBitmap_; + RetainPtr<CFX_DIBitmap> pBitmap_; IDWriteBitmapRenderTarget* pRenderTarget_; IDWriteRenderingParams* pRenderingParams_; }; @@ -180,9 +180,8 @@ failed: return nullptr; } -bool CDWriteExt::DwCreateRenderingTarget( - const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, - void** renderTarget) { +bool CDWriteExt::DwCreateRenderingTarget(const RetainPtr<CFX_DIBitmap>& pBitmap, + void** renderTarget) { if (pBitmap->GetFormat() > FXDIB_Argb) { return false; } @@ -396,7 +395,7 @@ HRESULT CDwFontContext::Initialize() { } CDwGdiTextRenderer::CDwGdiTextRenderer( - const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, + const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap> StretchMonoToGray( +static RetainPtr<CFX_DIBitmap> StretchMonoToGray( int dest_width, int dest_height, - const CFX_RetainPtr<CFX_DIBitmap>& pSource, + const RetainPtr<CFX_DIBitmap>& pSource, FX_RECT* pClipRect) { bool bFlipX = dest_width < 0; if (bFlipX) @@ -519,7 +519,7 @@ static CFX_RetainPtr<CFX_DIBitmap> StretchMonoToGray( static void OutputImageMask(GpGraphics* pGraphics, BOOL bMonoDevice, - const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, + const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap> pStretched; + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap>& pBitmap, + const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap> pCloned = pBitmap->Clone(pSrcRect); + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap>& pBitmap, +bool CGdiplusExt::GdipCreateBitmap(const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap>& pBitmap, + const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap>& pBitmap, + const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, - LPVOID pData, - bool bAlpha); +RetainPtr<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, + LPVOID pData, + bool bAlpha); -CFX_RetainPtr<CFX_DIBitmap> CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) { +RetainPtr<CFX_DIBitmap> CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) { PREVIEW3_DIBITMAP* pInfo = ::LoadDIBitmap(args); if (!pInfo) return nullptr; @@ -1484,7 +1484,7 @@ CFX_RetainPtr<CFX_DIBitmap> CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) { dest_pitch); } } - CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = _FX_WindowsDIB_LoadFromBuf( + RetainPtr<CFX_DIBitmap> 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<CFX_DIBSource>& pSource, +bool CGdiPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pSource, uint32_t color, const FX_RECT* pSrcRect, int left, @@ -89,30 +89,29 @@ bool CGdiPrinterDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, return false; CFX_DIBExtractor temp(pSource); - CFX_RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap(); + RetainPtr<CFX_DIBitmap> pBitmap = temp.GetBitmap(); if (!pBitmap) return false; return GDI_SetDIBits(pBitmap, pSrcRect, left, top); } -bool CGdiPrinterDriver::StretchDIBits( - const CFX_RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& 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<CFX_DIBitmap> pFlipped = + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap> pBitmap = temp.GetBitmap(); + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap> pFlipped = + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap> pBitmap = temp.GetBitmap(); + RetainPtr<CFX_DIBitmap> 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<CFX_DIBSource>& pSource, +bool CGdiPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBSource>& pSource, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, @@ -187,7 +186,7 @@ bool CGdiPrinterDriver::StartDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, if (fabs(pMatrix->a) >= 0.5f || fabs(pMatrix->d) >= 0.5f) return false; - CFX_RetainPtr<CFX_DIBitmap> pTransformed = + RetainPtr<CFX_DIBitmap> 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<CFX_DIBSource>& pBitmap, +bool CPSPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, @@ -451,23 +450,22 @@ bool CPSPrinterDriver::SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, return m_PSRenderer.SetDIBits(pBitmap, color, left, top); } -bool CPSPrinterDriver::StretchDIBits( - const CFX_RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& 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<CFX_DIBSource>& pBitmap, +bool CPSPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& pBitmap, - uint32_t color, - const FX_RECT* pSrcRect, - int left, - int top, - int blend_type) { +bool CTextOnlyPrinterDriver::SetDIBits(const RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& pBitmap, + const RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, int dest_left, int dest_top, @@ -584,7 +581,7 @@ bool CTextOnlyPrinterDriver::StretchDIBits( } bool CTextOnlyPrinterDriver::StartDIBits( - const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + const RetainPtr<CFX_DIBSource>& 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 <memory> -#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<CFX_DIBitmap>& pBitmap, + const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap>& pBitmap, + const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap>& pBitmap, - void** bitmap); + bool GdipCreateBitmap(const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap> LoadDIBitmap(WINDIB_Open_Args_ args); + RetainPtr<CFX_DIBitmap> 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<CFX_DIBitmap>& pBitmap, + bool GDI_SetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap, const FX_RECT* pSrcRect, int left, int top); - bool GDI_StretchDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, + bool GDI_StretchDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap, int dest_left, int dest_top, int dest_width, int dest_height, uint32_t flags); - bool GDI_StretchBitMask(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, + bool GDI_StretchBitMask(const RetainPtr<CFX_DIBitmap>& 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<CFX_DIBitmap>& pBitmap, + bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap, int left, int top) override; - bool SetDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, uint32_t render_flags, std::unique_ptr<CFX_ImageRenderer>* handle, int blend_type) override; - bool UseFoxitStretchEngine(const CFX_RetainPtr<CFX_DIBSource>& pSource, + bool UseFoxitStretchEngine(const RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& pBitmap, + bool SetDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, uint32_t color, const FX_RECT* pSrcRect, int left, int top, int blend_type) override; - bool StretchDIBits(const CFX_RetainPtr<CFX_DIBSource>& pBitmap, + bool StretchDIBits(const RetainPtr<CFX_DIBSource>& 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<CFX_DIBSource>& pBitmap, + bool StartDIBits(const RetainPtr<CFX_DIBSource>& pBitmap, int bitmap_alpha, uint32_t color, const CFX_Matrix* pMatrix, |