summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-04-27 11:47:29 -0700
committerTom Sepez <tsepez@chromium.org>2015-04-27 11:47:29 -0700
commite6f11a7b95e26affba59a7057776a787056af8df (patch)
treeac7e527683debb15df04102b9fe333e552965909 /fpdfsdk/src/pdfwindow/PWL_Utils.cpp
parentf7a7d7e07396c3a0fae617ed8f15f29fd491bc3a (diff)
downloadpdfium-e6f11a7b95e26affba59a7057776a787056af8df.tar.xz
Reduce usage of operator LPCWSTR from CFX_WideString().
This involves adding some explicit c_str() calls. Doing so flagged PDF_EncodeText() and FindOptionValue() as having suboptimal signatures, in that we are often throwing away a perfectly fine length and recomputing it. There are still some platform-specific code that needs the operator. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1101933003
Diffstat (limited to 'fpdfsdk/src/pdfwindow/PWL_Utils.cpp')
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Utils.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
index 1de6b56d5e..b57f8e019d 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
@@ -641,9 +641,8 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_Fo
CFX_ByteTextBuf sRet;
if (IFX_Edit * pEdit = IFX_Edit::NewEdit())
- {
+ {
pEdit->SetFontMap(pFontMap);
-
pEdit->SetPlateRect(rcBBox);
pEdit->SetAlignmentH(nAlignmentH);
pEdit->SetAlignmentV(nAlignmentV);
@@ -653,16 +652,15 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_Fo
pEdit->SetAutoFontSize(TRUE);
else
pEdit->SetFontSize(fFontSize);
+
pEdit->Initialize();
+ pEdit->SetText(sText.c_str());
- pEdit->SetText(sText);
-
CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit, CPDF_Point(0.0f,0.0f));
if (sEdit.GetLength() > 0)
{
sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n";
}
-
IFX_Edit::DelEdit(pEdit);
}
@@ -681,9 +679,8 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox,
const FX_FLOAT fAutoFontScale = 1.0f / 3.0f;
if (IFX_Edit * pEdit = IFX_Edit::NewEdit())
- {
+ {
pEdit->SetFontMap(pFontMap);
-
pEdit->SetAlignmentH(1);
pEdit->SetAlignmentV(1);
pEdit->SetMultiLine(FALSE);
@@ -692,11 +689,11 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox,
pEdit->SetAutoFontSize(TRUE);
else
pEdit->SetFontSize(fFontSize);
+
pEdit->Initialize();
- pEdit->SetText(sLabel);
+ pEdit->SetText(sLabel.c_str());
CPDF_Rect rcLabelContent = pEdit->GetContentRect();
-
CPWL_Icon Icon;
PWL_CREATEPARAM cp;
cp.dwFlags = PWS_VISIBLE;