summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/color.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-23 09:44:30 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-23 17:57:28 +0000
commit33d13f2231a07e7b32ff25da6a6a28cb619d18a9 (patch)
tree8be1d6a857dff58d8aacbc1dc722fceac8343235 /fpdfsdk/javascript/color.cpp
parentc970895f94cf76eb738d0a583ae139fecdd85268 (diff)
downloadpdfium-33d13f2231a07e7b32ff25da6a6a28cb619d18a9.tar.xz
Remove CJS_PropValue
This CL removes the CJS_PropValue class and uses CJS_Value directly. The various Set methods have been moved to CJS_Value and the runtime provided as needed. Change-Id: Ib5d3b9efc9b6cf8182be8f19af98599379c3d7db Reviewed-on: https://pdfium-review.googlesource.com/16431 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
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);