mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 09:53:47 +00:00
Add ToJSVal<CRect> to make the conversion reusable, remove unused PSERROR_Scripting_ConversionFailed and dead catch.
Avoids the CRect copy or stops relying on optimization to avoid the copy. Split from D2142. Differential Revision: https://code.wildfiregames.com/D2259 Tested on: gcc 9.1.0, Jenkins This was SVN commit r22847.
This commit is contained in:
@@ -211,6 +211,16 @@ template<> bool ScriptInterface::FromJSVal<CPos>(JSContext* cx, JS::HandleValue
|
||||
return true;
|
||||
}
|
||||
|
||||
template<> void ScriptInterface::ToJSVal<CRect>(JSContext* cx, JS::MutableHandleValue ret, const CRect& val)
|
||||
{
|
||||
ScriptInterface::GetScriptInterfaceAndCBData(cx)->pScriptInterface->CreateObject(
|
||||
ret,
|
||||
"left", val.left,
|
||||
"right", val.right,
|
||||
"top", val.top,
|
||||
"bottom", val.bottom);
|
||||
}
|
||||
|
||||
template<> void ScriptInterface::ToJSVal<CClientArea>(JSContext* cx, JS::MutableHandleValue ret, const CClientArea& val)
|
||||
{
|
||||
val.ToJSVal(cx, ret);
|
||||
|
||||
Reference in New Issue
Block a user