summaryrefslogtreecommitdiff
path: root/xfa/fxgraphics/cxfa_graphics.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-08-17 12:01:03 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-08-17 20:22:30 +0000
commit129297f6ae97169093d4affe3c8421b757bd95ec (patch)
treee1454f1ac423c372e1743e9347695b82ac496338 /xfa/fxgraphics/cxfa_graphics.cpp
parent86224fc1f74a27c3448961c91e10d4e3feb427e4 (diff)
downloadpdfium-129297f6ae97169093d4affe3c8421b757bd95ec.tar.xz
Remove default parameters in CXFA_Graphics methods.
Constify parameters as well. Change-Id: I7e87b11cc73b133b04d49ceed1c46f5afcb89d1a Reviewed-on: https://pdfium-review.googlesource.com/11111 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxgraphics/cxfa_graphics.cpp')
-rw-r--r--xfa/fxgraphics/cxfa_graphics.cpp50
1 files changed, 24 insertions, 26 deletions
diff --git a/xfa/fxgraphics/cxfa_graphics.cpp b/xfa/fxgraphics/cxfa_graphics.cpp
index 4975a83251..7cad380802 100644
--- a/xfa/fxgraphics/cxfa_graphics.cpp
+++ b/xfa/fxgraphics/cxfa_graphics.cpp
@@ -178,7 +178,7 @@ void CXFA_Graphics::SetFillColor(const CXFA_Color& color) {
m_info.fillColor = color;
}
-void CXFA_Graphics::StrokePath(CXFA_Path* path, CFX_Matrix* matrix) {
+void CXFA_Graphics::StrokePath(CXFA_Path* path, const CFX_Matrix* matrix) {
if (!path)
return;
if (m_type == FX_CONTEXT_Device && m_renderDevice)
@@ -187,7 +187,7 @@ void CXFA_Graphics::StrokePath(CXFA_Path* path, CFX_Matrix* matrix) {
void CXFA_Graphics::FillPath(CXFA_Path* path,
FX_FillMode fillMode,
- CFX_Matrix* matrix) {
+ const CFX_Matrix* matrix) {
if (!path)
return;
if (m_type == FX_CONTEXT_Device && m_renderDevice)
@@ -196,7 +196,7 @@ void CXFA_Graphics::FillPath(CXFA_Path* path,
void CXFA_Graphics::StretchImage(const CFX_RetainPtr<CFX_DIBSource>& source,
const CFX_RectF& rect,
- CFX_Matrix* matrix) {
+ const CFX_Matrix& matrix) {
if (!source)
return;
if (m_type == FX_CONTEXT_Device && m_renderDevice)
@@ -211,7 +211,7 @@ void CXFA_Graphics::ConcatMatrix(const CFX_Matrix* matrix) {
}
}
-CFX_Matrix* CXFA_Graphics::GetMatrix() {
+const CFX_Matrix* CXFA_Graphics::GetMatrix() const {
if (m_type == FX_CONTEXT_Device && m_renderDevice)
return &m_info.CTM;
return nullptr;
@@ -268,8 +268,8 @@ void CXFA_Graphics::RenderDeviceSetLineDash(FX_DashStyle dashStyle) {
}
}
-void CXFA_Graphics::RenderDeviceStrokePath(CXFA_Path* path,
- CFX_Matrix* matrix) {
+void CXFA_Graphics::RenderDeviceStrokePath(const CXFA_Path* path,
+ const CFX_Matrix* matrix) {
if (m_info.strokeColor.GetType() != CXFA_Color::Solid)
return;
@@ -281,9 +281,9 @@ void CXFA_Graphics::RenderDeviceStrokePath(CXFA_Path* path,
m_info.strokeColor.GetArgb(), 0);
}
-void CXFA_Graphics::RenderDeviceFillPath(CXFA_Path* path,
+void CXFA_Graphics::RenderDeviceFillPath(const CXFA_Path* path,
FX_FillMode fillMode,
- CFX_Matrix* matrix) {
+ const CFX_Matrix* matrix) {
CFX_Matrix m = m_info.CTM;
if (matrix)
m.Concat(*matrix);
@@ -294,10 +294,10 @@ void CXFA_Graphics::RenderDeviceFillPath(CXFA_Path* path,
m_info.fillColor.GetArgb(), 0x0, fillMode);
return;
case CXFA_Color::Pattern:
- FillPathWithPattern(path, fillMode, &m);
+ FillPathWithPattern(path, fillMode, m);
return;
case CXFA_Color::Shading:
- FillPathWithShading(path, fillMode, &m);
+ FillPathWithShading(path, fillMode, m);
return;
default:
return;
@@ -307,12 +307,11 @@ void CXFA_Graphics::RenderDeviceFillPath(CXFA_Path* path,
void CXFA_Graphics::RenderDeviceStretchImage(
const CFX_RetainPtr<CFX_DIBSource>& source,
const CFX_RectF& rect,
- CFX_Matrix* matrix) {
+ const CFX_Matrix& matrix) {
CFX_Matrix m1(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d,
m_info.CTM.e, m_info.CTM.f);
- if (matrix) {
- m1.Concat(*matrix);
- }
+ m1.Concat(matrix);
+
CFX_RetainPtr<CFX_DIBitmap> bmp1 =
source->StretchTo(static_cast<int32_t>(rect.Width()),
static_cast<int32_t>(rect.Height()), 0, nullptr);
@@ -330,9 +329,9 @@ void CXFA_Graphics::RenderDeviceStretchImage(
FXSYS_round(r.left - left), FXSYS_round(r.top - top));
}
-void CXFA_Graphics::FillPathWithPattern(CXFA_Path* path,
+void CXFA_Graphics::FillPathWithPattern(const CXFA_Path* path,
FX_FillMode fillMode,
- CFX_Matrix* matrix) {
+ const CFX_Matrix& matrix) {
CXFA_Pattern* pattern = m_info.fillColor.GetPattern();
CFX_RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap();
int32_t width = bitmap->GetWidth();
@@ -348,8 +347,7 @@ void CXFA_Graphics::FillPathWithPattern(CXFA_Path* path,
mask->Create(data.width, data.height, FXDIB_1bppMask);
memcpy(mask->GetBuffer(), data.maskBits, mask->GetPitch() * data.height);
CFX_FloatRect rectf = path->GetPathData()->GetBoundingBox();
- if (matrix)
- matrix->TransformRect(rectf);
+ matrix.TransformRect(rectf);
FX_RECT rect(FXSYS_round(rectf.left), FXSYS_round(rectf.top),
FXSYS_round(rectf.right), FXSYS_round(rectf.bottom));
@@ -361,13 +359,13 @@ void CXFA_Graphics::FillPathWithPattern(CXFA_Path* path,
device.SetBitMask(mask, i, j, m_info.fillColor.GetPattern()->m_foreArgb);
}
CFX_RenderDevice::StateRestorer restorer(m_renderDevice);
- m_renderDevice->SetClip_PathFill(path->GetPathData(), matrix, fillMode);
- SetDIBitsWithMatrix(bmp, &pattern->m_matrix);
+ m_renderDevice->SetClip_PathFill(path->GetPathData(), &matrix, fillMode);
+ SetDIBitsWithMatrix(bmp, pattern->m_matrix);
}
-void CXFA_Graphics::FillPathWithShading(CXFA_Path* path,
+void CXFA_Graphics::FillPathWithShading(const CXFA_Path* path,
FX_FillMode fillMode,
- CFX_Matrix* matrix) {
+ const CFX_Matrix& matrix) {
CFX_RetainPtr<CFX_DIBitmap> bitmap = m_renderDevice->GetBitmap();
int32_t width = bitmap->GetWidth();
int32_t height = bitmap->GetHeight();
@@ -478,20 +476,20 @@ void CXFA_Graphics::FillPathWithShading(CXFA_Path* path,
}
if (result) {
CFX_RenderDevice::StateRestorer restorer(m_renderDevice);
- m_renderDevice->SetClip_PathFill(path->GetPathData(), matrix, fillMode);
+ m_renderDevice->SetClip_PathFill(path->GetPathData(), &matrix, fillMode);
SetDIBitsWithMatrix(bmp, matrix);
}
}
void CXFA_Graphics::SetDIBitsWithMatrix(
const CFX_RetainPtr<CFX_DIBSource>& source,
- CFX_Matrix* matrix) {
- if (matrix->IsIdentity()) {
+ const CFX_Matrix& matrix) {
+ if (matrix.IsIdentity()) {
m_renderDevice->SetDIBits(source, 0, 0);
} else {
CFX_Matrix m((float)source->GetWidth(), 0, 0, (float)source->GetHeight(), 0,
0);
- m.Concat(*matrix);
+ m.Concat(matrix);
int32_t left;
int32_t top;
CFX_RetainPtr<CFX_DIBitmap> bmp1 = source->FlipImage(false, true);