rename push_back vs emplace_back (fine tuning and remove on Live2D (too much))

This commit is contained in:
aismann 2022-08-09 05:51:07 +02:00
parent 28dd328eda
commit 8b408b2cde
3 changed files with 7 additions and 7 deletions

View File

@ -2314,18 +2314,18 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
float a = data[(y * w + x) * 4 + 3] / 255.0F; float a = data[(y * w + x) * 4 + 3] / 255.0F;
if (a >= alphaThreshold && !inverted) if (a >= alphaThreshold && !inverted)
for (float i = 0; i < 1.0F; i += 1.0F / inbetweenSamples) for (float i = 0; i < 1.0F; i += 1.0F / inbetweenSamples)
points.push_back({float(x + i), float(h - y + i)}); points.emplace_back(Vec2{float(x + i), float(h - y + i)});
if (a < alphaThreshold && inverted) if (a < alphaThreshold && inverted)
for (float i = 0; i < 1.0F; i += 1.0F / inbetweenSamples) for (float i = 0; i < 1.0F; i += 1.0F / inbetweenSamples)
points.push_back({float(x + i), float(h - y + i)}); points.emplace_back(Vec2{float(x + i), float(h - y + i)});
} }
else else
{ {
float a = data[(y * w + x) * 4 + 3] / 255.0F; float a = data[(y * w + x) * 4 + 3] / 255.0F;
if (a >= alphaThreshold && !inverted) if (a >= alphaThreshold && !inverted)
points.push_back({float(x), float(h - y)}); points.emplace_back(Vec2{float(x), float(h - y)});
if (a < alphaThreshold && inverted) if (a < alphaThreshold && inverted)
points.push_back({float(x), float(h - y)}); points.emplace_back(Vec2{float(x), float(h - y)});
} }
} }

View File

@ -228,7 +228,7 @@ void* CubismFramework::Allocate(csmSizeType size, const csmChar* fileName, csmIn
if (s_allocationList) if (s_allocationList)
{ {
s_allocationList->emplace_back(address); s_allocationList->push_back(address);
} }
return address; return address;
@ -242,7 +242,7 @@ void* CubismFramework::AllocateAligned(csmSizeType size, csmUint32 alignment, co
if (s_allocationList) if (s_allocationList)
{ {
s_allocationList->emplace_back(address); s_allocationList->push_back(address);
} }
return address; return address;

View File

@ -581,7 +581,7 @@ int lua_cocos2dx_DrawNode3D_drawCube(lua_State* L)
} }
#endif #endif
// arg0[i] = vec3; // arg0[i] = vec3;
arg0.push_back(vec3); arg0.emplace_back(vec3);
lua_pop(L, 1); lua_pop(L, 1);
} }