summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-10 19:02:15 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-10 19:02:15 +0000
commite5c3ebd923a21c6c82bd214ca27a5d7396b852c2 (patch)
treed952cc04bd711b5dd21ad2dcce7ea307024c719b
parent85ba2610cf05a75b52681f381bba2da3ba37b984 (diff)
downloadpdfium-e5c3ebd923a21c6c82bd214ca27a5d7396b852c2.tar.xz
Change CFX_RenderDevice::FillRect() to take FX_RECT by const-ref.
It currently takes const FX_RECT*, but the pointer is never nullptr. Change-Id: I571e9e8dd04756bc4daa25a61a5af8d1f902914b Reviewed-on: https://pdfium-review.googlesource.com/30052 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r--core/fpdfapi/render/cpdf_rendercontext.cpp4
-rw-r--r--core/fxge/cfx_renderdevice.h4
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp3
-rw-r--r--fpdfsdk/fpdf_view.cpp3
-rw-r--r--fxbarcode/oned/BC_OneDimWriter.cpp2
-rw-r--r--fxbarcode/oned/BC_OnedEAN13Writer.cpp6
-rw-r--r--fxbarcode/oned/BC_OnedEAN8Writer.cpp4
-rw-r--r--fxbarcode/oned/BC_OnedUPCAWriter.cpp8
-rw-r--r--xfa/fxgraphics/cxfa_graphics.cpp7
9 files changed, 19 insertions, 22 deletions
diff --git a/core/fpdfapi/render/cpdf_rendercontext.cpp b/core/fpdfapi/render/cpdf_rendercontext.cpp
index 0656edda22..73f9a4c3ff 100644
--- a/core/fpdfapi/render/cpdf_rendercontext.cpp
+++ b/core/fpdfapi/render/cpdf_rendercontext.cpp
@@ -38,8 +38,8 @@ void CPDF_RenderContext::GetBackground(const RetainPtr<CFX_DIBitmap>& pBuffer,
CFX_DefaultRenderDevice device;
device.Attach(pBuffer, false, nullptr, false);
- FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight());
- device.FillRect(&rect, 0xffffffff);
+ device.FillRect(FX_RECT(0, 0, device.GetWidth(), device.GetHeight()),
+ 0xffffffff);
Render(&device, pObj, pOptions, pFinalMatrix);
}
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index 6c91d55140..e6c44ff35f 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -144,8 +144,8 @@ class CFX_RenderDevice {
uint32_t stroke_color,
int fill_mode,
int blend_type);
- bool FillRect(const FX_RECT* pRect, uint32_t color) {
- return FillRectWithBlend(*pRect, color, FXDIB_BLEND_NORMAL);
+ bool FillRect(const FX_RECT& rect, uint32_t color) {
+ return FillRectWithBlend(rect, color, FXDIB_BLEND_NORMAL);
}
RetainPtr<CFX_DIBitmap> GetBackDrop();
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index d2d8ecb148..8f345412cf 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -706,8 +706,7 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice,
rcDevice.top = tmp.y;
rcDevice.Normalize();
- FX_RECT rcDev = rcDevice.ToFxRect();
- pDevice->FillRect(&rcDev,
+ pDevice->FillRect(rcDevice.ToFxRect(),
AlphaAndColorRefToArgb(
static_cast<int>(m_pInterForm->GetHighlightAlpha()),
m_pInterForm->GetHighlightColor(fieldType)));
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index 655aed8141..2b4600dc8a 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -860,8 +860,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDFBitmap_FillRect(FPDF_BITMAP bitmap,
device.Attach(pBitmap, false, nullptr, false);
if (!pBitmap->HasAlpha())
color |= 0xFF000000;
- FX_RECT rect(left, top, left + width, top + height);
- device.FillRect(&rect, color);
+ device.FillRect(FX_RECT(left, top, left + width, top + height), color);
}
FPDF_EXPORT void* FPDF_CALLCONV FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap) {
diff --git a/fxbarcode/oned/BC_OneDimWriter.cpp b/fxbarcode/oned/BC_OneDimWriter.cpp
index 040257b425..03be25fc35 100644
--- a/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -191,7 +191,7 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice* device,
rect.right -= 1;
}
FX_RECT re = matrix->TransformRect(rect).GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
+ device->FillRect(re, m_backgroundColor);
CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, (float)locX,
(float)(locY + iFontSize));
if (matrix) {
diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
index a6315bcdbb..6818d432d6 100644
--- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp
@@ -157,21 +157,21 @@ bool CBC_OnedEAN13Writer::ShowChars(const WideStringView& contents,
(float)(leftPosition + strWidth - 0.5), (float)m_Height);
matr.Concat(*matrix);
FX_RECT re = matr.TransformRect(rect).GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
+ device->FillRect(re, m_backgroundColor);
CFX_FloatRect rect1(
(float)(leftPosition + 47 * multiple), (float)(m_Height - iTextHeight),
(float)(leftPosition + 47 * multiple + strWidth - 0.5), (float)m_Height);
CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
matr1.Concat(*matrix);
re = matr1.TransformRect(rect1).GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
+ device->FillRect(re, m_backgroundColor);
int32_t strWidth1 = multiple * 7;
CFX_Matrix matr2(m_outputHScale, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
CFX_FloatRect rect2(0.0f, (float)(m_Height - iTextHeight),
(float)strWidth1 - 0.5f, (float)m_Height);
matr2.Concat(*matrix);
re = matr2.TransformRect(rect2).GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
+ device->FillRect(re, m_backgroundColor);
float blank = 0.0;
iLen = tempStr.GetLength();
diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
index 988528ed09..6862ba87a1 100644
--- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp
+++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp
@@ -160,14 +160,14 @@ bool CBC_OnedEAN8Writer::ShowChars(const WideStringView& contents,
(float)(leftPosition + strWidth - 0.5), (float)m_Height);
matr.Concat(*matrix);
FX_RECT re = matr.TransformRect(rect).GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
+ device->FillRect(re, m_backgroundColor);
CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect1(
(float)(leftPosition + 33 * multiple), (float)(m_Height - iTextHeight),
(float)(leftPosition + 33 * multiple + strWidth - 0.5), (float)m_Height);
matr1.Concat(*matrix);
re = matr1.TransformRect(rect1).GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
+ device->FillRect(re, m_backgroundColor);
strWidth = (int32_t)(strWidth * m_outputHScale);
CalcTextInfo(tempStr, charpos.data(), m_pFont.Get(), (float)strWidth,
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index 025f851526..daabe9eb3b 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -128,7 +128,7 @@ bool CBC_OnedUPCAWriter::ShowChars(const WideStringView& contents,
(float)(leftPosition + strWidth - 0.5), (float)m_Height);
matr.Concat(*matrix);
FX_RECT re = matr.TransformRect(rect).GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
+ device->FillRect(re, m_backgroundColor);
CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect1((float)(leftPosition + 40 * multiple),
(float)(m_Height - iTextHeight),
@@ -136,14 +136,14 @@ bool CBC_OnedUPCAWriter::ShowChars(const WideStringView& contents,
(float)m_Height);
matr1.Concat(*matrix);
re = matr1.TransformRect(rect1).GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
+ device->FillRect(re, m_backgroundColor);
float strWidth1 = (float)multiple * 7;
CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect2(0.0, (float)(m_Height - iTextHeight),
(float)strWidth1 - 1, (float)m_Height);
matr2.Concat(*matrix);
re = matr2.TransformRect(rect2).GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
+ device->FillRect(re, m_backgroundColor);
CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect3((float)(leftPosition + 85 * multiple),
(float)(m_Height - iTextHeight),
@@ -151,7 +151,7 @@ bool CBC_OnedUPCAWriter::ShowChars(const WideStringView& contents,
(float)m_Height);
matr3.Concat(*matrix);
re = matr3.TransformRect(rect3).GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
+ device->FillRect(re, m_backgroundColor);
strWidth = strWidth * m_outputHScale;
CalcTextInfo(tempStr, &charpos[1], m_pFont.Get(), strWidth, iFontSize, blank);
diff --git a/xfa/fxgraphics/cxfa_graphics.cpp b/xfa/fxgraphics/cxfa_graphics.cpp
index d1e2f35c7e..b13ecc060d 100644
--- a/xfa/fxgraphics/cxfa_graphics.cpp
+++ b/xfa/fxgraphics/cxfa_graphics.cpp
@@ -282,14 +282,13 @@ void CXFA_Graphics::FillPathWithPattern(const CXFA_GEPath* path,
auto mask = pdfium::MakeRetain<CFX_DIBitmap>();
mask->Create(data.width, data.height, FXDIB_1bppMask);
memcpy(mask->GetBuffer(), data.maskBits, mask->GetPitch() * data.height);
- CFX_FloatRect rectf =
+ const CFX_FloatRect rectf =
matrix.TransformRect(path->GetPathData()->GetBoundingBox());
+ const FX_RECT rect = rectf.ToRoundedFxRect();
- FX_RECT rect(FXSYS_round(rectf.left), FXSYS_round(rectf.top),
- FXSYS_round(rectf.right), FXSYS_round(rectf.bottom));
CFX_DefaultRenderDevice device;
device.Attach(bmp, false, nullptr, false);
- device.FillRect(&rect, m_info.fillColor.GetPattern()->m_backArgb);
+ device.FillRect(rect, m_info.fillColor.GetPattern()->m_backArgb);
for (int32_t j = rect.bottom; j < rect.top; j += mask->GetHeight()) {
for (int32_t i = rect.left; i < rect.right; i += mask->GetWidth())
device.SetBitMask(mask, i, j, m_info.fillColor.GetPattern()->m_foreArgb);