summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/color.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/javascript/color.cpp')
-rw-r--r--fpdfsdk/javascript/color.cpp80
1 files changed, 35 insertions, 45 deletions
diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp
index 575a86c4e6..5d8282de4f 100644
--- a/fpdfsdk/javascript/color.cpp
+++ b/fpdfsdk/javascript/color.cpp
@@ -115,165 +115,157 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
}
bool color::get_transparent(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crTransparent);
}
bool color::set_transparent(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crTransparent);
}
bool color::get_black(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crBlack);
}
bool color::set_black(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crBlack);
}
bool color::get_white(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crWhite);
}
bool color::set_white(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crWhite);
}
-bool color::get_red(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
- WideString* sError) {
+bool color::get_red(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crRed);
}
bool color::set_red(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crRed);
}
bool color::get_green(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crGreen);
}
bool color::set_green(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crGreen);
}
-bool color::get_blue(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
- WideString* sError) {
+bool color::get_blue(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crBlue);
}
bool color::set_blue(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crBlue);
}
-bool color::get_cyan(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
- WideString* sError) {
+bool color::get_cyan(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crCyan);
}
bool color::set_cyan(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crCyan);
}
bool color::get_magenta(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crMagenta);
}
bool color::set_magenta(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crMagenta);
}
bool color::get_yellow(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crYellow);
}
bool color::set_yellow(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crYellow);
}
bool color::get_dark_gray(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crDKGray);
}
bool color::set_dark_gray(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crDKGray);
}
-bool color::get_gray(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
- WideString* sError) {
+bool color::get_gray(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crGray);
}
bool color::set_gray(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crGray);
}
bool color::get_light_gray(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
WideString* sError) {
return GetPropertyHelper(pRuntime, vp, &m_crLTGray);
}
bool color::set_light_gray(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
WideString* sError) {
return SetPropertyHelper(pRuntime, vp, &m_crLTGray);
}
bool color::GetPropertyHelper(CJS_Runtime* pRuntime,
- CJS_PropValue* vp,
+ CJS_Value* vp,
CFX_Color* var) {
CJS_Array array;
- ConvertPWLColorToArray(pRuntime, *var, &array);
- vp->Set(array);
- return true;
+ ConvertPWLColorToArray(pRuntime, *var, &array);
+ vp->Set(pRuntime, array);
+ return true;
}
bool color::SetPropertyHelper(CJS_Runtime* pRuntime,
- const CJS_PropValue& vp,
+ const CJS_Value& vp,
CFX_Color* var) {
- if (!vp.GetJSValue()->IsArrayObject())
+ if (!vp.IsArrayObject())
return false;
- ConvertArrayToPWLColor(pRuntime, vp.GetJSValue()->ToArray(pRuntime), var);
+ ConvertArrayToPWLColor(pRuntime, vp.ToArray(pRuntime), var);
return true;
}
@@ -293,16 +285,14 @@ bool color::convert(CJS_Runtime* pRuntime,
ByteString sDestSpace = params[1].ToByteString(pRuntime);
int nColorType = CFX_Color::kTransparent;
-
- if (sDestSpace == "T") {
+ if (sDestSpace == "T")
nColorType = CFX_Color::kTransparent;
- } else if (sDestSpace == "G") {
+ else if (sDestSpace == "G")
nColorType = CFX_Color::kGray;
- } else if (sDestSpace == "RGB") {
+ else if (sDestSpace == "RGB")
nColorType = CFX_Color::kRGB;
- } else if (sDestSpace == "CMYK") {
+ else if (sDestSpace == "CMYK")
nColorType = CFX_Color::kCMYK;
- }
CJS_Array aDest;
CFX_Color crDest = crSource.ConvertColorType(nColorType);