mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-28 18:31:45 +00:00
CGUISpriteInstance non-copyable and FromJSVal / ToJSVal.
Make CGUISpriteInstance non-copyable to further harden Philips protection from8f4f8e240fagainst unintentional copies of its DrawCall cache such as inc19f3608a5. Remove its copy constructor from849f50a500, make it movable, and until it becomes otherwise necessary, force move assignment when sprites are assigned. Improves the fixes of the compiler warnings about deprecated implicit copy constructors in8a32b0b3d4by avoiding the copies instead of copying explicitly. Add ToJSVal, FromJSVal for CGUISprinteInstance to make JSI_IGUIObject::getProperty and setProperty more consistent. Rename Sprite operator= to SetName to reduce ambiguity. Pass CRect by reference in CGUISpriteInstance::Draw. Differential Revision: https://code.wildfiregames.com/D2133 Comments By: wraitii This was SVN commit r22570.
This commit is contained in:
@@ -286,3 +286,18 @@ template<> bool ScriptInterface::FromJSVal<EAlign>(JSContext* cx, JS::HandleValu
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template<> void ScriptInterface::ToJSVal<CGUISpriteInstance>(JSContext* cx, JS::MutableHandleValue ret, const CGUISpriteInstance& val)
|
||||
{
|
||||
ToJSVal(cx, ret, val.GetName());
|
||||
}
|
||||
|
||||
template<> bool ScriptInterface::FromJSVal<CGUISpriteInstance>(JSContext* cx, JS::HandleValue v, CGUISpriteInstance& out)
|
||||
{
|
||||
std::string name;
|
||||
if (!FromJSVal(cx, v, name))
|
||||
return false;
|
||||
|
||||
out.SetName(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user