summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp2
-rw-r--r--core/fxge/include/fx_ge.h28
-rw-r--r--core/fxge/skia/fx_skia_device.cpp40
-rw-r--r--fpdfsdk/fpdf_progressive.cpp9
-rw-r--r--fpdfsdk/fpdfformfill.cpp4
-rw-r--r--fpdfsdk/fpdfview.cpp21
6 files changed, 28 insertions, 76 deletions
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index ff254f0200..98bce9b7c6 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -1794,6 +1794,7 @@ void CFX_AggDeviceDriver::CancelDIBits(void* pHandle) {
delete (CFX_ImageRenderer*)pHandle;
}
+#ifndef _SKIA_SUPPORT_
CFX_FxgeDevice::CFX_FxgeDevice() {
m_bOwnedBitmap = FALSE;
}
@@ -1836,3 +1837,4 @@ CFX_FxgeDevice::~CFX_FxgeDevice() {
delete GetBitmap();
}
}
+#endif
diff --git a/core/fxge/include/fx_ge.h b/core/fxge/include/fx_ge.h
index 9818d185ee..3c25e8ddd4 100644
--- a/core/fxge/include/fx_ge.h
+++ b/core/fxge/include/fx_ge.h
@@ -434,33 +434,13 @@ class CFX_FxgeDevice : public CFX_RenderDevice {
int dither_bits = 0,
CFX_DIBitmap* pOriDevice = NULL);
- protected:
- bool m_bOwnedBitmap;
-};
-
-class CFX_SkiaDevice : public CFX_RenderDevice {
- public:
- CFX_SkiaDevice();
- ~CFX_SkiaDevice() override;
-
- FX_BOOL Attach(CFX_DIBitmap* pBitmap,
- int dither_bits = 0,
- FX_BOOL bRgbByteOrder = FALSE,
- CFX_DIBitmap* pOriDevice = NULL,
- FX_BOOL bGroupKnockout = FALSE);
-
- FX_BOOL AttachRecorder(SkPictureRecorder* recorder);
-
- FX_BOOL Create(int width,
- int height,
- FXDIB_Format format,
- int dither_bits = 0,
- CFX_DIBitmap* pOriDevice = NULL);
-
+#ifdef _SKIA_SUPPORT_
+ bool AttachRecorder(SkPictureRecorder* recorder);
SkPictureRecorder* CreateRecorder(int size_x, int size_y);
+#endif
protected:
- FX_BOOL m_bOwnedBitmap;
+ bool m_bOwnedBitmap;
};
class IFX_RenderDeviceDriver {
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 4180d58e21..7f47d855c9 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1139,55 +1139,55 @@ void CFX_SkiaDeviceDriver::CancelDIBits(void* pHandle) {
delete (CFX_ImageRenderer*)pHandle;
}
-CFX_SkiaDevice::CFX_SkiaDevice() {
+CFX_FxgeDevice::CFX_FxgeDevice() {
m_bOwnedBitmap = FALSE;
}
-SkPictureRecorder* CFX_SkiaDevice::CreateRecorder(int size_x, int size_y) {
+SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) {
CFX_SkiaDeviceDriver* skDriver = new CFX_SkiaDeviceDriver(size_x, size_y);
SetDeviceDriver(skDriver);
return skDriver->GetRecorder();
}
-FX_BOOL CFX_SkiaDevice::Attach(CFX_DIBitmap* pBitmap,
- int dither_bits,
- FX_BOOL bRgbByteOrder,
- CFX_DIBitmap* pOriDevice,
- FX_BOOL bGroupKnockout) {
+bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
+ int dither_bits,
+ bool bRgbByteOrder,
+ CFX_DIBitmap* pOriDevice,
+ bool bGroupKnockout) {
if (!pBitmap)
- return FALSE;
+ return false;
SetBitmap(pBitmap);
SetDeviceDriver(new CFX_SkiaDeviceDriver(pBitmap, dither_bits, bRgbByteOrder,
pOriDevice, bGroupKnockout));
- return TRUE;
+ return true;
}
-FX_BOOL CFX_SkiaDevice::AttachRecorder(SkPictureRecorder* recorder) {
+bool CFX_FxgeDevice::AttachRecorder(SkPictureRecorder* recorder) {
if (!recorder)
- return FALSE;
+ return false;
SetDeviceDriver(new CFX_SkiaDeviceDriver(recorder));
- return TRUE;
+ return true;
}
-FX_BOOL CFX_SkiaDevice::Create(int width,
- int height,
- FXDIB_Format format,
- int dither_bits,
- CFX_DIBitmap* pOriDevice) {
+bool CFX_FxgeDevice::Create(int width,
+ int height,
+ FXDIB_Format format,
+ int dither_bits,
+ CFX_DIBitmap* pOriDevice) {
m_bOwnedBitmap = TRUE;
CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
if (!pBitmap->Create(width, height, format)) {
delete pBitmap;
- return FALSE;
+ return false;
}
SetBitmap(pBitmap);
CFX_SkiaDeviceDriver* pDriver =
new CFX_SkiaDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE);
SetDeviceDriver(pDriver);
- return TRUE;
+ return true;
}
-CFX_SkiaDevice::~CFX_SkiaDevice() {
+CFX_FxgeDevice::~CFX_FxgeDevice() {
if (m_bOwnedBitmap && GetBitmap())
delete GetBitmap();
}
diff --git a/fpdfsdk/fpdf_progressive.cpp b/fpdfsdk/fpdf_progressive.cpp
index 1450f8e74b..d42d954bb9 100644
--- a/fpdfsdk/fpdf_progressive.cpp
+++ b/fpdfsdk/fpdf_progressive.cpp
@@ -41,21 +41,12 @@ DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
CRenderContext* pContext = new CRenderContext;
pPage->SetPrivateData((void*)1, pContext, DropContext);
-#ifdef _SKIA_SUPPORT_
- pContext->m_pDevice = new CFX_SkiaDevice;
- if (flags & FPDF_REVERSE_BYTE_ORDER)
- ((CFX_SkiaDevice*)pContext->m_pDevice)
- ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE);
- else
- ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
-#else
pContext->m_pDevice = new CFX_FxgeDevice;
if (flags & FPDF_REVERSE_BYTE_ORDER)
((CFX_FxgeDevice*)pContext->m_pDevice)
->Attach((CFX_DIBitmap*)bitmap, 0, TRUE);
else
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
-#endif
IFSDK_PAUSE_Adapter IPauseAdapter(pause);
FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 9f4e2944ca..153c1057a5 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -342,11 +342,9 @@ static void FFLCommon(FPDF_FORMHANDLE hHandle,
FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y);
+ std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice);
#ifdef _SKIA_SUPPORT_
- std::unique_ptr<CFX_SkiaDevice> pDevice(new CFX_SkiaDevice());
pDevice->AttachRecorder(static_cast<SkPictureRecorder*>(recorder));
-#else
- std::unique_ptr<CFX_FxgeDevice> pDevice(new CFX_FxgeDevice);
#endif
pDevice->Attach((CFX_DIBitmap*)bitmap);
pDevice->SaveState();
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 405d8dc749..020ff8df6d 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -549,13 +549,8 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
pBitmap = new CFX_DIBitmap;
pBitmap->Create(size_x, size_y, FXDIB_Argb);
pBitmap->Clear(0x00ffffff);
-#ifdef _SKIA_SUPPORT_
- pContext->m_pDevice = new CFX_SkiaDevice;
- ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap);
-#else
pContext->m_pDevice = new CFX_FxgeDevice;
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap);
-#endif
} else {
pContext->m_pDevice = new CFX_WindowsDevice(dc);
}
@@ -648,15 +643,6 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
return;
CRenderContext* pContext = new CRenderContext;
pPage->SetPrivateData((void*)1, pContext, DropContext);
-#ifdef _SKIA_SUPPORT_
- pContext->m_pDevice = new CFX_SkiaDevice();
-
- if (flags & FPDF_REVERSE_BYTE_ORDER)
- ((CFX_SkiaDevice*)pContext->m_pDevice)
- ->Attach((CFX_DIBitmap*)bitmap, 0, TRUE);
- else
- ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
-#else
pContext->m_pDevice = new CFX_FxgeDevice;
if (flags & FPDF_REVERSE_BYTE_ORDER)
@@ -664,7 +650,6 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap,
->Attach((CFX_DIBitmap*)bitmap, 0, TRUE);
else
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)bitmap);
-#endif
FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
rotate, flags, TRUE, NULL);
@@ -682,7 +667,7 @@ DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page,
return nullptr;
std::unique_ptr<CRenderContext> pContext(new CRenderContext);
pPage->SetPrivateData((void*)1, pContext.get(), DropContext);
- CFX_SkiaDevice* skDevice = new CFX_SkiaDevice();
+ CFX_FxgeDevice* skDevice = new CFX_FxgeDevice;
FPDF_RECORDER recorder = skDevice->CreateRecorder(size_x, size_y);
pContext->m_pDevice = skDevice;
@@ -835,11 +820,7 @@ DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
FPDF_DWORD color) {
if (!bitmap)
return;
-#ifdef _SKIA_SUPPORT_
- CFX_SkiaDevice device;
-#else
CFX_FxgeDevice device;
-#endif
device.Attach((CFX_DIBitmap*)bitmap);
if (!((CFX_DIBitmap*)bitmap)->HasAlpha())
color |= 0xFF000000;