Skip to content

Commit

Permalink
emplace_back to avoid copy or mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasByr committed Jun 20, 2023
1 parent 3259e0d commit 84e9ef9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions inc/helper/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ enum class RectMode { CENTER, CORNER };
struct Config {
RectMode rect_mode;
double trans_x, trans_y;

Config(enum RectMode rect_mode, double trans_x, double trans_y)
: rect_mode{rect_mode}, trans_x{trans_x}, trans_y{trans_y} {}
};

class Renderer {
Expand Down
5 changes: 1 addition & 4 deletions src/helper/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,7 @@ void Renderer::translate(double x, double y) {
}

void Renderer::push() {
struct Config c {
m_rect_mode, m_trans_x, m_trans_y
};
m_config_stack.push_back(c);
m_config_stack.emplace_back(m_rect_mode, m_trans_x, m_trans_y);
}

void Renderer::pop() {
Expand Down

0 comments on commit 84e9ef9

Please sign in to comment.