mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-14 00:34:41 +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:
@@ -203,7 +203,7 @@ bool JSI_IGUIObject::getProperty(JSContext* cx, JS::HandleObject obj, JS::Handle
|
||||
{
|
||||
CGUISpriteInstance* value;
|
||||
GUI<CGUISpriteInstance>::GetSettingPointer(e, propName, value);
|
||||
ScriptInterface::ToJSVal(cx, vp, value->GetName());
|
||||
ScriptInterface::ToJSVal(cx, vp, *value);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -324,11 +324,11 @@ bool JSI_IGUIObject::setProperty(JSContext* cx, JS::HandleObject obj, JS::Handle
|
||||
|
||||
case GUIST_CGUISpriteInstance:
|
||||
{
|
||||
std::string value;
|
||||
CGUISpriteInstance value;
|
||||
if (!ScriptInterface::FromJSVal(cx, vp, value))
|
||||
return false;
|
||||
|
||||
GUI<CGUISpriteInstance>::SetSetting(e, propName, CGUISpriteInstance(value));
|
||||
GUI<CGUISpriteInstance>::SetSetting(e, propName, value);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user