diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2017-06-29 11:18:49 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-29 15:40:59 +0000 |
commit | f1eae2c37cb4bbf7a536cf251706147bbac51880 (patch) | |
tree | 8eead543163dddefc63a518d9d44b5ca1ee49875 /fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp | |
parent | a0b48aa8043be95e5c6b602e0e261fb163282536 (diff) | |
download | pdfium-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_scroll_bar.cpp')
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp | 83 |
1 files changed, 35 insertions, 48 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp index 2f234b2432..33bdedbf2f 100644 --- a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp +++ b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp @@ -6,6 +6,8 @@ #include "fpdfsdk/pdfwindow/cpwl_scroll_bar.h" +#include <sstream> + #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" #include "fpdfsdk/pdfwindow/cpwl_utils.h" @@ -122,20 +124,17 @@ void CPWL_SBButton::OnCreate(PWL_CREATEPARAM& cp) { cp.eCursorType = FXCT_ARROW; } -void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { - CPWL_Wnd::GetThisAppearanceStream(sAppStream); +void CPWL_SBButton::GetThisAppearanceStream(std::ostringstream* psAppStream) { + CPWL_Wnd::GetThisAppearanceStream(psAppStream); if (!IsVisible()) return; - CFX_ByteTextBuf sButton; - CFX_FloatRect rectWnd = GetWindowRect(); - if (rectWnd.IsEmpty()) return; - sAppStream << "q\n"; + *psAppStream << "q\n"; CFX_PointF ptCenter = GetCenterPoint(); @@ -151,13 +150,11 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { - sButton << "0 g\n"; - sButton << pt1.x << " " << pt1.y << " m\n"; - sButton << pt2.x << " " << pt2.y << " l\n"; - sButton << pt3.x << " " << pt3.y << " l\n"; - sButton << pt1.x << " " << pt1.y << " l f\n"; - - sAppStream << sButton; + *psAppStream << "0 g\n" + << pt1.x << " " << pt1.y << " m\n" + << pt2.x << " " << pt2.y << " l\n" + << pt3.x << " " << pt3.y << " l\n" + << pt1.x << " " << pt1.y << " l f\n"; } } break; case PSBT_MAX: { @@ -169,13 +166,11 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { - sButton << "0 g\n"; - sButton << pt1.x << " " << pt1.y << " m\n"; - sButton << pt2.x << " " << pt2.y << " l\n"; - sButton << pt3.x << " " << pt3.y << " l\n"; - sButton << pt1.x << " " << pt1.y << " l f\n"; - - sAppStream << sButton; + *psAppStream << "0 g\n" + << pt1.x << " " << pt1.y << " m\n" + << pt2.x << " " << pt2.y << " l\n" + << pt3.x << " " << pt3.y << " l\n" + << pt1.x << " " << pt1.y << " l f\n"; } } break; default: @@ -193,13 +188,11 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { - sButton << "0 g\n"; - sButton << pt1.x << " " << pt1.y << " m\n"; - sButton << pt2.x << " " << pt2.y << " l\n"; - sButton << pt3.x << " " << pt3.y << " l\n"; - sButton << pt1.x << " " << pt1.y << " l f\n"; - - sAppStream << sButton; + *psAppStream << "0 g\n" + << pt1.x << " " << pt1.y << " m\n" + << pt2.x << " " << pt2.y << " l\n" + << pt3.x << " " << pt3.y << " l\n" + << pt1.x << " " << pt1.y << " l f\n"; } } break; case PSBT_MAX: { @@ -211,13 +204,11 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (rectWnd.right - rectWnd.left > PWL_TRIANGLE_HALFLEN * 2 && rectWnd.top - rectWnd.bottom > PWL_TRIANGLE_HALFLEN) { - sButton << "0 g\n"; - sButton << pt1.x << " " << pt1.y << " m\n"; - sButton << pt2.x << " " << pt2.y << " l\n"; - sButton << pt3.x << " " << pt3.y << " l\n"; - sButton << pt1.x << " " << pt1.y << " l f\n"; - - sAppStream << sButton; + *psAppStream << "0 g\n" + << pt1.x << " " << pt1.y << " m\n" + << pt2.x << " " << pt2.y << " l\n" + << pt3.x << " " << pt3.y << " l\n" + << pt1.x << " " << pt1.y << " l f\n"; } } break; default: @@ -228,7 +219,7 @@ void CPWL_SBButton::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { break; } - sAppStream << "Q\n"; + *psAppStream << "Q\n"; } void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, @@ -652,22 +643,18 @@ void CPWL_ScrollBar::RePosChildWnd() { MovePosButton(false); } -void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { +void CPWL_ScrollBar::GetThisAppearanceStream(std::ostringstream* psAppStream) { CFX_FloatRect rectWnd = GetWindowRect(); - if (IsVisible() && !rectWnd.IsEmpty()) { - CFX_ByteTextBuf sButton; - - sButton << "q\n"; - sButton << "0 w\n" - << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), true) - .AsStringC(); - sButton << rectWnd.left << " " << rectWnd.bottom << " " - << rectWnd.right - rectWnd.left << " " - << rectWnd.top - rectWnd.bottom << " re b Q\n"; + if (!IsVisible() || rectWnd.IsEmpty()) + return; - sAppStream << sButton; - } + *psAppStream << "q\n" + << "0 w\n" + << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), true) + << rectWnd.left << " " << rectWnd.bottom << " " + << rectWnd.right - rectWnd.left << " " + << rectWnd.top - rectWnd.bottom << " re b Q\n"; } void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice, |