13
0

canvas: just use stack and size counter instead of std::vector<>

This commit is contained in:
Paul Davis 2021-09-14 21:22:56 -06:00
parent 9925147aae
commit b3854c2e92

View File

@ -225,15 +225,16 @@ struct FourDimensions {
/* CSS style defaults: see https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties
*/
std::vector<Distance> args;
Distance args[4];
uint32_t nargs = 1;
args.push_back (u);
args[0] = u;
if (r >= 0) { args.push_back (r); }
if (d >= 0) { args.push_back (d); }
if (l >= 0) { args.push_back (l); }
if (r >= 0) { args[1] = r; ++nargs; }
if (d >= 0) { args[2] = d; ++nargs; }
if (l >= 0) { args[3] = l; ++nargs; }
switch (args.size()) {
switch (nargs) {
case 1:
up = right = down = left = args[0];
break;