summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-05-26 10:45:30 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-26 10:45:30 -0700
commit41846a0fcc7d98476a18ec6c97778ead58069d99 (patch)
treea91f1273a03ca027c066a571b41f590896404574 /core
parente9885e77a7daf7a8d45eaf0290a1ea5f208c24c6 (diff)
downloadpdfium-41846a0fcc7d98476a18ec6c97778ead58069d99.tar.xz
Remove default argument from RestoreState() methods.
Review-Url: https://codereview.chromium.org/2009803003
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp16
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp18
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_text.cpp2
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp16
-rw-r--r--core/fxge/agg/fx_agg_driver.h2
-rw-r--r--core/fxge/apple/apple_int.h2
-rw-r--r--core/fxge/apple/fx_quartz_device.cpp38
-rw-r--r--core/fxge/ge/fx_ge_device.cpp4
-rw-r--r--core/fxge/ge/fx_ge_ps.cpp18
-rw-r--r--core/fxge/include/fx_ge.h6
-rw-r--r--core/fxge/skia/fx_skia_device.cpp2
-rw-r--r--core/fxge/skia/fx_skia_device.h2
-rw-r--r--core/fxge/win32/fx_win32_device.cpp12
-rw-r--r--core/fxge/win32/fx_win32_print.cpp6
-rw-r--r--core/fxge/win32/win32_int.h11
15 files changed, 87 insertions, 68 deletions
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index 5ffedca5ab..3144191469 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -443,7 +443,7 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj,
m_pDevice->SaveState();
status.RenderObjectList(pFormObj->m_pForm, &matrix);
m_bStopped = status.m_bStopped;
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
return TRUE;
}
FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix) {
@@ -583,7 +583,7 @@ void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath,
const CFX_Matrix* pObj2Device) {
if (ClipPath.IsNull()) {
if (!m_LastClipPath.IsNull()) {
- m_pDevice->RestoreState(TRUE);
+ m_pDevice->RestoreState(true);
m_LastClipPath.SetNull();
}
return;
@@ -592,7 +592,7 @@ void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath,
return;
m_LastClipPath = ClipPath;
- m_pDevice->RestoreState(TRUE);
+ m_pDevice->RestoreState(true);
int nClipPath = ClipPath.GetPathCount();
for (int i = 0; i < nClipPath; ++i) {
const CFX_PathData* pPathData = ClipPath.GetPath(i);
@@ -974,7 +974,7 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
}
if (status.m_bStopped) {
- pDevice->RestoreState();
+ pDevice->RestoreState(false);
break;
}
} else {
@@ -986,11 +986,11 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize);
}
if (status.m_bStopped) {
- pDevice->RestoreState();
+ pDevice->RestoreState(false);
break;
}
}
- pDevice->RestoreState();
+ pDevice->RestoreState(false);
}
}
@@ -1007,7 +1007,7 @@ CPDF_ProgressiveRenderer::CPDF_ProgressiveRenderer(
CPDF_ProgressiveRenderer::~CPDF_ProgressiveRenderer() {
if (m_pRenderStatus)
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
}
void CPDF_ProgressiveRenderer::Start(IFX_Pause* pPause) {
@@ -1080,7 +1080,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) {
}
if (m_pCurrentLayer->m_pObjectHolder->IsParsed()) {
m_pRenderStatus.reset();
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
m_pCurrentLayer = nullptr;
m_LayerIndex++;
if (pPause && pPause->NeedToPauseNow()) {
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index b8fa400db7..393b993e35 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -959,7 +959,7 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern,
m_pDevice->SaveState();
if (pPageObj->IsPath()) {
if (!SelectClipPath(pPageObj->AsPath(), pObj2Device, bStroke)) {
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
return;
}
} else if (pPageObj->IsImage()) {
@@ -969,7 +969,7 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern,
}
FX_RECT rect;
if (GetObjectClippedRect(pPageObj, pObj2Device, FALSE, rect)) {
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
return;
}
CFX_Matrix matrix = *pattern->pattern_to_form();
@@ -978,7 +978,7 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern,
int alpha = pPageObj->m_GeneralState.GetAlpha(bStroke);
DrawShading(pattern, &matrix, rect, alpha,
m_Options.m_ColorMode == RENDER_COLOR_ALPHA);
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
}
void CPDF_RenderStatus::ProcessShading(const CPDF_ShadingObject* pShadingObj,
@@ -1006,7 +1006,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
m_pDevice->SaveState();
if (pPageObj->IsPath()) {
if (!SelectClipPath(pPageObj->AsPath(), pObj2Device, bStroke)) {
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
return;
}
} else if (pPageObj->IsImage()) {
@@ -1016,7 +1016,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
}
FX_RECT clip_box = m_pDevice->GetClipBox();
if (clip_box.IsEmpty()) {
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
return;
}
CFX_Matrix dCTM = m_pDevice->GetCTM();
@@ -1084,9 +1084,9 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
pStates, &m_Options, pPattern->form()->m_Transparency,
m_bDropObjects, pFormResource);
status.RenderObjectList(pPattern->form(), &matrix);
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
}
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
delete pStates;
return;
}
@@ -1124,7 +1124,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
pObj2Device, width, height, m_Options.m_Flags);
}
if (!pPatternBitmap) {
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
return;
}
if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) {
@@ -1178,7 +1178,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
}
CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255,
FXDIB_BLEND_NORMAL, FALSE);
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
}
void CPDF_RenderStatus::DrawPathWithPattern(const CPDF_PathObject* pPathObj,
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
index ce73208896..5bd7c35059 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -430,7 +430,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj,
status.m_Type3FontCache.Add(pType3Font);
m_pDevice->SaveState();
status.RenderObjectList(pType3Char->m_pForm.get(), &matrix);
- m_pDevice->RestoreState();
+ m_pDevice->RestoreState(false);
} else {
CFX_FloatRect rect_f = pType3Char->m_pForm->CalcBoundingBox();
rect_f.Transform(&matrix);
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 6726877d99..86326f6caf 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -284,21 +284,21 @@ void CFX_AggDeviceDriver::SaveState() {
m_StateStack.Add(pClip);
}
-void CFX_AggDeviceDriver::RestoreState(FX_BOOL bKeepSaved) {
- if (m_StateStack.GetSize() == 0) {
- delete m_pClipRgn;
- m_pClipRgn = nullptr;
- return;
- }
- CFX_ClipRgn* pSavedClip = m_StateStack[m_StateStack.GetSize() - 1];
+void CFX_AggDeviceDriver::RestoreState(bool bKeepSaved) {
delete m_pClipRgn;
m_pClipRgn = nullptr;
+
+ int size = m_StateStack.GetSize();
+ if (!size)
+ return;
+
+ CFX_ClipRgn* pSavedClip = m_StateStack[size - 1];
if (bKeepSaved) {
if (pSavedClip) {
m_pClipRgn = new CFX_ClipRgn(*pSavedClip);
}
} else {
- m_StateStack.RemoveAt(m_StateStack.GetSize() - 1);
+ m_StateStack.RemoveAt(size - 1);
m_pClipRgn = pSavedClip;
}
}
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index 18f8d348ce..a33bc09937 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -40,7 +40,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
// IFX_RenderDeviceDriver
int GetDeviceCaps(int caps_id) override;
void SaveState() override;
- void RestoreState(FX_BOOL bKeepSaved) override;
+ void RestoreState(bool bKeepSaved) override;
FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
int fill_mode) override;
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h
index 02754cc309..ddfa792cf4 100644
--- a/core/fxge/apple/apple_int.h
+++ b/core/fxge/apple/apple_int.h
@@ -91,7 +91,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
FX_BOOL StartRendering() override { return TRUE; }
void EndRendering() override {}
void SaveState() override;
- void RestoreState(FX_BOOL bKeepSaved) override;
+ void RestoreState(bool bKeepSaved) override;
FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
int fill_mode) override;
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index 6669899300..5bdffa9409 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -218,7 +218,8 @@ void CFX_QuartzDeviceDriver::SaveState() {
CGContextSaveGState(m_context);
m_saveCount++;
}
-void CFX_QuartzDeviceDriver::RestoreState(FX_BOOL isKeepSaved) {
+
+void CFX_QuartzDeviceDriver::RestoreState(bool isKeepSaved) {
CGContextRestoreGState(m_context);
if (isKeepSaved) {
CGContextSaveGState(m_context);
@@ -226,6 +227,7 @@ void CFX_QuartzDeviceDriver::RestoreState(FX_BOOL isKeepSaved) {
m_saveCount--;
}
}
+
FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathFill(const CFX_PathData* pathData,
const CFX_Matrix* matrix,
int fillMode) {
@@ -238,7 +240,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathFill(const CFX_PathData* pathData,
m = CGAffineTransformConcat(m, m_foxitDevice2User);
CGContextConcatCTM(m_context, m);
setPathToContext(pathData);
- RestoreState(FALSE);
+ RestoreState(false);
if ((fillMode & 3) == FXFILL_WINDING) {
CGContextClip(m_context);
} else {
@@ -277,7 +279,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetClip_PathStroke(
setStrokeInfo(graphState, 0xFF000000, lineWidth);
setPathToContext(pathData);
CGContextReplacePathWithStrokedPath(m_context);
- RestoreState(FALSE);
+ RestoreState(false);
CGContextClip(m_context);
return TRUE;
}
@@ -389,7 +391,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData* pathData,
} else if (pathMode == 6) {
CGContextDrawPath(m_context, kCGPathEOFillStroke);
}
- RestoreState(FALSE);
+ RestoreState(false);
return TRUE;
}
FX_BOOL CFX_QuartzDeviceDriver::FillRect(const FX_RECT* rect,
@@ -553,7 +555,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
pBitmap1 = pBitmap->Clone();
}
if (NULL == pBitmap1) {
- RestoreState(FALSE);
+ RestoreState(false);
return FALSE;
}
CGDataProviderRef pBitmapProvider = CGDataProviderCreateWithData(
@@ -576,7 +578,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
if (pBitmap1 != pBitmap) {
delete pBitmap1;
}
- RestoreState(FALSE);
+ RestoreState(false);
return TRUE;
}
if (pBitmap->GetBPP() < 32) {
@@ -589,14 +591,14 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
}
}
if (NULL == pBitmap1) {
- RestoreState(FALSE);
+ RestoreState(false);
return FALSE;
}
if (pBitmap1->HasAlpha()) {
if (pBitmap1 == pBitmap) {
pBitmap1 = pBitmap->Clone();
if (!pBitmap1) {
- RestoreState(FALSE);
+ RestoreState(false);
return FALSE;
}
}
@@ -630,7 +632,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
if (pBitmap1 != pBitmap) {
delete pBitmap1;
}
- RestoreState(FALSE);
+ RestoreState(false);
return TRUE;
}
FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
@@ -671,7 +673,7 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
pBitmap1 = pBitmap->Clone();
}
if (NULL == pBitmap1) {
- RestoreState(FALSE);
+ RestoreState(false);
return FALSE;
}
CGDataProviderRef pBitmapProvider = CGDataProviderCreateWithData(
@@ -694,7 +696,7 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
if (pBitmap1 != pBitmap) {
delete pBitmap1;
}
- RestoreState(FALSE);
+ RestoreState(false);
return TRUE;
}
if (pBitmap->GetBPP() < 32) {
@@ -707,14 +709,14 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
}
}
if (NULL == pBitmap1) {
- RestoreState(FALSE);
+ RestoreState(false);
return FALSE;
}
if (pBitmap1->HasAlpha()) {
if (pBitmap1 == pBitmap) {
pBitmap1 = pBitmap->Clone();
if (!pBitmap1) {
- RestoreState(FALSE);
+ RestoreState(false);
return FALSE;
}
}
@@ -736,7 +738,7 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
if (pBitmap1 != pBitmap) {
delete pBitmap1;
}
- RestoreState(FALSE);
+ RestoreState(false);
return TRUE;
}
FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars,
@@ -803,7 +805,7 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars,
}
CGContextShowGlyphsAtPositions(m_context, (CGGlyph*)glyph_indices,
glyph_positions, nChars);
- RestoreState(FALSE);
+ RestoreState(false);
return TRUE;
}
FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
@@ -833,7 +835,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
ret = CG_DrawGlypRun(i, pCharPos, pFont, pCache, NULL, pObject2Device,
font_size, color, alpha_flag, pIccTransform);
if (!ret) {
- RestoreState(FALSE);
+ RestoreState(false);
return ret;
}
}
@@ -851,7 +853,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
pObject2Device, font_size, color, alpha_flag,
pIccTransform);
if (!ret) {
- RestoreState(FALSE);
+ RestoreState(false);
return ret;
}
i++;
@@ -866,7 +868,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
ret = CG_DrawGlypRun(i, pCharPos, pFont, pCache, NULL, pObject2Device,
font_size, color, alpha_flag, pIccTransform);
}
- RestoreState(FALSE);
+ RestoreState(false);
return ret;
}
void CFX_QuartzDeviceDriver::setStrokeInfo(const CFX_GraphStateData* graphState,
diff --git a/core/fxge/ge/fx_ge_device.cpp b/core/fxge/ge/fx_ge_device.cpp
index 0d6addab75..2d3ba566be 100644
--- a/core/fxge/ge/fx_ge_device.cpp
+++ b/core/fxge/ge/fx_ge_device.cpp
@@ -40,10 +40,12 @@ void CFX_RenderDevice::EndRendering() {
void CFX_RenderDevice::SaveState() {
m_pDeviceDriver->SaveState();
}
-void CFX_RenderDevice::RestoreState(FX_BOOL bKeepSaved) {
+
+void CFX_RenderDevice::RestoreState(bool bKeepSaved) {
m_pDeviceDriver->RestoreState(bKeepSaved);
UpdateClipBox();
}
+
int CFX_RenderDevice::GetDeviceCaps(int caps_id) const {
return m_pDeviceDriver->GetDeviceCaps(caps_id);
}
diff --git a/core/fxge/ge/fx_ge_ps.cpp b/core/fxge/ge/fx_ge_ps.cpp
index 98253336a1..b112cf3630 100644
--- a/core/fxge/ge/fx_ge_ps.cpp
+++ b/core/fxge/ge/fx_ge_ps.cpp
@@ -77,19 +77,25 @@ void CFX_PSRenderer::SaveState() {
OUTPUT_PS("q\n");
m_ClipBoxStack.Add(m_ClipBox);
}
-void CFX_PSRenderer::RestoreState(FX_BOOL bKeepSaved) {
+
+void CFX_PSRenderer::RestoreState(bool bKeepSaved) {
StartRendering();
if (bKeepSaved) {
OUTPUT_PS("Q\nq\n");
} else {
OUTPUT_PS("Q\n");
}
- m_bColorSet = m_bGraphStateSet = FALSE;
- m_ClipBox = m_ClipBoxStack.GetAt(m_ClipBoxStack.GetSize() - 1);
- if (!bKeepSaved) {
- m_ClipBoxStack.RemoveAt(m_ClipBoxStack.GetSize() - 1);
- }
+ m_bColorSet = FALSE;
+ m_bGraphStateSet = FALSE;
+ int size = m_ClipBoxStack.GetSize();
+ if (!size)
+ return;
+
+ m_ClipBox = m_ClipBoxStack.GetAt(size - 1);
+ if (!bKeepSaved)
+ m_ClipBoxStack.RemoveAt(size - 1);
}
+
void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device) {
int nPoints = pPathData->GetPointCount();
diff --git a/core/fxge/include/fx_ge.h b/core/fxge/include/fx_ge.h
index 8f6b10debc..6efd5177bc 100644
--- a/core/fxge/include/fx_ge.h
+++ b/core/fxge/include/fx_ge.h
@@ -216,7 +216,7 @@ class CFX_RenderDevice {
FX_BOOL StartRendering();
void EndRendering();
void SaveState();
- void RestoreState(FX_BOOL bKeepSaved = FALSE);
+ void RestoreState(bool bKeepSaved);
int GetWidth() const { return m_Width; }
int GetHeight() const { return m_Height; }
@@ -431,7 +431,7 @@ class IFX_RenderDeviceDriver {
virtual void SaveState() = 0;
- virtual void RestoreState(FX_BOOL bKeepSaved = FALSE) = 0;
+ virtual void RestoreState(bool bKeepSaved) = 0;
virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
@@ -575,7 +575,7 @@ class CFX_PSRenderer {
FX_BOOL StartRendering();
void EndRendering();
void SaveState();
- void RestoreState(FX_BOOL bKeepSaved = FALSE);
+ void RestoreState(bool bKeepSaved);
void SetClip_PathFill(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
int fill_mode);
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 6646eedd0f..c4ca6f9223 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -604,7 +604,7 @@ void CFX_SkiaDeviceDriver::SaveState() {
m_pCanvas->save();
}
-void CFX_SkiaDeviceDriver::RestoreState(FX_BOOL bKeepSaved) {
+void CFX_SkiaDeviceDriver::RestoreState(bool bKeepSaved) {
m_pCanvas->restore();
if (bKeepSaved)
m_pCanvas->save();
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index ef66b94ae2..79097ade18 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -30,7 +30,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
/** Save and restore all graphic states */
void SaveState() override;
- void RestoreState(FX_BOOL bKeepSaved) override;
+ void RestoreState(bool bKeepSaved) override;
/** Set clipping path using filled region */
FX_BOOL SetClip_PathFill(
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index caf271dff3..b71f3ae97a 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -507,6 +507,7 @@ CGdiDeviceDriver::CGdiDeviceDriver(HDC hDC, int device_class) {
m_RenderCaps = FXRC_GET_BITS | FXRC_BIT_MASK;
}
}
+
int CGdiDeviceDriver::GetDeviceCaps(int caps_id) {
switch (caps_id) {
case FXDC_DEVICE_CLASS:
@@ -522,6 +523,17 @@ int CGdiDeviceDriver::GetDeviceCaps(int caps_id) {
}
return 0;
}
+
+void CGdiDeviceDriver::SaveState() {
+ SaveDC(m_hDC);
+}
+
+void CGdiDeviceDriver::RestoreState(bool bKeepSaved) {
+ RestoreDC(m_hDC, -1);
+ if (bKeepSaved)
+ SaveDC(m_hDC);
+}
+
void* CGdiDeviceDriver::GetClipRgn() {
HRGN hClipRgn = CreateRectRgn(0, 0, 1, 1);
if (::GetClipRgn(m_hDC, hClipRgn) == 0) {
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index d0359138de..9fd1683a80 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -270,7 +270,7 @@ FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
FX_BOOL ret = StretchDIBits(
pTransformed, color, full_rect.left, full_rect.top, full_rect.Width(),
full_rect.Height(), NULL, 0, alpha_flag, pIccTransform, blend_type);
- RestoreState();
+ RestoreState(false);
delete pTransformed;
handle = NULL;
return ret;
@@ -371,9 +371,11 @@ void CPSPrinterDriver::EndRendering() {
void CPSPrinterDriver::SaveState() {
m_PSRenderer.SaveState();
}
-void CPSPrinterDriver::RestoreState(FX_BOOL bKeepSaved) {
+
+void CPSPrinterDriver::RestoreState(bool bKeepSaved) {
m_PSRenderer.RestoreState(bKeepSaved);
}
+
FX_BOOL CPSPrinterDriver::SetClip_PathFill(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
int fill_mode) {
diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h
index 619ac2fdae..d2d091bc19 100644
--- a/core/fxge/win32/win32_int.h
+++ b/core/fxge/win32/win32_int.h
@@ -109,13 +109,8 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver {
protected:
// IFX_RenderDeviceDriver
int GetDeviceCaps(int caps_id) override;
- void SaveState() override { SaveDC(m_hDC); }
- void RestoreState(FX_BOOL bKeepSaved = FALSE) override {
- RestoreDC(m_hDC, -1);
- if (bKeepSaved) {
- SaveDC(m_hDC);
- }
- }
+ void SaveState() override;
+ void RestoreState(bool bKeepSaved) override;
FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
int fill_mode) override;
@@ -298,7 +293,7 @@ class CPSPrinterDriver : public IFX_RenderDeviceDriver {
FX_BOOL StartRendering() override;
void EndRendering() override;
void SaveState() override;
- void RestoreState(FX_BOOL bKeepSaved = FALSE) override;
+ void RestoreState(bool bKeepSaved) override;
FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
int fill_mode) override;