summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-29 13:23:13 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-29 13:23:13 -0800
commitbec4ea1e64b8049c572dd088c9c09a94f49b2353 (patch)
tree14470b439a7f963beea6aff17c72ac3321dc2e0a /core
parent3f157c7c6a5cdb92dd5df2a0b06c10ed83b472e8 (diff)
downloadpdfium-bec4ea1e64b8049c572dd088c9c09a94f49b2353.tar.xz
Pass rect by const reference in SetClip_Rect().
R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1745243002 .
Diffstat (limited to 'core')
-rw-r--r--core/include/fxge/fx_ge.h32
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp6
-rw-r--r--core/src/fxge/ge/fx_ge_device.cpp9
3 files changed, 12 insertions, 35 deletions
diff --git a/core/include/fxge/fx_ge.h b/core/include/fxge/fx_ge.h
index ebcdea1483..c5d409c41c 100644
--- a/core/include/fxge/fx_ge.h
+++ b/core/include/fxge/fx_ge.h
@@ -239,36 +239,26 @@ typedef struct {
FX_DWORD m_ExtGID;
FX_BOOL m_bFontStyle;
} FXTEXT_CHARPOS;
+
class CFX_RenderDevice {
public:
CFX_RenderDevice();
-
virtual ~CFX_RenderDevice();
void SetDeviceDriver(IFX_RenderDeviceDriver* pDriver);
-
IFX_RenderDeviceDriver* GetDeviceDriver() const { return m_pDeviceDriver; }
FX_BOOL StartRendering();
-
void EndRendering();
-
void SaveState();
-
void RestoreState(FX_BOOL bKeepSaved = FALSE);
int GetWidth() const { return m_Width; }
-
int GetHeight() const { return m_Height; }
-
int GetDeviceClass() const { return m_DeviceClass; }
-
int GetBPP() const { return m_bpp; }
-
int GetRenderCaps() const { return m_RenderCaps; }
-
int GetDeviceCaps(int id) const;
-
CFX_Matrix GetCTM() const;
CFX_DIBitmap* GetBitmap() const { return m_pBitmap; }
@@ -284,8 +274,7 @@ class CFX_RenderDevice {
const CFX_Matrix* pObject2Device,
int fill_mode);
- FX_BOOL SetClip_Rect(const FX_RECT* pRect);
-
+ FX_BOOL SetClip_Rect(const FX_RECT& pRect);
FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
const CFX_GraphStateData* pGraphState);
@@ -405,28 +394,19 @@ class CFX_RenderDevice {
virtual void End() {}
private:
- CFX_DIBitmap* m_pBitmap;
+ void InitDeviceInfo();
+ void UpdateClipBox();
+ CFX_DIBitmap* m_pBitmap;
int m_Width;
-
int m_Height;
-
int m_bpp;
-
int m_RenderCaps;
-
int m_DeviceClass;
-
FX_RECT m_ClipBox;
-
- protected:
IFX_RenderDeviceDriver* m_pDeviceDriver;
-
- private:
- void InitDeviceInfo();
-
- void UpdateClipBox();
};
+
class CFX_FxgeDevice : public CFX_RenderDevice {
public:
CFX_FxgeDevice();
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 5998a9236c..e4876a0d26 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -914,8 +914,7 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern,
return;
}
} else if (pPageObj->IsImage()) {
- FX_RECT rect = pPageObj->GetBBox(pObj2Device);
- m_pDevice->SetClip_Rect(&rect);
+ m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device));
} else {
return;
}
@@ -996,8 +995,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
return;
}
} else if (pPageObj->IsImage()) {
- FX_RECT rect = pPageObj->GetBBox(pObj2Device);
- m_pDevice->SetClip_Rect(&rect);
+ m_pDevice->SetClip_Rect(pPageObj->GetBBox(pObj2Device));
} else {
return;
}
diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp
index 268001b285..c4f7735957 100644
--- a/core/src/fxge/ge/fx_ge_device.cpp
+++ b/core/src/fxge/ge/fx_ge_device.cpp
@@ -91,13 +91,12 @@ FX_BOOL CFX_RenderDevice::SetClip_PathStroke(
UpdateClipBox();
return TRUE;
}
-FX_BOOL CFX_RenderDevice::SetClip_Rect(const FX_RECT* pRect) {
+FX_BOOL CFX_RenderDevice::SetClip_Rect(const FX_RECT& rect) {
CFX_PathData path;
- path.AppendRect((FX_FLOAT)(pRect->left), (FX_FLOAT)(pRect->bottom),
- (FX_FLOAT)(pRect->right), (FX_FLOAT)(pRect->top));
- if (!SetClip_PathFill(&path, NULL, FXFILL_WINDING)) {
+ path.AppendRect(rect.left, rect.bottom, rect.right, rect.top);
+ if (!SetClip_PathFill(&path, nullptr, FXFILL_WINDING))
return FALSE;
- }
+
UpdateClipBox();
return TRUE;
}