diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-20 09:50:37 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-20 09:50:37 -0700 |
commit | d50b172a9d3a05704748f0798b5aaa422485abbd (patch) | |
tree | 0289d99b370b8526c539fc676004bf622f5228a3 /fpdfsdk/src/pdfwindow/PWL_Edit.cpp | |
parent | 90a4181194dd8eca153cf2a101ec27e382b27a58 (diff) | |
download | pdfium-d50b172a9d3a05704748f0798b5aaa422485abbd.tar.xz |
Merge to XFA: Remove FX_Alloc() null checks now that it can't return NULL.
Original Review URL: https://codereview.chromium.org/1142713005
R=thestig@chromium.org
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1143663008
Diffstat (limited to 'fpdfsdk/src/pdfwindow/PWL_Edit.cpp')
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Edit.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp index f704a67731..678da68b49 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp @@ -426,17 +426,15 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); CFX_PathData path; - if (!path.SetPointCount(nCharArraySafe.ValueOrDie())) { - return; - } - + path.SetPointCount(nCharArraySafe.ValueOrDie()); + for (FX_INT32 i=0; i<nCharArray-1; i++) - { - path.SetPoint(i*2, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1), + { + path.SetPoint(i*2, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1), rcClient.bottom, FXPT_MOVETO); path.SetPoint(i*2+1, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1), - rcClient.top, FXPT_LINETO); - } + rcClient.top, FXPT_LINETO); + } if (path.GetPointCount() > 0) pDevice->DrawPath(&path, pUser2Device, &gsd,0, CPWL_Utils::PWLColorToFXColor(GetBorderColor(),255), FXFILL_ALTERNATE); @@ -453,19 +451,17 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPhase; CFX_PathData path; - if (!path.SetPointCount(nCharArraySafe.ValueOrDie())) { - return; - } - + path.SetPointCount(nCharArraySafe.ValueOrDie()); + for (FX_INT32 i=0; i<nCharArray-1; i++) - { - path.SetPoint(i*2, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1), + { + path.SetPoint(i*2, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1), rcClient.bottom, FXPT_MOVETO); path.SetPoint(i*2+1, rcClient.left + ((rcClient.right - rcClient.left)/nCharArray)*(i+1), - rcClient.top, FXPT_LINETO); - } + rcClient.top, FXPT_LINETO); + } if (path.GetPointCount() > 0) - pDevice->DrawPath(&path, pUser2Device, &gsd,0, + pDevice->DrawPath(&path, pUser2Device, &gsd,0, CPWL_Utils::PWLColorToFXColor(GetBorderColor(),255), FXFILL_ALTERNATE); } break; |