From a5085d45e8288a7ed7af24fc9134d07cbc56e9dc Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 11 May 2017 16:26:50 -0400 Subject: Rename render device classes This Cl renames the CFX_RenderDevice subclasses to make their usage clearer. Change-Id: Ie820b57df9a3743ce8c6893fb483b398a1f1bdbe Reviewed-on: https://pdfium-review.googlesource.com/5390 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- core/fpdfapi/page/cpdf_path.h | 2 +- core/fpdfapi/render/cpdf_devicebuffer.cpp | 2 +- core/fpdfapi/render/cpdf_dibsource.h | 2 +- core/fpdfapi/render/cpdf_imagerenderer.cpp | 14 ++++---- core/fpdfapi/render/cpdf_imagerenderer.h | 6 ++-- core/fpdfapi/render/cpdf_rendercontext.cpp | 2 +- core/fpdfapi/render/cpdf_renderstatus.cpp | 16 ++++----- core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp | 4 +-- core/fpdfapi/render/cpdf_scaledrenderbuffer.h | 4 +-- core/fxge/agg/fx_agg_driver.cpp | 24 +++++++------- core/fxge/cfx_defaultrenderdevice.h | 43 +++++++++++++++++++++++++ core/fxge/cfx_fxgedevice.h | 43 ------------------------- core/fxge/cfx_windowsdevice.h | 40 ----------------------- core/fxge/cfx_windowsrenderdevice.h | 40 +++++++++++++++++++++++ core/fxge/ge/cfx_renderdevice.cpp | 4 +-- core/fxge/skia/fx_skia_device.cpp | 35 +++++++++++--------- core/fxge/skia/fx_skia_device_unittest.cpp | 6 ++-- core/fxge/win32/fx_win32_device.cpp | 8 ++--- core/fxge/win32/fx_win32_print.cpp | 2 +- 19 files changed, 151 insertions(+), 146 deletions(-) create mode 100644 core/fxge/cfx_defaultrenderdevice.h delete mode 100644 core/fxge/cfx_fxgedevice.h delete mode 100644 core/fxge/cfx_windowsdevice.h create mode 100644 core/fxge/cfx_windowsrenderdevice.h (limited to 'core') diff --git a/core/fpdfapi/page/cpdf_path.h b/core/fpdfapi/page/cpdf_path.h index 4bbb4b870e..f604abdfe2 100644 --- a/core/fpdfapi/page/cpdf_path.h +++ b/core/fpdfapi/page/cpdf_path.h @@ -11,7 +11,7 @@ #include "core/fxcrt/cfx_shared_copy_on_write.h" #include "core/fxcrt/fx_system.h" -#include "core/fxge/cfx_fxgedevice.h" +#include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" diff --git a/core/fpdfapi/render/cpdf_devicebuffer.cpp b/core/fpdfapi/render/cpdf_devicebuffer.cpp index 605e09bb5b..be87128a49 100644 --- a/core/fpdfapi/render/cpdf_devicebuffer.cpp +++ b/core/fpdfapi/render/cpdf_devicebuffer.cpp @@ -9,7 +9,7 @@ #include "core/fpdfapi/page/cpdf_pageobject.h" #include "core/fpdfapi/render/cpdf_rendercontext.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" -#include "core/fxge/cfx_fxgedevice.h" +#include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/fx_dib.h" #include "third_party/base/ptr_util.h" diff --git a/core/fpdfapi/render/cpdf_dibsource.h b/core/fpdfapi/render/cpdf_dibsource.h index 00f8c3a2f5..d0730cc4fd 100644 --- a/core/fpdfapi/render/cpdf_dibsource.h +++ b/core/fpdfapi/render/cpdf_dibsource.h @@ -18,7 +18,7 @@ #include "core/fpdfapi/render/cpdf_imageloader.h" #include "core/fpdfapi/render/cpdf_rendercontext.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" -#include "core/fxge/cfx_fxgedevice.h" +#include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_renderdevice.h" class CCodec_Jbig2Context; diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index dd1044816a..28548121b9 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -27,7 +27,7 @@ #include "core/fpdfdoc/cpdf_occontext.h" #include "core/fxcrt/cfx_maybe_owned.h" #include "core/fxcrt/fx_safe_types.h" -#include "core/fxge/cfx_fxgedevice.h" +#include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/dib/cfx_dibitmap.h" #include "core/fxge/dib/cfx_dibsource.h" @@ -222,8 +222,8 @@ CFX_Matrix CPDF_ImageRenderer::GetDrawMatrix(const FX_RECT& rect) const { } void CPDF_ImageRenderer::CalculateDrawImage( - CFX_FxgeDevice* pBitmapDevice1, - CFX_FxgeDevice* pBitmapDevice2, + CFX_DefaultRenderDevice* pBitmapDevice1, + CFX_DefaultRenderDevice* pBitmapDevice2, const CFX_RetainPtr& pDIBSource, CFX_Matrix* pNewMatrix, const FX_RECT& rect) const { @@ -273,7 +273,7 @@ bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { return false; CFX_Matrix new_matrix = GetDrawMatrix(rect); - CFX_FxgeDevice bitmap_device1; + CFX_DefaultRenderDevice bitmap_device1; if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32, nullptr)) return true; @@ -294,7 +294,7 @@ bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { &patternDevice, false); } - CFX_FxgeDevice bitmap_device2; + CFX_DefaultRenderDevice bitmap_device2; if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb, nullptr)) { return true; @@ -321,7 +321,7 @@ bool CPDF_ImageRenderer::DrawMaskedImage() { return false; CFX_Matrix new_matrix = GetDrawMatrix(rect); - CFX_FxgeDevice bitmap_device1; + CFX_DefaultRenderDevice bitmap_device1; if (!bitmap_device1.Create(rect.Width(), rect.Height(), FXDIB_Rgb32, nullptr)) return true; @@ -339,7 +339,7 @@ bool CPDF_ImageRenderer::DrawMaskedImage() { m_Flags, true, FXDIB_BLEND_NORMAL)) { image_render.Continue(nullptr); } - CFX_FxgeDevice bitmap_device2; + CFX_DefaultRenderDevice bitmap_device2; if (!bitmap_device2.Create(rect.Width(), rect.Height(), FXDIB_8bppRgb, nullptr)) return true; diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h index 30cbf38dda..4468b470d9 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.h +++ b/core/fpdfapi/render/cpdf_imagerenderer.h @@ -15,7 +15,7 @@ class CFX_DIBitmap; class CFX_DIBSource; -class CFX_FxgeDevice; +class CFX_DefaultRenderDevice; class CFX_ImageTransformer; class CPDF_ImageObject; class CPDF_PageObject; @@ -55,8 +55,8 @@ class CPDF_ImageRenderer { bool NotDrawing() const; FX_RECT GetDrawRect() const; CFX_Matrix GetDrawMatrix(const FX_RECT& rect) const; - void CalculateDrawImage(CFX_FxgeDevice* bitmap_device1, - CFX_FxgeDevice* bitmap_device2, + void CalculateDrawImage(CFX_DefaultRenderDevice* bitmap_device1, + CFX_DefaultRenderDevice* bitmap_device2, const CFX_RetainPtr& pDIBSource, CFX_Matrix* pNewMatrix, const FX_RECT& rect) const; diff --git a/core/fpdfapi/render/cpdf_rendercontext.cpp b/core/fpdfapi/render/cpdf_rendercontext.cpp index e4ef9af94d..c8626af9ff 100644 --- a/core/fpdfapi/render/cpdf_rendercontext.cpp +++ b/core/fpdfapi/render/cpdf_rendercontext.cpp @@ -35,7 +35,7 @@ void CPDF_RenderContext::GetBackground( const CPDF_PageObject* pObj, const CPDF_RenderOptions* pOptions, CFX_Matrix* pFinalMatrix) { - CFX_FxgeDevice device; + CFX_DefaultRenderDevice device; device.Attach(pBuffer, false, nullptr, false); FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight()); diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 44af9a2bac..d485d1dede 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -48,7 +48,7 @@ #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/cfx_maybe_owned.h" #include "core/fxcrt/fx_safe_types.h" -#include "core/fxge/cfx_fxgedevice.h" +#include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" @@ -819,7 +819,7 @@ void DrawCoonPatchMeshes( ASSERT(type == kCoonsPatchMeshShading || type == kTensorProductPatchMeshShading); - CFX_FxgeDevice device; + CFX_DefaultRenderDevice device; device.Attach(pBitmap, false, nullptr, false); CPDF_MeshStream stream(type, funcs, pShadingStream, pCS); if (!stream.Load()) @@ -904,7 +904,7 @@ CFX_RetainPtr DrawPatternBitmap(CPDF_Document* pDoc, pPattern->colored() ? FXDIB_Argb : FXDIB_8bppMask)) { return nullptr; } - CFX_FxgeDevice bitmap_device; + CFX_DefaultRenderDevice bitmap_device; bitmap_device.Attach(pBitmap, false, nullptr, false); pBitmap->Clear(0); CFX_FloatRect cell_bbox = pPattern->bbox(); @@ -1538,7 +1538,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, float scaleY = fabs(deviceCTM.d); int width = FXSYS_round((float)rect.Width() * scaleX); int height = FXSYS_round((float)rect.Height() * scaleY); - CFX_FxgeDevice bitmap_device; + CFX_DefaultRenderDevice bitmap_device; CFX_RetainPtr oriDevice; if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { oriDevice = pdfium::MakeRetain(); @@ -1563,7 +1563,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj, return true; pTextMask->Clear(0); - CFX_FxgeDevice text_device; + CFX_DefaultRenderDevice text_device; text_device.Attach(pTextMask, false, nullptr, false); for (uint32_t i = 0; i < pPageObj->m_ClipPath.GetTextCount(); i++) { CPDF_TextObject* textobj = pPageObj->m_ClipPath.GetText(i); @@ -1659,7 +1659,7 @@ CFX_RetainPtr CPDF_RenderStatus::GetBackdrop( FinalMatrix.Scale(scaleX, scaleY); pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff); - CFX_FxgeDevice device; + CFX_DefaultRenderDevice device; device.Attach(pBackdrop, false, nullptr, false); m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix); return pBackdrop; @@ -1885,7 +1885,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, matrix.TransformRect(rect_f); FX_RECT rect = rect_f.GetOuterRect(); - CFX_FxgeDevice bitmap_device; + CFX_DefaultRenderDevice bitmap_device; if (!bitmap_device.Create((int)(rect.Width() * sa), (int)(rect.Height() * sd), FXDIB_Argb, nullptr)) { @@ -2537,7 +2537,7 @@ CFX_RetainPtr CPDF_RenderStatus::LoadSMask( pGroup); form.ParseContent(nullptr, nullptr, nullptr); - CFX_FxgeDevice bitmap_device; + CFX_DefaultRenderDevice bitmap_device; bool bLuminosity = pSMaskDict->GetStringFor("S") != "Alpha"; int width = pClipRect->right - pClipRect->left; int height = pClipRect->bottom - pClipRect->top; diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp index 927d23210c..74d506c05c 100644 --- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp +++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/render/cpdf_rendercontext.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" -#include "core/fxge/cfx_fxgedevice.h" +#include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_renderdevice.h" #include "third_party/base/ptr_util.h" @@ -44,7 +44,7 @@ bool CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, if (dpiv > max_dpi) m_Matrix.Scale(1.0f, (float)(max_dpi) / (float)dpiv); } - m_pBitmapDevice = pdfium::MakeUnique(); + m_pBitmapDevice = pdfium::MakeUnique(); FXDIB_Format dibFormat = FXDIB_Rgb; int32_t bpp = 24; if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT) { diff --git a/core/fpdfapi/render/cpdf_scaledrenderbuffer.h b/core/fpdfapi/render/cpdf_scaledrenderbuffer.h index f802349dcb..92fabefbee 100644 --- a/core/fpdfapi/render/cpdf_scaledrenderbuffer.h +++ b/core/fpdfapi/render/cpdf_scaledrenderbuffer.h @@ -10,7 +10,7 @@ #include #include "core/fxcrt/fx_coordinates.h" -#include "core/fxge/cfx_fxgedevice.h" +#include "core/fxge/cfx_defaultrenderdevice.h" class CFX_RenderDevice; class CPDF_PageObject; @@ -39,7 +39,7 @@ class CPDF_ScaledRenderBuffer { CPDF_RenderContext* m_pContext; FX_RECT m_Rect; const CPDF_PageObject* m_pObject; - std::unique_ptr m_pBitmapDevice; + std::unique_ptr m_pBitmapDevice; CFX_Matrix m_Matrix; }; diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index 128d50c6e6..08a6e09324 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -10,7 +10,7 @@ #include #include "core/fxcodec/fx_codec.h" -#include "core/fxge/cfx_fxgedevice.h" +#include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_gemodule.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" @@ -1561,14 +1561,15 @@ bool CFX_AggDeviceDriver::ContinueDIBits(CFX_ImageRenderer* pHandle, } #ifndef _SKIA_SUPPORT_ -CFX_FxgeDevice::CFX_FxgeDevice() {} +CFX_DefaultRenderDevice::CFX_DefaultRenderDevice() {} -CFX_FxgeDevice::~CFX_FxgeDevice() {} +CFX_DefaultRenderDevice::~CFX_DefaultRenderDevice() {} -bool CFX_FxgeDevice::Attach(const CFX_RetainPtr& pBitmap, - bool bRgbByteOrder, - const CFX_RetainPtr& pOriDevice, - bool bGroupKnockout) { +bool CFX_DefaultRenderDevice::Attach( + const CFX_RetainPtr& pBitmap, + bool bRgbByteOrder, + const CFX_RetainPtr& pOriDevice, + bool bGroupKnockout) { if (!pBitmap) return false; @@ -1578,10 +1579,11 @@ bool CFX_FxgeDevice::Attach(const CFX_RetainPtr& pBitmap, return true; } -bool CFX_FxgeDevice::Create(int width, - int height, - FXDIB_Format format, - const CFX_RetainPtr& pOriDevice) { +bool CFX_DefaultRenderDevice::Create( + int width, + int height, + FXDIB_Format format, + const CFX_RetainPtr& pOriDevice) { auto pBitmap = pdfium::MakeRetain(); if (!pBitmap->Create(width, height, format)) return false; diff --git a/core/fxge/cfx_defaultrenderdevice.h b/core/fxge/cfx_defaultrenderdevice.h new file mode 100644 index 0000000000..e2dc1f3859 --- /dev/null +++ b/core/fxge/cfx_defaultrenderdevice.h @@ -0,0 +1,43 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FXGE_CFX_DEFAULTRENDERDEVICE_H_ +#define CORE_FXGE_CFX_DEFAULTRENDERDEVICE_H_ + +#include "core/fxge/cfx_renderdevice.h" +#include "core/fxge/fx_dib.h" + +class SkPictureRecorder; + +class CFX_DefaultRenderDevice : public CFX_RenderDevice { + public: + CFX_DefaultRenderDevice(); + ~CFX_DefaultRenderDevice() override; + + bool Attach(const CFX_RetainPtr& pBitmap, + bool bRgbByteOrder, + const CFX_RetainPtr& pOriDevice, + bool bGroupKnockout); + bool Create(int width, + int height, + FXDIB_Format format, + const CFX_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, + int left, + int top, + int bitmap_alpha, + int blend_type) override; +#endif +}; + +#endif // CORE_FXGE_CFX_DEFAULTRENDERDEVICE_H_ diff --git a/core/fxge/cfx_fxgedevice.h b/core/fxge/cfx_fxgedevice.h deleted file mode 100644 index 4e8a7f4f55..0000000000 --- a/core/fxge/cfx_fxgedevice.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FXGE_CFX_FXGEDEVICE_H_ -#define CORE_FXGE_CFX_FXGEDEVICE_H_ - -#include "core/fxge/cfx_renderdevice.h" -#include "core/fxge/fx_dib.h" - -class SkPictureRecorder; - -class CFX_FxgeDevice : public CFX_RenderDevice { - public: - CFX_FxgeDevice(); - ~CFX_FxgeDevice() override; - - bool Attach(const CFX_RetainPtr& pBitmap, - bool bRgbByteOrder, - const CFX_RetainPtr& pOriDevice, - bool bGroupKnockout); - bool Create(int width, - int height, - FXDIB_Format format, - const CFX_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, - int left, - int top, - int bitmap_alpha, - int blend_type) override; -#endif -}; - -#endif // CORE_FXGE_CFX_FXGEDEVICE_H_ diff --git a/core/fxge/cfx_windowsdevice.h b/core/fxge/cfx_windowsdevice.h deleted file mode 100644 index 2d17cb7dd8..0000000000 --- a/core/fxge/cfx_windowsdevice.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef CORE_FXGE_CFX_WINDOWSDEVICE_H_ -#define CORE_FXGE_CFX_WINDOWSDEVICE_H_ - -#ifdef _WIN32 -#ifndef _WINDOWS_ -#include -#endif - -#include "core/fxge/cfx_renderdevice.h" - -class IFX_RenderDeviceDriver; - -#if defined(PDFIUM_PRINT_TEXT_WITH_GDI) -typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, - const wchar_t* text, - size_t text_length); - -extern bool g_pdfium_print_text_with_gdi; -extern PDFiumEnsureTypefaceCharactersAccessible - g_pdfium_typeface_accessible_func; -#endif -extern int g_pdfium_print_postscript_level; - -class CFX_WindowsDevice : public CFX_RenderDevice { - public: - static IFX_RenderDeviceDriver* CreateDriver(HDC hDC); - - explicit CFX_WindowsDevice(HDC hDC); - ~CFX_WindowsDevice() override; -}; - -#endif // _WIN32 - -#endif // CORE_FXGE_CFX_WINDOWSDEVICE_H_ diff --git a/core/fxge/cfx_windowsrenderdevice.h b/core/fxge/cfx_windowsrenderdevice.h new file mode 100644 index 0000000000..7156dcdc4e --- /dev/null +++ b/core/fxge/cfx_windowsrenderdevice.h @@ -0,0 +1,40 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FXGE_CFX_WINDOWSRENDERDEVICE_H_ +#define CORE_FXGE_CFX_WINDOWSRENDERDEVICE_H_ + +#ifdef _WIN32 +#ifndef _WINDOWS_ +#include +#endif + +#include "core/fxge/cfx_renderdevice.h" + +class IFX_RenderDeviceDriver; + +#if defined(PDFIUM_PRINT_TEXT_WITH_GDI) +typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, + const wchar_t* text, + size_t text_length); + +extern bool g_pdfium_print_text_with_gdi; +extern PDFiumEnsureTypefaceCharactersAccessible + g_pdfium_typeface_accessible_func; +#endif +extern int g_pdfium_print_postscript_level; + +class CFX_WindowsRenderDevice : public CFX_RenderDevice { + public: + static IFX_RenderDeviceDriver* CreateDriver(HDC hDC); + + explicit CFX_WindowsRenderDevice(HDC hDC); + ~CFX_WindowsRenderDevice() override; +}; + +#endif // _WIN32 + +#endif // CORE_FXGE_CFX_WINDOWSRENDERDEVICE_H_ diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index 6a3f9c7f1c..d2924bb13c 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -12,8 +12,8 @@ #include #include "core/fxcrt/fx_safe_types.h" +#include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_facecache.h" -#include "core/fxge/cfx_fxgedevice.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/dib/cfx_imagerenderer.h" @@ -626,7 +626,7 @@ bool CFX_RenderDevice::DrawFillStrokePath(const CFX_PathData* pPathData, return false; Backdrop->Copy(bitmap); } - CFX_FxgeDevice bitmap_device; + CFX_DefaultRenderDevice bitmap_device; bitmap_device.Attach(bitmap, false, Backdrop, true); CFX_Matrix matrix; diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 3ca022b706..e4d580d089 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -14,7 +14,7 @@ #include "core/fpdfapi/parser/cpdf_stream_acc.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/fx_memory.h" -#include "core/fxge/cfx_fxgedevice.h" +#include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_gemodule.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" @@ -2331,26 +2331,28 @@ void CFX_SkiaDeviceDriver::DebugVerifyBitmapIsPreMultiplied() const { } #endif // _SKIA_SUPPORT_ -CFX_FxgeDevice::CFX_FxgeDevice() {} +CFX_DefaultRenderDevice::CFX_DefaultRenderDevice() {} #ifdef _SKIA_SUPPORT_ -void CFX_FxgeDevice::Clear(uint32_t color) { +void CFX_DefaultRenderDevice::Clear(uint32_t color) { CFX_SkiaDeviceDriver* skDriver = static_cast(GetDeviceDriver()); skDriver->Clear(color); } -SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) { +SkPictureRecorder* CFX_DefaultRenderDevice::CreateRecorder(int size_x, + int size_y) { CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y); SetDeviceDriver(pdfium::WrapUnique(skDriver)); return skDriver->GetRecorder(); } #endif // _SKIA_SUPPORT_ -bool CFX_FxgeDevice::Attach(const CFX_RetainPtr& pBitmap, - bool bRgbByteOrder, - const CFX_RetainPtr& pOriDevice, - bool bGroupKnockout) { +bool CFX_DefaultRenderDevice::Attach( + const CFX_RetainPtr& pBitmap, + bool bRgbByteOrder, + const CFX_RetainPtr& pOriDevice, + bool bGroupKnockout) { if (!pBitmap) return false; SetBitmap(pBitmap); @@ -2360,7 +2362,7 @@ bool CFX_FxgeDevice::Attach(const CFX_RetainPtr& pBitmap, } #ifdef _SKIA_SUPPORT_ -bool CFX_FxgeDevice::AttachRecorder(SkPictureRecorder* recorder) { +bool CFX_DefaultRenderDevice::AttachRecorder(SkPictureRecorder* recorder) { if (!recorder) return false; SetDeviceDriver(pdfium::MakeUnique(recorder)); @@ -2368,10 +2370,11 @@ bool CFX_FxgeDevice::AttachRecorder(SkPictureRecorder* recorder) { } #endif // _SKIA_SUPPORT_ -bool CFX_FxgeDevice::Create(int width, - int height, - FXDIB_Format format, - const CFX_RetainPtr& pOriDevice) { +bool CFX_DefaultRenderDevice::Create( + int width, + int height, + FXDIB_Format format, + const CFX_RetainPtr& pOriDevice) { auto pBitmap = pdfium::MakeRetain(); if (!pBitmap->Create(width, height, format)) { return false; @@ -2382,12 +2385,12 @@ bool CFX_FxgeDevice::Create(int width, return true; } -CFX_FxgeDevice::~CFX_FxgeDevice() { +CFX_DefaultRenderDevice::~CFX_DefaultRenderDevice() { Flush(); } #ifdef _SKIA_SUPPORT_ -void CFX_FxgeDevice::DebugVerifyBitmapIsPreMultiplied() const { +void CFX_DefaultRenderDevice::DebugVerifyBitmapIsPreMultiplied() const { #ifdef SK_DEBUG CFX_SkiaDeviceDriver* skDriver = static_cast(GetDeviceDriver()); @@ -2396,7 +2399,7 @@ void CFX_FxgeDevice::DebugVerifyBitmapIsPreMultiplied() const { #endif // SK_DEBUG } -bool CFX_FxgeDevice::SetBitsWithMask( +bool CFX_DefaultRenderDevice::SetBitsWithMask( const CFX_RetainPtr& pBitmap, const CFX_RetainPtr& pMask, int left, diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp index a47a50c836..99b76d2109 100644 --- a/core/fxge/skia/fx_skia_device_unittest.cpp +++ b/core/fxge/skia/fx_skia_device_unittest.cpp @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/fxge/cfx_fxgedevice.h" +#include "core/fxge/skia/fx_skia_device.h" +#include "core/fxge/cfx_defaultrenderdevice.h" #include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" -#include "core/fxge/skia/fx_skia_device.h" #include "fpdfsdk/fsdk_define.h" #include "public/fpdfview.h" #include "testing/fx_string_testhelpers.h" @@ -124,7 +124,7 @@ void Harness(void (*Test)(CFX_SkiaDeviceDriver*, const State&), if (!bitmap) return; FPDFBitmap_FillRect(bitmap, 0, 0, w, h, 0x00000000); - CFX_FxgeDevice geDevice; + CFX_DefaultRenderDevice geDevice; CFX_RetainPtr pBitmap(CFXBitmapFromFPDFBitmap(bitmap)); geDevice.Attach(pBitmap, false, nullptr, false); CFX_SkiaDeviceDriver* driver = diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 43d53e1bb0..2747339b1d 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -15,7 +15,7 @@ #include "core/fxcrt/fx_codepage.h" #include "core/fxcrt/fx_memory.h" #include "core/fxcrt/fx_system.h" -#include "core/fxge/cfx_windowsdevice.h" +#include "core/fxge/cfx_windowsrenderdevice.h" #include "core/fxge/dib/cfx_dibextractor.h" #include "core/fxge/dib/cfx_imagerenderer.h" #include "core/fxge/dib/cstretchengine.h" @@ -1358,14 +1358,14 @@ bool CGdiDisplayDriver::StartDIBits(const CFX_RetainPtr& pBitmap, return false; } -CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC) { +CFX_WindowsRenderDevice::CFX_WindowsRenderDevice(HDC hDC) { SetDeviceDriver(pdfium::WrapUnique(CreateDriver(hDC))); } -CFX_WindowsDevice::~CFX_WindowsDevice() {} +CFX_WindowsRenderDevice::~CFX_WindowsRenderDevice() {} // static -IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC) { +IFX_RenderDeviceDriver* CFX_WindowsRenderDevice::CreateDriver(HDC hDC) { int device_type = ::GetDeviceCaps(hDC, TECHNOLOGY); int obj_type = ::GetObjectType(hDC); bool use_printer = device_type == DT_RASPRINTER || diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp index f060c04127..e036a8c97d 100644 --- a/core/fxge/win32/fx_win32_print.cpp +++ b/core/fxge/win32/fx_win32_print.cpp @@ -11,7 +11,7 @@ #include #include "core/fxcrt/fx_system.h" -#include "core/fxge/cfx_windowsdevice.h" +#include "core/fxge/cfx_windowsrenderdevice.h" #include "core/fxge/dib/cfx_dibextractor.h" #include "core/fxge/dib/cfx_imagerenderer.h" #include "core/fxge/dib/cstretchengine.h" -- cgit v1.2.3