Skip to content

Commit 4ae7b8b

Browse files
committed
consistent naming, unnecessary scope
1 parent 9a3dbe8 commit 4ae7b8b

File tree

1 file changed

+19
-22
lines changed

1 file changed

+19
-22
lines changed

src/rectpack2D/best_bin_finder.h

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ namespace rectpack2D {
7272
auto candidate_bin = starting_bin;
7373
int tries_before_discarding = 0;
7474

75-
if (discard_step <= 0)
76-
{
75+
if (discard_step <= 0) {
7776
tries_before_discarding = -discard_step;
7877
discard_step = 1;
7978
}
@@ -226,14 +225,14 @@ namespace rectpack2D {
226225

227226
template <
228227
class empty_spaces_type,
229-
class OrderType,
228+
class order_type,
230229
class F,
231230
class I
232231
>
233232
rect_wh find_best_packing_impl(F for_each_order, const I input) {
234233
const auto max_bin = rect_wh(input.max_bin_side, input.max_bin_side);
235234

236-
std::optional<OrderType> best_order;
235+
std::optional<order_type> best_order;
237236

238237
int best_total_inserted = -1;
239238
auto best_bin = max_bin;
@@ -246,7 +245,7 @@ namespace rectpack2D {
246245
thread_local empty_spaces_type root = rect_wh();
247246
root.flipping_mode = input.flipping_mode;
248247

249-
for_each_order ([&](const OrderType& current_order) {
248+
for_each_order ([&](const order_type& current_order) {
250249
const auto packing = best_packing_for_ordering(
251250
root,
252251
current_order,
@@ -275,29 +274,27 @@ namespace rectpack2D {
275274
}
276275
});
277276

278-
{
279-
assert(best_order.has_value());
280-
281-
root.reset(best_bin);
277+
assert(best_order.has_value());
278+
279+
root.reset(best_bin);
282280

283-
for (auto& rr : *best_order) {
284-
auto& rect = dereference(rr).get_rect();
281+
for (auto& rr : *best_order) {
282+
auto& rect = dereference(rr).get_rect();
285283

286-
if (const auto ret = root.insert(rect.get_wh())) {
287-
rect = *ret;
284+
if (const auto ret = root.insert(rect.get_wh())) {
285+
rect = *ret;
288286

289-
if (callback_result::ABORT_PACKING == input.handle_successful_insertion(rect)) {
290-
break;
291-
}
287+
if (callback_result::ABORT_PACKING == input.handle_successful_insertion(rect)) {
288+
break;
292289
}
293-
else {
294-
if (callback_result::ABORT_PACKING == input.handle_unsuccessful_insertion(rect)) {
295-
break;
296-
}
290+
}
291+
else {
292+
if (callback_result::ABORT_PACKING == input.handle_unsuccessful_insertion(rect)) {
293+
break;
297294
}
298295
}
299-
300-
return root.get_rects_aabb();
301296
}
297+
298+
return root.get_rects_aabb();
302299
}
303300
}

0 commit comments

Comments
 (0)