Icon: std::move ObjToken instances where applicable

Allows the callers to move the token instance into the type if able to,
allowing avoiding an unnecessary atomic reference count increment and
decrement.
This commit is contained in:
Lioncash 2019-09-01 00:42:31 -04:00
parent 33a6e07e7a
commit 462d2bb8fa
1 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ struct Icon {
boo::ObjToken<boo::ITexture> m_tex;
zeus::CVector2f m_uvCoords[4];
Icon() = default;
Icon(const boo::ObjToken<boo::ITexture>& tex, float rect[4]) : m_tex(tex) {
Icon(boo::ObjToken<boo::ITexture> tex, float rect[4]) : m_tex(std::move(tex)) {
m_uvCoords[0][0] = rect[0];
m_uvCoords[0][1] = -rect[3];
@ -46,8 +46,8 @@ class IconAtlas {
public:
IconAtlas() = default;
operator bool() const { return m_tex.operator bool(); }
void initializeAtlas(const boo::ObjToken<boo::ITextureS>& tex) {
m_tex = tex;
void initializeAtlas(boo::ObjToken<boo::ITextureS> tex) {
m_tex = std::move(tex);
for (size_t c = 0; c < COLS; ++c)
for (size_t r = 0; r < ROWS; ++r)
m_icons[c][r] = MakeIcon(c, r);