summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cpdfsdk_widget.cpp132
-rw-r--r--fpdfsdk/cpdfsdk_widget.h8
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp8
-rw-r--r--fpdfsdk/javascript/Field.cpp60
-rw-r--r--fpdfsdk/javascript/Field.h12
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp4
-rw-r--r--fpdfsdk/javascript/color.cpp46
-rw-r--r--fpdfsdk/javascript/color.h32
-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
18 files changed, 236 insertions, 474 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index fc56d7e45b..b0f3c3468b 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -889,22 +889,22 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
break;
}
- CPWL_Color crBackground;
- CPWL_Color crBorder;
+ CFX_Color crBackground;
+ CFX_Color crBorder;
int iColorType;
float fc[4];
pControl->GetOriginalBackgroundColor(iColorType, fc);
if (iColorType > 0)
- crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crBackground = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
pControl->GetOriginalBorderColor(iColorType, fc);
if (iColorType > 0)
- crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crBorder = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
float fBorderWidth = (float)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
- CPWL_Color crLeftTop;
- CPWL_Color crRightBottom;
+ CFX_Color crLeftTop;
+ CFX_Color crRightBottom;
BorderStyle nBorderStyle = GetBorderStyle();
switch (nBorderStyle) {
@@ -913,13 +913,13 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
break;
case BorderStyle::BEVELED:
fBorderWidth *= 2;
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 1);
crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5);
- crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 0.5);
+ crRightBottom = CFX_Color(COLORTYPE_GRAY, 0.75);
break;
default:
break;
@@ -931,13 +931,13 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
rcClient.Normalize();
}
- CPWL_Color crText(COLORTYPE_GRAY, 0);
+ CFX_Color crText(COLORTYPE_GRAY, 0);
CFX_ByteString csNameTag;
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
- crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crText = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
}
float fFontSize = 12.0f;
if (da.HasFont())
@@ -1036,14 +1036,14 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
switch (nBorderStyle) {
case BorderStyle::BEVELED: {
- CPWL_Color crTemp = crLeftTop;
+ CFX_Color crTemp = crLeftTop;
crLeftTop = crRightBottom;
crRightBottom = crTemp;
break;
}
case BorderStyle::INSET: {
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0);
- crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 0);
+ crRightBottom = CFX_Color(COLORTYPE_GRAY, 1);
break;
}
default:
@@ -1071,21 +1071,21 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() {
void CPDFSDK_Widget::ResetAppearance_CheckBox() {
CPDF_FormControl* pControl = GetFormControl();
- CPWL_Color crBackground, crBorder, crText;
+ CFX_Color crBackground, crBorder, crText;
int iColorType;
float fc[4];
pControl->GetOriginalBackgroundColor(iColorType, fc);
if (iColorType > 0)
- crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crBackground = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
pControl->GetOriginalBorderColor(iColorType, fc);
if (iColorType > 0)
- crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crBorder = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
float fBorderWidth = (float)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
- CPWL_Color crLeftTop, crRightBottom;
+ CFX_Color crLeftTop, crRightBottom;
BorderStyle nBorderStyle = GetBorderStyle();
switch (nBorderStyle) {
@@ -1094,13 +1094,13 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
break;
case BorderStyle::BEVELED:
fBorderWidth *= 2;
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 1);
crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5);
- crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 0.5);
+ crRightBottom = CFX_Color(COLORTYPE_GRAY, 0.75);
break;
default:
break;
@@ -1116,7 +1116,7 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
- crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crText = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
}
int32_t nStyle = 0;
@@ -1156,14 +1156,14 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
switch (nBorderStyle) {
case BorderStyle::BEVELED: {
- CPWL_Color crTemp = crLeftTop;
+ CFX_Color crTemp = crLeftTop;
crLeftTop = crRightBottom;
crRightBottom = crTemp;
break;
}
case BorderStyle::INSET: {
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0);
- crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 0);
+ crRightBottom = CFX_Color(COLORTYPE_GRAY, 1);
break;
}
default:
@@ -1196,22 +1196,22 @@ void CPDFSDK_Widget::ResetAppearance_CheckBox() {
void CPDFSDK_Widget::ResetAppearance_RadioButton() {
CPDF_FormControl* pControl = GetFormControl();
- CPWL_Color crBackground, crBorder, crText;
+ CFX_Color crBackground, crBorder, crText;
int iColorType;
float fc[4];
pControl->GetOriginalBackgroundColor(iColorType, fc);
if (iColorType > 0)
- crBackground = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crBackground = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
pControl->GetOriginalBorderColor(iColorType, fc);
if (iColorType > 0)
- crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crBorder = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
float fBorderWidth = (float)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
- CPWL_Color crLeftTop;
- CPWL_Color crRightBottom;
+ CFX_Color crLeftTop;
+ CFX_Color crRightBottom;
BorderStyle nBorderStyle = GetBorderStyle();
switch (nBorderStyle) {
case BorderStyle::DASH:
@@ -1219,13 +1219,13 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
break;
case BorderStyle::BEVELED:
fBorderWidth *= 2;
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 1);
crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5);
- crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 0.5);
+ crRightBottom = CFX_Color(COLORTYPE_GRAY, 0.75);
break;
default:
break;
@@ -1241,7 +1241,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
CPDF_DefaultAppearance da = pControl->GetDefaultAppearance();
if (da.HasColor()) {
da.GetColor(iColorType, fc);
- crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crText = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
}
int32_t nStyle = 0;
@@ -1281,11 +1281,11 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
if (nStyle == PCS_CIRCLE) {
if (nBorderStyle == BorderStyle::BEVELED) {
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 1);
crRightBottom = crBackground - 0.25f;
} else if (nBorderStyle == BorderStyle::INSET) {
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5f);
- crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75f);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 0.5f);
+ crRightBottom = CFX_Color(COLORTYPE_GRAY, 0.75f);
}
csAP_N_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter, crBackground) +
@@ -1303,14 +1303,14 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
switch (nBorderStyle) {
case BorderStyle::BEVELED: {
- CPWL_Color crTemp = crLeftTop;
+ CFX_Color crTemp = crLeftTop;
crLeftTop = crRightBottom;
crRightBottom = crTemp;
break;
}
case BorderStyle::INSET: {
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0);
- crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 0);
+ crRightBottom = CFX_Color(COLORTYPE_GRAY, 1);
break;
}
default:
@@ -1320,14 +1320,14 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
CFX_ByteString csAP_D_ON;
if (nStyle == PCS_CIRCLE) {
- CPWL_Color crBK = crBackground - 0.25f;
+ CFX_Color crBK = crBackground - 0.25f;
if (nBorderStyle == BorderStyle::BEVELED) {
crLeftTop = crBackground - 0.25f;
- crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1);
+ crRightBottom = CFX_Color(COLORTYPE_GRAY, 1);
crBK = crBackground;
} else if (nBorderStyle == BorderStyle::INSET) {
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0);
- crRightBottom = CPWL_Color(COLORTYPE_GRAY, 1);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 0);
+ crRightBottom = CFX_Color(COLORTYPE_GRAY, 1);
}
csAP_D_ON = CPWL_Utils::GetCircleFillAppStream(rcCenter, crBK) +
@@ -1414,7 +1414,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) {
<< " " << rcEdit.Height() << " re\nW\nn\n";
}
- CPWL_Color crText = GetTextPWLColor();
+ CFX_Color crText = GetTextPWLColor();
sBody << "BT\n"
<< CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"
<< "Q\nEMC\n";
@@ -1474,20 +1474,18 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
CFX_FloatRect(rcClient.left, fy - fItemHeight, rcClient.right, fy);
sList << "q\n"
<< CPWL_Utils::GetColorAppStream(
- CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f,
- 113.0f / 255.0f),
+ CFX_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, 113.0f / 255.0f),
true)
<< rcItem.left << " " << rcItem.bottom << " " << rcItem.Width()
<< " " << rcItem.Height() << " re f\n"
<< "Q\n";
sList << "BT\n"
- << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1),
- true)
+ << CPWL_Utils::GetColorAppStream(CFX_Color(COLORTYPE_GRAY, 1), true)
<< CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, fy))
<< "ET\n";
} else {
- CPWL_Color crText = GetTextPWLColor();
+ CFX_Color crText = GetTextPWLColor();
sList << "BT\n"
<< CPWL_Utils::GetColorAppStream(crText, true)
<< CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, fy))
@@ -1590,7 +1588,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) {
sBody << rcClient.left << " " << rcClient.bottom << " "
<< rcClient.Width() << " " << rcClient.Height() << " re\nW\nn\n";
}
- CPWL_Color crText = GetTextPWLColor();
+ CFX_Color crText = GetTextPWLColor();
sBody << "BT\n"
<< CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n"
<< "Q\nEMC\n";
@@ -1697,7 +1695,7 @@ CFX_FloatRect CPDFSDK_Widget::GetRotatedRect() const {
}
CFX_ByteString CPDFSDK_Widget::GetBackgroundAppStream() const {
- CPWL_Color crBackground = GetFillPWLColor();
+ CFX_Color crBackground = GetFillPWLColor();
if (crBackground.nColorType != COLORTYPE_TRANSPARENT)
return CPWL_Utils::GetRectFillAppStream(GetRotatedRect(), crBackground);
@@ -1706,9 +1704,9 @@ CFX_ByteString CPDFSDK_Widget::GetBackgroundAppStream() const {
CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const {
CFX_FloatRect rcWindow = GetRotatedRect();
- CPWL_Color crBorder = GetBorderPWLColor();
- CPWL_Color crBackground = GetFillPWLColor();
- CPWL_Color crLeftTop, crRightBottom;
+ CFX_Color crBorder = GetBorderPWLColor();
+ CFX_Color crBackground = GetFillPWLColor();
+ CFX_Color crLeftTop, crRightBottom;
float fBorderWidth = (float)GetBorderWidth();
CPWL_Dash dsBorder(3, 0, 0);
@@ -1720,13 +1718,13 @@ CFX_ByteString CPDFSDK_Widget::GetBorderAppStream() const {
break;
case BorderStyle::BEVELED:
fBorderWidth *= 2;
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 1);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 1);
crRightBottom = crBackground / 2.0f;
break;
case BorderStyle::INSET:
fBorderWidth *= 2;
- crLeftTop = CPWL_Color(COLORTYPE_GRAY, 0.5);
- crRightBottom = CPWL_Color(COLORTYPE_GRAY, 0.75);
+ crLeftTop = CFX_Color(COLORTYPE_GRAY, 0.5);
+ crRightBottom = CFX_Color(COLORTYPE_GRAY, 0.75);
break;
default:
break;
@@ -1762,8 +1760,8 @@ CFX_Matrix CPDFSDK_Widget::GetMatrix() const {
return mt;
}
-CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const {
- CPWL_Color crText = CPWL_Color(COLORTYPE_GRAY, 0);
+CFX_Color CPDFSDK_Widget::GetTextPWLColor() const {
+ CFX_Color crText = CFX_Color(COLORTYPE_GRAY, 0);
CPDF_FormControl* pFormCtrl = GetFormControl();
CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance();
@@ -1771,34 +1769,34 @@ CPWL_Color CPDFSDK_Widget::GetTextPWLColor() const {
int32_t iColorType;
float fc[4];
da.GetColor(iColorType, fc);
- crText = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crText = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
}
return crText;
}
-CPWL_Color CPDFSDK_Widget::GetBorderPWLColor() const {
- CPWL_Color crBorder;
+CFX_Color CPDFSDK_Widget::GetBorderPWLColor() const {
+ CFX_Color crBorder;
CPDF_FormControl* pFormCtrl = GetFormControl();
int32_t iColorType;
float fc[4];
pFormCtrl->GetOriginalBorderColor(iColorType, fc);
if (iColorType > 0)
- crBorder = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crBorder = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
return crBorder;
}
-CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const {
- CPWL_Color crFill;
+CFX_Color CPDFSDK_Widget::GetFillPWLColor() const {
+ CFX_Color crFill;
CPDF_FormControl* pFormCtrl = GetFormControl();
int32_t iColorType;
float fc[4];
pFormCtrl->GetOriginalBackgroundColor(iColorType, fc);
if (iColorType > 0)
- crFill = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
+ crFill = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
return crFill;
}
diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h
index fe8d015123..8f031cf45f 100644
--- a/fpdfsdk/cpdfsdk_widget.h
+++ b/fpdfsdk/cpdfsdk_widget.h
@@ -15,9 +15,9 @@
#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_string.h"
+#include "core/fxge/cfx_color.h"
#include "fpdfsdk/cpdfsdk_baannot.h"
#include "fpdfsdk/pdfsdk_fieldaction.h"
-#include "fpdfsdk/pdfwindow/cpwl_color.h"
class CFX_RenderDevice;
class CPDF_Annot;
@@ -154,9 +154,9 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot {
CFX_ByteString GetBorderAppStream() const;
CFX_Matrix GetMatrix() const;
- CPWL_Color GetTextPWLColor() const;
- CPWL_Color GetBorderPWLColor() const;
- CPWL_Color GetFillPWLColor() const;
+ CFX_Color GetTextPWLColor() const;
+ CFX_Color GetBorderPWLColor() const;
+ CFX_Color GetFillPWLColor() const;
void AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage);
void RemoveAppearance(const CFX_ByteString& sAPType);
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 6d71be5b6c..34e1e68c13 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -298,14 +298,14 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() {
FX_COLORREF color;
if (m_pWidget->GetFillColor(color))
- cp.sBackgroundColor = CPWL_Color(color);
+ cp.sBackgroundColor = CFX_Color(color);
if (m_pWidget->GetBorderColor(color))
- cp.sBorderColor = CPWL_Color(color);
+ cp.sBorderColor = CFX_Color(color);
- cp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0);
+ cp.sTextColor = CFX_Color(COLORTYPE_GRAY, 0);
if (m_pWidget->GetTextColor(color))
- cp.sTextColor = CPWL_Color(color);
+ cp.sTextColor = CFX_Color(color);
cp.fFontSize = m_pWidget->GetFontSize();
cp.dwBorderWidth = m_pWidget->GetBorderWidth();
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 8e4b465d5e..32d44774ff 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -1436,7 +1436,7 @@ bool Field::fillColor(CJS_Runtime* pRuntime,
vp >> crArray;
- CPWL_Color color;
+ CFX_Color color;
color::ConvertArrayToPWLColor(pRuntime, crArray, &color);
if (m_bDelay) {
AddDelay_Color(FP_FILLCOLOR, color);
@@ -1455,23 +1455,23 @@ bool Field::fillColor(CJS_Runtime* pRuntime,
int iColorType;
pFormControl->GetBackgroundColor(iColorType);
- CPWL_Color color;
+ CFX_Color color;
if (iColorType == COLORTYPE_TRANSPARENT) {
- color = CPWL_Color(COLORTYPE_TRANSPARENT);
+ color = CFX_Color(COLORTYPE_TRANSPARENT);
} else if (iColorType == COLORTYPE_GRAY) {
color =
- CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBackgroundColor(0));
+ CFX_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBackgroundColor(0));
} else if (iColorType == COLORTYPE_RGB) {
color =
- CPWL_Color(COLORTYPE_RGB, pFormControl->GetOriginalBackgroundColor(0),
- pFormControl->GetOriginalBackgroundColor(1),
- pFormControl->GetOriginalBackgroundColor(2));
+ CFX_Color(COLORTYPE_RGB, pFormControl->GetOriginalBackgroundColor(0),
+ pFormControl->GetOriginalBackgroundColor(1),
+ pFormControl->GetOriginalBackgroundColor(2));
} else if (iColorType == COLORTYPE_CMYK) {
color =
- CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBackgroundColor(0),
- pFormControl->GetOriginalBackgroundColor(1),
- pFormControl->GetOriginalBackgroundColor(2),
- pFormControl->GetOriginalBackgroundColor(3));
+ CFX_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBackgroundColor(0),
+ pFormControl->GetOriginalBackgroundColor(1),
+ pFormControl->GetOriginalBackgroundColor(2),
+ pFormControl->GetOriginalBackgroundColor(3));
} else {
return false;
}
@@ -1483,7 +1483,7 @@ bool Field::fillColor(CJS_Runtime* pRuntime,
void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color) {
+ const CFX_Color& color) {
// Not supported.
}
@@ -2213,7 +2213,7 @@ bool Field::strokeColor(CJS_Runtime* pRuntime,
vp >> crArray;
- CPWL_Color color;
+ CFX_Color color;
color::ConvertArrayToPWLColor(pRuntime, crArray, &color);
if (m_bDelay) {
AddDelay_Color(FP_STROKECOLOR, color);
@@ -2235,20 +2235,20 @@ bool Field::strokeColor(CJS_Runtime* pRuntime,
int iColorType;
pFormControl->GetBorderColor(iColorType);
- CPWL_Color color;
+ CFX_Color color;
if (iColorType == COLORTYPE_TRANSPARENT) {
- color = CPWL_Color(COLORTYPE_TRANSPARENT);
+ color = CFX_Color(COLORTYPE_TRANSPARENT);
} else if (iColorType == COLORTYPE_GRAY) {
- color = CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBorderColor(0));
+ color = CFX_Color(COLORTYPE_GRAY, pFormControl->GetOriginalBorderColor(0));
} else if (iColorType == COLORTYPE_RGB) {
- color = CPWL_Color(COLORTYPE_RGB, pFormControl->GetOriginalBorderColor(0),
- pFormControl->GetOriginalBorderColor(1),
- pFormControl->GetOriginalBorderColor(2));
+ color = CFX_Color(COLORTYPE_RGB, pFormControl->GetOriginalBorderColor(0),
+ pFormControl->GetOriginalBorderColor(1),
+ pFormControl->GetOriginalBorderColor(2));
} else if (iColorType == COLORTYPE_CMYK) {
- color = CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBorderColor(0),
- pFormControl->GetOriginalBorderColor(1),
- pFormControl->GetOriginalBorderColor(2),
- pFormControl->GetOriginalBorderColor(3));
+ color = CFX_Color(COLORTYPE_CMYK, pFormControl->GetOriginalBorderColor(0),
+ pFormControl->GetOriginalBorderColor(1),
+ pFormControl->GetOriginalBorderColor(2),
+ pFormControl->GetOriginalBorderColor(3));
} else {
return false;
}
@@ -2261,7 +2261,7 @@ bool Field::strokeColor(CJS_Runtime* pRuntime,
void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color) {
+ const CFX_Color& color) {
// Not supported.
}
@@ -2353,7 +2353,7 @@ bool Field::textColor(CJS_Runtime* pRuntime,
vp >> crArray;
- CPWL_Color color;
+ CFX_Color color;
color::ConvertArrayToPWLColor(pRuntime, crArray, &color);
if (m_bDelay) {
AddDelay_Color(FP_TEXTCOLOR, color);
@@ -2383,11 +2383,11 @@ bool Field::textColor(CJS_Runtime* pRuntime,
int32_t b;
std::tie(a, r, g, b) = ArgbDecode(color);
- CPWL_Color crRet =
- CPWL_Color(COLORTYPE_RGB, r / 255.0f, g / 255.0f, b / 255.0f);
+ CFX_Color crRet =
+ CFX_Color(COLORTYPE_RGB, r / 255.0f, g / 255.0f, b / 255.0f);
if (iColorType == COLORTYPE_TRANSPARENT)
- crRet = CPWL_Color(COLORTYPE_TRANSPARENT);
+ crRet = CFX_Color(COLORTYPE_TRANSPARENT);
color::ConvertPWLColorToArray(pRuntime, crRet, &crArray);
vp << crArray;
@@ -2397,7 +2397,7 @@ bool Field::textColor(CJS_Runtime* pRuntime,
void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color) {
+ const CFX_Color& color) {
// Not supported.
}
@@ -3231,7 +3231,7 @@ void Field::AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect) {
m_pJSDoc->AddDelayData(pNewData);
}
-void Field::AddDelay_Color(FIELD_PROP prop, const CPWL_Color& color) {
+void Field::AddDelay_Color(FIELD_PROP prop, const CFX_Color& color) {
CJS_DelayData* pNewData =
new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName);
pNewData->color = color;
diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h
index 688c5de9f4..1c8d6beac1 100644
--- a/fpdfsdk/javascript/Field.h
+++ b/fpdfsdk/javascript/Field.h
@@ -11,9 +11,9 @@
#include <vector>
#include "core/fxcrt/cfx_observable.h"
+#include "core/fxge/cfx_color.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/javascript/JS_Define.h"
-#include "fpdfsdk/pdfwindow/cpwl_wnd.h" // For CPWL_Color.
class CPDFSDK_Widget;
class Document;
@@ -67,7 +67,7 @@ struct CJS_DelayData {
CFX_ByteString string;
CFX_WideString widestring;
CFX_FloatRect rect;
- CPWL_Color color;
+ CFX_Color color;
std::vector<uint32_t> wordarray;
std::vector<CFX_WideString> widestringarray;
};
@@ -385,7 +385,7 @@ class Field : public CJS_EmbedObj {
static void SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color);
+ const CFX_Color& color);
static void SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
@@ -421,7 +421,7 @@ class Field : public CJS_EmbedObj {
static void SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color);
+ const CFX_Color& color);
static void SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
@@ -429,7 +429,7 @@ class Field : public CJS_EmbedObj {
static void SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
- const CPWL_Color& color);
+ const CFX_Color& color);
static void SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
int nControlIndex,
@@ -490,7 +490,7 @@ class Field : public CJS_EmbedObj {
void AddDelay_String(FIELD_PROP prop, const CFX_ByteString& string);
void AddDelay_WideString(FIELD_PROP prop, const CFX_WideString& string);
void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect);
- void AddDelay_Color(FIELD_PROP prop, const CPWL_Color& color);
+ void AddDelay_Color(FIELD_PROP prop, const CFX_Color& color);
void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array);
void AddDelay_WideStringArray(FIELD_PROP prop,
const std::vector<CFX_WideString>& array);
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index 2efcacdde9..bdae064cea 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -875,8 +875,8 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime,
CJS_Array aProp;
vProp.GetJSValue()->ConvertToArray(pRuntime, aProp);
- CPWL_Color crProp;
- CPWL_Color crColor;
+ CFX_Color crProp;
+ CFX_Color crColor;
color::ConvertArrayToPWLColor(pRuntime, aProp, &crProp);
color::ConvertArrayToPWLColor(pRuntime, arColor, &crColor);
diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp
index 376eefa248..7bf3cc9c6f 100644
--- a/fpdfsdk/javascript/color.cpp
+++ b/fpdfsdk/javascript/color.cpp
@@ -39,24 +39,24 @@ JSMethodSpec CJS_Color::MethodSpecs[] = {{"convert", convert_static},
IMPLEMENT_JS_CLASS(CJS_Color, color)
color::color(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {
- m_crTransparent = CPWL_Color(COLORTYPE_TRANSPARENT);
- m_crBlack = CPWL_Color(COLORTYPE_GRAY, 0);
- m_crWhite = CPWL_Color(COLORTYPE_GRAY, 1);
- m_crRed = CPWL_Color(COLORTYPE_RGB, 1, 0, 0);
- m_crGreen = CPWL_Color(COLORTYPE_RGB, 0, 1, 0);
- m_crBlue = CPWL_Color(COLORTYPE_RGB, 0, 0, 1);
- m_crCyan = CPWL_Color(COLORTYPE_CMYK, 1, 0, 0, 0);
- m_crMagenta = CPWL_Color(COLORTYPE_CMYK, 0, 1, 0, 0);
- m_crYellow = CPWL_Color(COLORTYPE_CMYK, 0, 0, 1, 0);
- m_crDKGray = CPWL_Color(COLORTYPE_GRAY, 0.25);
- m_crGray = CPWL_Color(COLORTYPE_GRAY, 0.5);
- m_crLTGray = CPWL_Color(COLORTYPE_GRAY, 0.75);
+ m_crTransparent = CFX_Color(COLORTYPE_TRANSPARENT);
+ m_crBlack = CFX_Color(COLORTYPE_GRAY, 0);
+ m_crWhite = CFX_Color(COLORTYPE_GRAY, 1);
+ m_crRed = CFX_Color(COLORTYPE_RGB, 1, 0, 0);
+ m_crGreen = CFX_Color(COLORTYPE_RGB, 0, 1, 0);
+ m_crBlue = CFX_Color(COLORTYPE_RGB, 0, 0, 1);
+ m_crCyan = CFX_Color(COLORTYPE_CMYK, 1, 0, 0, 0);
+ m_crMagenta = CFX_Color(COLORTYPE_CMYK, 0, 1, 0, 0);
+ m_crYellow = CFX_Color(COLORTYPE_CMYK, 0, 0, 1, 0);
+ m_crDKGray = CFX_Color(COLORTYPE_GRAY, 0.25);
+ m_crGray = CFX_Color(COLORTYPE_GRAY, 0.5);
+ m_crLTGray = CFX_Color(COLORTYPE_GRAY, 0.75);
}
color::~color() {}
void color::ConvertPWLColorToArray(CJS_Runtime* pRuntime,
- const CPWL_Color& color,
+ const CFX_Color& color,
CJS_Array* array) {
switch (color.nColorType) {
case COLORTYPE_TRANSPARENT:
@@ -84,7 +84,7 @@ void color::ConvertPWLColorToArray(CJS_Runtime* pRuntime,
void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
const CJS_Array& array,
- CPWL_Color* color) {
+ CFX_Color* color) {
int nArrayLen = array.GetLength(pRuntime);
if (nArrayLen < 1)
return;
@@ -119,14 +119,14 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
}
if (sSpace == "T") {
- *color = CPWL_Color(COLORTYPE_TRANSPARENT);
+ *color = CFX_Color(COLORTYPE_TRANSPARENT);
} else if (sSpace == "G") {
- *color = CPWL_Color(COLORTYPE_GRAY, (float)d1);
+ *color = CFX_Color(COLORTYPE_GRAY, (float)d1);
} else if (sSpace == "RGB") {
- *color = CPWL_Color(COLORTYPE_RGB, (float)d1, (float)d2, (float)d3);
+ *color = CFX_Color(COLORTYPE_RGB, (float)d1, (float)d2, (float)d3);
} else if (sSpace == "CMYK") {
*color =
- CPWL_Color(COLORTYPE_CMYK, (float)d1, (float)d2, (float)d3, (float)d4);
+ CFX_Color(COLORTYPE_CMYK, (float)d1, (float)d2, (float)d3, (float)d4);
}
}
@@ -204,7 +204,7 @@ bool color::ltGray(CJS_Runtime* pRuntime,
bool color::PropertyHelper(CJS_Runtime* pRuntime,
CJS_PropValue& vp,
- CPWL_Color* var) {
+ CFX_Color* var) {
CJS_Array array;
if (vp.IsGetting()) {
ConvertPWLColorToArray(pRuntime, *var, &array);
@@ -230,7 +230,7 @@ bool color::convert(CJS_Runtime* pRuntime,
if (!params[0].ConvertToArray(pRuntime, aSource))
return false;
- CPWL_Color crSource;
+ CFX_Color crSource;
ConvertArrayToPWLColor(pRuntime, aSource, &crSource);
CFX_ByteString sDestSpace = params[1].ToCFXByteString(pRuntime);
@@ -247,7 +247,7 @@ bool color::convert(CJS_Runtime* pRuntime,
}
CJS_Array aDest;
- CPWL_Color crDest = crSource.ConvertColorType(nColorType);
+ CFX_Color crDest = crSource.ConvertColorType(nColorType);
ConvertPWLColorToArray(pRuntime, crDest, &aDest);
vRet = CJS_Value(pRuntime, aDest);
@@ -268,8 +268,8 @@ bool color::equal(CJS_Runtime* pRuntime,
if (!params[1].ConvertToArray(pRuntime, array2))
return false;
- CPWL_Color color1;
- CPWL_Color color2;
+ CFX_Color color1;
+ CFX_Color color2;
ConvertArrayToPWLColor(pRuntime, array1, &color1);
ConvertArrayToPWLColor(pRuntime, array2, &color2);
color1 = color1.ConvertColorType(color2.nColorType);
diff --git a/fpdfsdk/javascript/color.h b/fpdfsdk/javascript/color.h
index 3e03dec730..e67d4d5ad5 100644
--- a/fpdfsdk/javascript/color.h
+++ b/fpdfsdk/javascript/color.h
@@ -44,29 +44,27 @@ class color : public CJS_EmbedObj {
CFX_WideString& sError);
static void ConvertPWLColorToArray(CJS_Runtime* pRuntime,
- const CPWL_Color& color,
+ const CFX_Color& color,
CJS_Array* array);
static void ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
const CJS_Array& array,
- CPWL_Color* color);
+ CFX_Color* color);
private:
- bool PropertyHelper(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- CPWL_Color* val);
+ bool PropertyHelper(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_Color* val);
- CPWL_Color m_crTransparent;
- CPWL_Color m_crBlack;
- CPWL_Color m_crWhite;
- CPWL_Color m_crRed;
- CPWL_Color m_crGreen;
- CPWL_Color m_crBlue;
- CPWL_Color m_crCyan;
- CPWL_Color m_crMagenta;
- CPWL_Color m_crYellow;
- CPWL_Color m_crDKGray;
- CPWL_Color m_crGray;
- CPWL_Color m_crLTGray;
+ CFX_Color m_crTransparent;
+ CFX_Color m_crBlack;
+ CFX_Color m_crWhite;
+ CFX_Color m_crRed;
+ CFX_Color m_crGreen;
+ CFX_Color m_crBlue;
+ CFX_Color m_crCyan;
+ CFX_Color m_crMagenta;
+ CFX_Color m_crYellow;
+ CFX_Color m_crDKGray;
+ CFX_Color m_crGray;
+ CFX_Color m_crLTGray;
};
class CJS_Color : public CJS_Object {
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;