Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ else()
-Wall
-Werror
-Wextra
-Wshadow
-ftemplate-backtrace-limit=0
)

Expand Down
2 changes: 1 addition & 1 deletion example/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ int main() {
int some_medadata = 0;

public:
my_rect(const rect_type& rect) : rect(rect) { (void)some_medadata; }
my_rect(const rect_type& rect_) : rect(rect_) { (void)some_medadata; }

/*
You need to provide these two member getters.
Expand Down
12 changes: 6 additions & 6 deletions src/rectpack2D/best_bin_finder.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace rectpack2D {
T first;
T second;
public:
span(T first, T second) : first(first), second(second) {}
span(T first_, T second_) : first(first_), second(second_) {}

T begin() const {
return first;
Expand Down Expand Up @@ -183,12 +183,12 @@ namespace rectpack2D {
) {
const auto try_pack = [&](
const bin_dimension tried_dimension,
const rect_wh starting_bin
const rect_wh candidate_starting_bin
) {
return best_packing_for_ordering_impl(
root,
std::forward<O>(ordering),
starting_bin,
candidate_starting_bin,
discard_step,
tried_dimension
);
Expand All @@ -202,16 +202,16 @@ namespace rectpack2D {

auto best_bin = std::get<rect_wh>(best_result);

auto trial = [&](const bin_dimension tried_dimension) {
auto try_dimension = [&](const bin_dimension tried_dimension) {
const auto trial = try_pack(tried_dimension, best_bin);

if (const auto better = std::get_if<rect_wh>(&trial)) {
best_bin = *better;
}
};

trial(bin_dimension::WIDTH);
trial(bin_dimension::HEIGHT);
try_dimension(bin_dimension::WIDTH);
try_dimension(bin_dimension::HEIGHT);

return best_bin;
}
Expand Down
6 changes: 3 additions & 3 deletions src/rectpack2D/rect_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace rectpack2D {

struct rect_wh {
rect_wh() : w(0), h(0) {}
rect_wh(const int w, const int h) : w(w), h(h) {}
rect_wh(const int w_, const int h_) : w(w_), h(h_) {}

int w;
int h;
Expand Down Expand Up @@ -41,7 +41,7 @@ namespace rectpack2D {
int h;

rect_xywh() : x(0), y(0), w(0), h(0) {}
rect_xywh(const int x, const int y, const int w, const int h) : x(x), y(y), w(w), h(h) {}
rect_xywh(const int x_, const int y_, const int w_, const int h_) : x(x_), y(y_), w(w_), h(h_) {}

int area() const { return w * h; }
int perimeter() const { return 2 * w + 2 * h; }
Expand All @@ -67,7 +67,7 @@ namespace rectpack2D {
bool flipped;

rect_xywhf() : x(0), y(0), w(0), h(0), flipped(false) {}
rect_xywhf(const int x, const int y, const int w, const int h, const bool flipped) : x(x), y(y), w(flipped ? h : w), h(flipped ? w : h), flipped(flipped) {}
rect_xywhf(const int x_, const int y_, const int w_, const int h_, const bool flipped_) : x(x_), y(y_), w(flipped_ ? h_ : w_), h(flipped_ ? w_ : h_), flipped(flipped_) {}
rect_xywhf(const rect_xywh& b) : rect_xywhf(b.x, b.y, b.w, b.h, false) {}

int area() const { return w * h; }
Expand Down