summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_list_box.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-06-29 11:18:49 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-06-29 15:40:59 +0000
commitf1eae2c37cb4bbf7a536cf251706147bbac51880 (patch)
tree8eead543163dddefc63a518d9d44b5ca1ee49875 /fpdfsdk/pdfwindow/cpwl_list_box.cpp
parenta0b48aa8043be95e5c6b602e0e261fb163282536 (diff)
downloadpdfium-f1eae2c37cb4bbf7a536cf251706147bbac51880.tar.xz
Converted low-hanging cpwl classes in CFX_ByteTextBuf to ostringstream.
Bug: pdfium:731 Change-Id: I3faf5a4ec4b2af6145348e526f39ccbc2055e62e Reviewed-on: https://pdfium-review.googlesource.com/7050 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_list_box.cpp')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_list_box.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.cpp b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
index 5c161bfdda..f612c2945b 100644
--- a/fpdfsdk/pdfwindow/cpwl_list_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
@@ -6,6 +6,8 @@
#include "fpdfsdk/pdfwindow/cpwl_list_box.h"
+#include <sstream>
+
#include "fpdfsdk/fxedit/fxet_edit.h"
#include "fpdfsdk/fxedit/fxet_list.h"
#include "fpdfsdk/pdfwindow/cpwl_edit.h"
@@ -95,10 +97,10 @@ void CPWL_ListBox::OnDestroy() {
m_pListNotify.reset();
}
-void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
- CPWL_Wnd::GetThisAppearanceStream(sAppStream);
+void CPWL_ListBox::GetThisAppearanceStream(std::ostringstream* psAppStream) {
+ CPWL_Wnd::GetThisAppearanceStream(psAppStream);
- CFX_ByteTextBuf sListItems;
+ std::ostringstream sListItems;
CFX_FloatRect rcPlate = m_pList->GetPlateRect();
for (int32_t i = 0, sz = m_pList->GetCount(); i < sz; i++) {
@@ -110,40 +112,36 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
if (m_pList->IsItemSelected(i)) {
sListItems << CPWL_Utils::GetRectFillAppStream(rcItem,
- PWL_DEFAULT_SELBACKCOLOR)
- .AsStringC();
+ PWL_DEFAULT_SELBACKCOLOR);
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
<< CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELTEXTCOLOR)
- .AsStringC()
- << sItem.AsStringC() << "ET\n";
+ << sItem << "ET\n";
}
} else {
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
- << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC()
- << sItem.AsStringC() << "ET\n";
+ << CPWL_Utils::GetColorAppStream(GetTextColor()) << sItem
+ << "ET\n";
}
}
}
- if (sListItems.GetLength() > 0) {
- CFX_ByteTextBuf sClip;
- CFX_FloatRect rcClient = GetClientRect();
-
- sClip << "q\n";
- sClip << rcClient.left << " " << rcClient.bottom << " "
- << rcClient.right - rcClient.left << " "
- << rcClient.top - rcClient.bottom << " re W n\n";
-
- sClip << sListItems << "Q\n";
+ if (sListItems.tellp() <= 0)
+ return;
- sAppStream << "/Tx BMC\n" << sClip << "EMC\n";
- }
+ CFX_FloatRect rcClient = GetClientRect();
+ *psAppStream << "/Tx BMC\n"
+ << "q\n"
+ << rcClient.left << " " << rcClient.bottom << " "
+ << rcClient.right - rcClient.left << " "
+ << rcClient.top - rcClient.bottom << " re W n\n"
+ << sListItems.str() << "Q\n"
+ << "EMC\n";
}
void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,