summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_color.cpp176
-rw-r--r--fpdfsdk/pdfwindow/cpwl_color.h57
-rw-r--r--fpdfsdk/pdfwindow/cpwl_combo_box.cpp4
-rw-r--r--fpdfsdk/pdfwindow/cpwl_edit.cpp2
-rw-r--r--fpdfsdk/pdfwindow/cpwl_list_box.cpp2
-rw-r--r--fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp2
-rw-r--r--fpdfsdk/pdfwindow/cpwl_utils.cpp54
-rw-r--r--fpdfsdk/pdfwindow/cpwl_utils.h55
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.cpp24
-rw-r--r--fpdfsdk/pdfwindow/cpwl_wnd.h32
10 files changed, 87 insertions, 321 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_color.cpp b/fpdfsdk/pdfwindow/cpwl_color.cpp
deleted file mode 100644
index 689c3dec45..0000000000
--- a/fpdfsdk/pdfwindow/cpwl_color.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "fpdfsdk/pdfwindow/cpwl_color.h"
-
-#include <algorithm>
-
-namespace {
-
-bool InRange(float comp) {
- return comp >= 0.0f && comp <= 1.0f;
-}
-
-CPWL_Color ConvertCMYK2GRAY(float dC, float dM, float dY, float dK) {
- if (!InRange(dC) || !InRange(dM) || !InRange(dY) || !InRange(dK))
- return CPWL_Color(COLORTYPE_GRAY);
- return CPWL_Color(
- COLORTYPE_GRAY,
- 1.0f - std::min(1.0f, 0.3f * dC + 0.59f * dM + 0.11f * dY + dK));
-}
-
-CPWL_Color ConvertGRAY2CMYK(float dGray) {
- if (!InRange(dGray))
- return CPWL_Color(COLORTYPE_CMYK);
- return CPWL_Color(COLORTYPE_CMYK, 0.0f, 0.0f, 0.0f, 1.0f - dGray);
-}
-
-CPWL_Color ConvertGRAY2RGB(float dGray) {
- if (!InRange(dGray))
- return CPWL_Color(COLORTYPE_RGB);
- return CPWL_Color(COLORTYPE_RGB, dGray, dGray, dGray);
-}
-
-CPWL_Color ConvertRGB2GRAY(float dR, float dG, float dB) {
- if (!InRange(dR) || !InRange(dG) || !InRange(dB))
- return CPWL_Color(COLORTYPE_GRAY);
- return CPWL_Color(COLORTYPE_GRAY, 0.3f * dR + 0.59f * dG + 0.11f * dB);
-}
-
-CPWL_Color ConvertCMYK2RGB(float dC, float dM, float dY, float dK) {
- if (!InRange(dC) || !InRange(dM) || !InRange(dY) || !InRange(dK))
- return CPWL_Color(COLORTYPE_RGB);
- return CPWL_Color(COLORTYPE_RGB, 1.0f - std::min(1.0f, dC + dK),
- 1.0f - std::min(1.0f, dM + dK),
- 1.0f - std::min(1.0f, dY + dK));
-}
-
-CPWL_Color ConvertRGB2CMYK(float dR, float dG, float dB) {
- if (!InRange(dR) || !InRange(dG) || !InRange(dB))
- return CPWL_Color(COLORTYPE_CMYK);
-
- float c = 1.0f - dR;
- float m = 1.0f - dG;
- float y = 1.0f - dB;
- return CPWL_Color(COLORTYPE_CMYK, c, m, y, std::min(c, std::min(m, y)));
-}
-
-} // namespace
-
-CPWL_Color CPWL_Color::ConvertColorType(int32_t nConvertColorType) const {
- if (nColorType == nConvertColorType)
- return *this;
-
- CPWL_Color ret;
- switch (nColorType) {
- case COLORTYPE_TRANSPARENT:
- ret = *this;
- ret.nColorType = COLORTYPE_TRANSPARENT;
- break;
- case COLORTYPE_GRAY:
- switch (nConvertColorType) {
- case COLORTYPE_RGB:
- ret = ConvertGRAY2RGB(fColor1);
- break;
- case COLORTYPE_CMYK:
- ret = ConvertGRAY2CMYK(fColor1);
- break;
- }
- break;
- case COLORTYPE_RGB:
- switch (nConvertColorType) {
- case COLORTYPE_GRAY:
- ret = ConvertRGB2GRAY(fColor1, fColor2, fColor3);
- break;
- case COLORTYPE_CMYK:
- ret = ConvertRGB2CMYK(fColor1, fColor2, fColor3);
- break;
- }
- break;
- case COLORTYPE_CMYK:
- switch (nConvertColorType) {
- case COLORTYPE_GRAY:
- ret = ConvertCMYK2GRAY(fColor1, fColor2, fColor3, fColor4);
- break;
- case COLORTYPE_RGB:
- ret = ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4);
- break;
- }
- break;
- }
- return ret;
-}
-
-FX_COLORREF CPWL_Color::ToFXColor(int32_t nTransparency) const {
- CPWL_Color ret;
- switch (nColorType) {
- case COLORTYPE_TRANSPARENT: {
- ret = CPWL_Color(COLORTYPE_TRANSPARENT, 0, 0, 0, 0);
- break;
- }
- case COLORTYPE_GRAY: {
- ret = ConvertGRAY2RGB(fColor1);
- ret.fColor4 = nTransparency;
- break;
- }
- case COLORTYPE_RGB: {
- ret = CPWL_Color(COLORTYPE_RGB, fColor1, fColor2, fColor3);
- ret.fColor4 = nTransparency;
- break;
- }
- case COLORTYPE_CMYK: {
- ret = ConvertCMYK2RGB(fColor1, fColor2, fColor3, fColor4);
- ret.fColor4 = nTransparency;
- break;
- }
- }
- return ArgbEncode(ret.fColor4, static_cast<int32_t>(ret.fColor1 * 255),
- static_cast<int32_t>(ret.fColor2 * 255),
- static_cast<int32_t>(ret.fColor3 * 255));
-}
-
-CPWL_Color CPWL_Color::operator-(float fColorSub) const {
- CPWL_Color sRet(nColorType);
- switch (nColorType) {
- case COLORTYPE_TRANSPARENT:
- sRet.nColorType = COLORTYPE_RGB;
- sRet.fColor1 = std::max(1.0f - fColorSub, 0.0f);
- sRet.fColor2 = std::max(1.0f - fColorSub, 0.0f);
- sRet.fColor3 = std::max(1.0f - fColorSub, 0.0f);
- break;
- case COLORTYPE_RGB:
- case COLORTYPE_GRAY:
- case COLORTYPE_CMYK:
- sRet.fColor1 = std::max(fColor1 - fColorSub, 0.0f);
- sRet.fColor2 = std::max(fColor2 - fColorSub, 0.0f);
- sRet.fColor3 = std::max(fColor3 - fColorSub, 0.0f);
- sRet.fColor4 = std::max(fColor4 - fColorSub, 0.0f);
- break;
- }
- return sRet;
-}
-
-CPWL_Color CPWL_Color::operator/(float fColorDivide) const {
- CPWL_Color sRet(nColorType);
- switch (nColorType) {
- case COLORTYPE_TRANSPARENT:
- sRet.nColorType = COLORTYPE_RGB;
- sRet.fColor1 = 1.0f / fColorDivide;
- sRet.fColor2 = 1.0f / fColorDivide;
- sRet.fColor3 = 1.0f / fColorDivide;
- break;
- case COLORTYPE_RGB:
- case COLORTYPE_GRAY:
- case COLORTYPE_CMYK:
- sRet = *this;
- sRet.fColor1 /= fColorDivide;
- sRet.fColor2 /= fColorDivide;
- sRet.fColor3 /= fColorDivide;
- sRet.fColor4 /= fColorDivide;
- break;
- }
- return sRet;
-}
diff --git a/fpdfsdk/pdfwindow/cpwl_color.h b/fpdfsdk/pdfwindow/cpwl_color.h
deleted file mode 100644
index 83e73efbf5..0000000000
--- a/fpdfsdk/pdfwindow/cpwl_color.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2017 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef FPDFSDK_PDFWINDOW_CPWL_COLOR_H_
-#define FPDFSDK_PDFWINDOW_CPWL_COLOR_H_
-
-#include "core/fpdfdoc/cpdf_formcontrol.h"
-#include "core/fxge/fx_dib.h"
-
-struct CPWL_Color {
- explicit CPWL_Color(FX_COLORREF ref)
- : CPWL_Color(FXARGB_R(ref), FXARGB_G(ref), FXARGB_B(ref)) {}
-
- CPWL_Color(int32_t type = COLORTYPE_TRANSPARENT,
- float color1 = 0.0f,
- float color2 = 0.0f,
- float color3 = 0.0f,
- float color4 = 0.0f)
- : nColorType(type),
- fColor1(color1),
- fColor2(color2),
- fColor3(color3),
- fColor4(color4) {}
-
- CPWL_Color(int32_t r, int32_t g, int32_t b)
- : nColorType(COLORTYPE_RGB),
- fColor1(r / 255.0f),
- fColor2(g / 255.0f),
- fColor3(b / 255.0f),
- fColor4(0) {}
-
- CPWL_Color operator/(float fColorDivide) const;
- CPWL_Color operator-(float fColorSub) const;
-
- CPWL_Color ConvertColorType(int32_t other_nColorType) const;
-
- FX_COLORREF ToFXColor(int32_t nTransparency) const;
-
- void Reset() {
- nColorType = COLORTYPE_TRANSPARENT;
- fColor1 = 0.0f;
- fColor2 = 0.0f;
- fColor3 = 0.0f;
- fColor4 = 0.0f;
- }
-
- int32_t nColorType;
- float fColor1;
- float fColor2;
- float fColor3;
- float fColor4;
-};
-
-#endif // FPDFSDK_PDFWINDOW_CPWL_COLOR_H_
diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
index 140aff84c0..d2afa3e8aa 100644
--- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp
@@ -299,8 +299,8 @@ void CPWL_ComboBox::CreateButton(const PWL_CREATEPARAM& cp) {
PWL_CREATEPARAM bcp = cp;
bcp.pParentWnd = this;
bcp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER | PWS_BACKGROUND;
- bcp.sBackgroundColor = CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f,
- 220.0f / 255.0f, 220.0f / 255.0f);
+ bcp.sBackgroundColor = CFX_Color(COLORTYPE_RGB, 220.0f / 255.0f,
+ 220.0f / 255.0f, 220.0f / 255.0f);
bcp.sBorderColor = PWL_DEFAULT_BLACKCOLOR;
bcp.dwBorderWidth = 2;
bcp.nBorderStyle = BorderStyle::BEVELED;
diff --git a/fpdfsdk/pdfwindow/cpwl_edit.cpp b/fpdfsdk/pdfwindow/cpwl_edit.cpp
index 8a788dd184..92b3f6498e 100644
--- a/fpdfsdk/pdfwindow/cpwl_edit.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_edit.cpp
@@ -295,7 +295,7 @@ void CPWL_Edit::GetThisAppearanceStream(std::ostringstream* psAppStream) {
if (sEditMid.GetLength() > 0)
sText << "BT\n"
- << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1))
+ << CPWL_Utils::GetColorAppStream(CFX_Color(COLORTYPE_GRAY, 1))
<< sEditMid << "ET\n";
wrTemp = wrVisible.Intersect(wrSelAfter);
diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.cpp b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
index 79559d33f0..4b4df33e39 100644
--- a/fpdfsdk/pdfwindow/cpwl_list_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
@@ -114,7 +114,7 @@ void CPWL_ListBox::GetThisAppearanceStream(std::ostringstream* psAppStream) {
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
<< CPWL_Utils::GetColorAppStream(
- CPWL_Color(COLORTYPE_RGB, 1, 1, 1))
+ CFX_Color(COLORTYPE_RGB, 1, 1, 1))
<< sItem << "ET\n";
}
} else {
diff --git a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
index cf5d42372a..491d0b3876 100644
--- a/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_scroll_bar.cpp
@@ -23,7 +23,7 @@ constexpr float kTriangleHalfLength = 2.0f;
} // namespace
-#define PWL_DEFAULT_HEAVYGRAYCOLOR CPWL_Color(COLORTYPE_GRAY, 0.50)
+#define PWL_DEFAULT_HEAVYGRAYCOLOR CFX_Color(COLORTYPE_GRAY, 0.50)
PWL_FLOATRANGE::PWL_FLOATRANGE() {
Default();
diff --git a/fpdfsdk/pdfwindow/cpwl_utils.cpp b/fpdfsdk/pdfwindow/cpwl_utils.cpp
index 238abe7488..c576044a69 100644
--- a/fpdfsdk/pdfwindow/cpwl_utils.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_utils.cpp
@@ -219,7 +219,7 @@ CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox,
}
CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect,
- const CPWL_Color& color) {
+ const CFX_Color& color) {
std::ostringstream sAppStream;
CFX_ByteString sColor = GetColorAppStream(color, true);
if (sColor.GetLength() > 0) {
@@ -233,7 +233,7 @@ CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect,
}
CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect,
- const CPWL_Color& color) {
+ const CFX_Color& color) {
std::ostringstream sAppStream;
CFX_ByteString sColor = GetColorAppStream(color, true);
if (sColor.GetLength() > 0)
@@ -261,7 +261,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
CPDF_Stream* pIconStream,
CPDF_IconFit& IconFit,
const CFX_WideString& sLabel,
- const CPWL_Color& crText,
+ const CFX_Color& crText,
float fFontSize,
int32_t nLayOut) {
const float fAutoFontScale = 1.0f / 3.0f;
@@ -456,7 +456,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
return CFX_ByteString(sAppStream);
}
-CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color,
+CFX_ByteString CPWL_Utils::GetColorAppStream(const CFX_Color& color,
const bool& bFillOrStroke) {
std::ostringstream sColorStream;
@@ -482,9 +482,9 @@ CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color,
CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect,
float fWidth,
- const CPWL_Color& color,
- const CPWL_Color& crLeftTop,
- const CPWL_Color& crRightBottom,
+ const CFX_Color& color,
+ const CFX_Color& crLeftTop,
+ const CFX_Color& crRightBottom,
BorderStyle nStyle,
const CPWL_Dash& dash) {
std::ostringstream sAppStream;
@@ -599,9 +599,9 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect,
CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(
const CFX_FloatRect& rect,
float fWidth,
- const CPWL_Color& color,
- const CPWL_Color& crLeftTop,
- const CPWL_Color& crRightBottom,
+ const CFX_Color& color,
+ const CFX_Color& crLeftTop,
+ const CFX_Color& crRightBottom,
BorderStyle nStyle,
const CPWL_Dash& dash) {
std::ostringstream sAppStream;
@@ -710,7 +710,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream(
}
CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText) {
+ const CFX_Color& crText) {
std::ostringstream sAP;
sAP << "q\n"
<< CPWL_Utils::GetColorAppStream(crText, true)
@@ -719,7 +719,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox,
}
CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText) {
+ const CFX_Color& crText) {
std::ostringstream sAP;
sAP << "q\n"
<< CPWL_Utils::GetColorAppStream(crText, true)
@@ -728,7 +728,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox,
}
CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText) {
+ const CFX_Color& crText) {
std::ostringstream sAP;
sAP << "q\n"
<< CPWL_Utils::GetColorAppStream(crText, false)
@@ -737,7 +737,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox,
}
CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText) {
+ const CFX_Color& crText) {
std::ostringstream sAP;
sAP << "q\n1 w\n"
<< CPWL_Utils::GetColorAppStream(crText, true)
@@ -746,7 +746,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
}
CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText) {
+ const CFX_Color& crText) {
std::ostringstream sAP;
sAP << "q\n"
<< CPWL_Utils::GetColorAppStream(crText, true)
@@ -755,7 +755,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox,
}
CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText) {
+ const CFX_Color& crText) {
std::ostringstream sAP;
sAP << "q\n"
<< CPWL_Utils::GetColorAppStream(crText, true)
@@ -765,7 +765,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox,
CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
int32_t nStyle,
- const CPWL_Color& crText) {
+ const CFX_Color& crText) {
CFX_FloatRect rcCenter = rcBBox.GetCenterSquare();
switch (nStyle) {
default:
@@ -790,7 +790,7 @@ CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
CFX_ByteString CPWL_Utils::GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
int32_t nStyle,
- const CPWL_Color& crText) {
+ const CFX_Color& crText) {
CFX_FloatRect rcCenter = rcBBox.GetCenterSquare();
switch (nStyle) {
default:
@@ -820,8 +820,8 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {
std::ostringstream sAppStream;
sAppStream << "q\n"
<< CPWL_Utils::GetColorAppStream(
- CPWL_Color(COLORTYPE_RGB, 220.0f / 255.0f, 220.0f / 255.0f,
- 220.0f / 255.0f),
+ CFX_Color(COLORTYPE_RGB, 220.0f / 255.0f, 220.0f / 255.0f,
+ 220.0f / 255.0f),
true)
<< rcBBox.left << " " << rcBBox.bottom << " "
<< rcBBox.right - rcBBox.left << " " << rcBBox.top - rcBBox.bottom
@@ -830,9 +830,9 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) {
sAppStream << "q\n"
<< CPWL_Utils::GetBorderAppStream(
- rcBBox, 2, CPWL_Color(COLORTYPE_GRAY, 0),
- CPWL_Color(COLORTYPE_GRAY, 1),
- CPWL_Color(COLORTYPE_GRAY, 0.5), BorderStyle::BEVELED,
+ rcBBox, 2, CFX_Color(COLORTYPE_GRAY, 0),
+ CFX_Color(COLORTYPE_GRAY, 1),
+ CFX_Color(COLORTYPE_GRAY, 0.5), BorderStyle::BEVELED,
CPWL_Dash(3, 0, 0))
<< "Q\n";
@@ -909,7 +909,7 @@ void CPWL_Utils::DrawStrokeLine(CFX_RenderDevice* pDevice,
void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
- const CPWL_Color& color,
+ const CFX_Color& color,
int32_t nTransparency) {
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rect,
color.ToFXColor(nTransparency));
@@ -954,9 +954,9 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
float fWidth,
- const CPWL_Color& color,
- const CPWL_Color& crLeftTop,
- const CPWL_Color& crRightBottom,
+ const CFX_Color& color,
+ const CFX_Color& crLeftTop,
+ const CFX_Color& crRightBottom,
BorderStyle nStyle,
int32_t nTransparency) {
float fLeft = rect.left;
diff --git a/fpdfsdk/pdfwindow/cpwl_utils.h b/fpdfsdk/pdfwindow/cpwl_utils.h
index 8d2a47a34e..70680c71d9 100644
--- a/fpdfsdk/pdfwindow/cpwl_utils.h
+++ b/fpdfsdk/pdfwindow/cpwl_utils.h
@@ -11,7 +11,7 @@
#include "fpdfsdk/pdfwindow/cpwl_wnd.h"
class CFX_Edit;
-struct CPWL_Color;
+struct CFX_Color;
// checkbox & radiobutton style
#define PCS_CHECK 0
@@ -32,41 +32,40 @@ struct CPWL_Color;
class CPWL_Utils {
public:
- static CFX_ByteString GetColorAppStream(const CPWL_Color& color,
+ static CFX_ByteString GetColorAppStream(const CFX_Color& color,
const bool& bFillOrStroke = true);
static CFX_ByteString GetBorderAppStream(const CFX_FloatRect& rect,
float fWidth,
- const CPWL_Color& color,
- const CPWL_Color& crLeftTop,
- const CPWL_Color& crRightBottom,
+ const CFX_Color& color,
+ const CFX_Color& crLeftTop,
+ const CFX_Color& crRightBottom,
BorderStyle nStyle,
const CPWL_Dash& dash);
- static CFX_ByteString GetCircleBorderAppStream(
- const CFX_FloatRect& rect,
- float fWidth,
- const CPWL_Color& color,
- const CPWL_Color& crLeftTop,
- const CPWL_Color& crRightBottom,
- BorderStyle nStyle,
- const CPWL_Dash& dash);
+ static CFX_ByteString GetCircleBorderAppStream(const CFX_FloatRect& rect,
+ float fWidth,
+ const CFX_Color& color,
+ const CFX_Color& crLeftTop,
+ const CFX_Color& crRightBottom,
+ BorderStyle nStyle,
+ const CPWL_Dash& dash);
static CFX_ByteString GetRectFillAppStream(const CFX_FloatRect& rect,
- const CPWL_Color& color);
+ const CFX_Color& color);
static CFX_ByteString GetCircleFillAppStream(const CFX_FloatRect& rect,
- const CPWL_Color& color);
+ const CFX_Color& color);
static CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
IPVT_FontMap* pFontMap,
CPDF_Stream* pIconStream,
CPDF_IconFit& IconFit,
const CFX_WideString& sLabel,
- const CPWL_Color& crText,
+ const CFX_Color& crText,
float fFontSize,
int32_t nLayOut);
static CFX_ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox,
int32_t nStyle,
- const CPWL_Color& crText);
+ const CFX_Color& crText);
static CFX_ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox,
int32_t nStyle,
- const CPWL_Color& crText);
+ const CFX_Color& crText);
static CFX_ByteString GetEditAppStream(CFX_Edit* pEdit,
const CFX_PointF& ptOffset,
const CPVT_WordRange* pRange = nullptr,
@@ -81,7 +80,7 @@ class CPWL_Utils {
static void DrawFillRect(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
- const CPWL_Color& color,
+ const CFX_Color& color,
int32_t nTransparency);
static void DrawFillRect(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
@@ -102,9 +101,9 @@ class CPWL_Utils {
CFX_Matrix* pUser2Device,
const CFX_FloatRect& rect,
float fWidth,
- const CPWL_Color& color,
- const CPWL_Color& crLeftTop,
- const CPWL_Color& crRightBottom,
+ const CFX_Color& color,
+ const CFX_Color& crLeftTop,
+ const CFX_Color& crRightBottom,
BorderStyle nStyle,
int32_t nTransparency);
static void DrawFillArea(CFX_RenderDevice* pDevice,
@@ -123,17 +122,17 @@ class CPWL_Utils {
private:
static CFX_ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText);
+ const CFX_Color& crText);
static CFX_ByteString GetAppStream_Circle(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText);
+ const CFX_Color& crText);
static CFX_ByteString GetAppStream_Cross(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText);
+ const CFX_Color& crText);
static CFX_ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText);
+ const CFX_Color& crText);
static CFX_ByteString GetAppStream_Square(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText);
+ const CFX_Color& crText);
static CFX_ByteString GetAppStream_Star(const CFX_FloatRect& rcBBox,
- const CPWL_Color& crText);
+ const CFX_Color& crText);
static CFX_ByteString GetAP_Check(const CFX_FloatRect& crBBox);
static CFX_ByteString GetAP_Circle(const CFX_FloatRect& crBBox);
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.cpp b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
index 552c901f06..5aae2dfa92 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.cpp
@@ -500,15 +500,15 @@ void CPWL_Wnd::AddFlag(uint32_t dwFlags) {
m_sPrivateParam.dwFlags |= dwFlags;
}
-CPWL_Color CPWL_Wnd::GetBackgroundColor() const {
+CFX_Color CPWL_Wnd::GetBackgroundColor() const {
return m_sPrivateParam.sBackgroundColor;
}
-void CPWL_Wnd::SetBackgroundColor(const CPWL_Color& color) {
+void CPWL_Wnd::SetBackgroundColor(const CFX_Color& color) {
m_sPrivateParam.sBackgroundColor = color;
}
-CPWL_Color CPWL_Wnd::GetTextColor() const {
+CFX_Color CPWL_Wnd::GetTextColor() const {
return m_sPrivateParam.sTextColor;
}
@@ -529,8 +529,8 @@ int32_t CPWL_Wnd::GetInnerBorderWidth() const {
return 0;
}
-CPWL_Color CPWL_Wnd::GetBorderColor() const {
- return HasFlag(PWS_BORDER) ? m_sPrivateParam.sBorderColor : CPWL_Color();
+CFX_Color CPWL_Wnd::GetBorderColor() const {
+ return HasFlag(PWS_BORDER) ? m_sPrivateParam.sBorderColor : CFX_Color();
}
const CPWL_Dash& CPWL_Wnd::GetBorderDash() const {
@@ -737,25 +737,25 @@ IPVT_FontMap* CPWL_Wnd::GetFontMap() const {
return m_sPrivateParam.pFontMap;
}
-CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(BorderStyle nBorderStyle) const {
+CFX_Color CPWL_Wnd::GetBorderLeftTopColor(BorderStyle nBorderStyle) const {
switch (nBorderStyle) {
case BorderStyle::BEVELED:
- return CPWL_Color(COLORTYPE_GRAY, 1);
+ return CFX_Color(COLORTYPE_GRAY, 1);
case BorderStyle::INSET:
- return CPWL_Color(COLORTYPE_GRAY, 0.5f);
+ return CFX_Color(COLORTYPE_GRAY, 0.5f);
default:
- return CPWL_Color();
+ return CFX_Color();
}
}
-CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(BorderStyle nBorderStyle) const {
+CFX_Color CPWL_Wnd::GetBorderRightBottomColor(BorderStyle nBorderStyle) const {
switch (nBorderStyle) {
case BorderStyle::BEVELED:
return GetBackgroundColor() / 2.0f;
case BorderStyle::INSET:
- return CPWL_Color(COLORTYPE_GRAY, 0.75f);
+ return CFX_Color(COLORTYPE_GRAY, 0.75f);
default:
- return CPWL_Color();
+ return CFX_Color();
}
}
diff --git a/fpdfsdk/pdfwindow/cpwl_wnd.h b/fpdfsdk/pdfwindow/cpwl_wnd.h
index 2689a10393..2b76a058fe 100644
--- a/fpdfsdk/pdfwindow/cpwl_wnd.h
+++ b/fpdfsdk/pdfwindow/cpwl_wnd.h
@@ -14,8 +14,8 @@
#include "core/fxcrt/cfx_observable.h"
#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
+#include "core/fxge/cfx_color.h"
#include "fpdfsdk/cpdfsdk_widget.h"
-#include "fpdfsdk/pdfwindow/cpwl_color.h"
#include "fpdfsdk/pdfwindow/cpwl_timer.h"
#include "fpdfsdk/pdfwindow/cpwl_timer_handler.h"
@@ -83,7 +83,7 @@ struct CPWL_Dash {
int32_t nPhase;
};
-inline bool operator==(const CPWL_Color& c1, const CPWL_Color& c2) {
+inline bool operator==(const CFX_Color& c1, const CFX_Color& c2) {
return c1.nColorType == c2.nColorType && c1.fColor1 - c2.fColor1 < 0.0001 &&
c1.fColor1 - c2.fColor1 > -0.0001 &&
c1.fColor2 - c2.fColor2 < 0.0001 &&
@@ -93,16 +93,16 @@ inline bool operator==(const CPWL_Color& c1, const CPWL_Color& c2) {
c1.fColor4 - c2.fColor4 < 0.0001 && c1.fColor4 - c2.fColor4 > -0.0001;
}
-inline bool operator!=(const CPWL_Color& c1, const CPWL_Color& c2) {
+inline bool operator!=(const CFX_Color& c1, const CFX_Color& c2) {
return !(c1 == c2);
}
#define PWL_SCROLLBAR_WIDTH 12.0f
#define PWL_SCROLLBAR_TRANSPARENCY 150
#define PWL_DEFAULT_SELBACKCOLOR \
- CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f)
-#define PWL_DEFAULT_BLACKCOLOR CPWL_Color(COLORTYPE_GRAY, 0)
-#define PWL_DEFAULT_WHITECOLOR CPWL_Color(COLORTYPE_GRAY, 1)
+ CFX_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f)
+#define PWL_DEFAULT_BLACKCOLOR CFX_Color(COLORTYPE_GRAY, 0)
+#define PWL_DEFAULT_WHITECOLOR CFX_Color(COLORTYPE_GRAY, 1)
class IPWL_Provider : public CFX_Observable<IPWL_Provider> {
public:
@@ -152,12 +152,12 @@ struct PWL_CREATEPARAM {
IPWL_Provider::ObservedPtr pProvider; // required
IPWL_FocusHandler* pFocusHandler; // optional
uint32_t dwFlags; // optional
- CPWL_Color sBackgroundColor; // optional
+ CFX_Color sBackgroundColor; // optional
CPDFSDK_Widget::ObservedPtr pAttachedWidget; // required
BorderStyle nBorderStyle; // optional
int32_t dwBorderWidth; // optional
- CPWL_Color sBorderColor; // optional
- CPWL_Color sTextColor; // optional
+ CFX_Color sBorderColor; // optional
+ CFX_Color sTextColor; // optional
int32_t nTransparency; // optional
float fFontSize; // optional
CPWL_Dash sDash; // optional
@@ -215,13 +215,13 @@ class CPWL_Wnd : public CPWL_TimerHandler {
void DrawAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device);
- CPWL_Color GetBackgroundColor() const;
- void SetBackgroundColor(const CPWL_Color& color);
- CPWL_Color GetBorderColor() const;
- CPWL_Color GetTextColor() const;
- void SetTextColor(const CPWL_Color& color);
- CPWL_Color GetBorderLeftTopColor(BorderStyle nBorderStyle) const;
- CPWL_Color GetBorderRightBottomColor(BorderStyle nBorderStyle) const;
+ CFX_Color GetBackgroundColor() const;
+ void SetBackgroundColor(const CFX_Color& color);
+ CFX_Color GetBorderColor() const;
+ CFX_Color GetTextColor() const;
+ void SetTextColor(const CFX_Color& color);
+ CFX_Color GetBorderLeftTopColor(BorderStyle nBorderStyle) const;
+ CFX_Color GetBorderRightBottomColor(BorderStyle nBorderStyle) const;
void SetBorderStyle(BorderStyle eBorderStyle);
BorderStyle GetBorderStyle() const;