CGUISpriteInstance non-copyable and FromJSVal / ToJSVal.

Make CGUISpriteInstance non-copyable to further harden Philips
protection from 8f4f8e240f against unintentional copies of its DrawCall
cache such as in c19f3608a5.
Remove its copy constructor from 849f50a500, 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 in 8a32b0b3d4 by 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:
elexis
2019-07-28 22:40:58 +00:00
parent 9fcfdb0324
commit 0a7d0ecdde
8 changed files with 84 additions and 43 deletions
@@ -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;
}