Skip to content

Commit

Permalink
Save space, move functions from inline to cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdowling committed Apr 8, 2020
1 parent 26a86a8 commit cee19cc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
20 changes: 20 additions & 0 deletions software/o_c_REV/OC_menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,26 @@ void Init()
{
};

void DrawEditIcon(weegfx::coord_t x, weegfx::coord_t y, int value, int min_value, int max_value) {
const uint8_t *src = OC::bitmap_edit_indicators_8;
if (value == max_value)
src += OC::kBitmapEditIndicatorW * 2;
else if (value == min_value)
src += OC::kBitmapEditIndicatorW;

graphics.drawBitmap8(x - 5, y + 1, OC::kBitmapEditIndicatorW, src);
}

void DrawEditIcon(weegfx::coord_t x, weegfx::coord_t y, int value, const settings::value_attr &attr) {
const uint8_t *src = OC::bitmap_edit_indicators_8;
if (value == attr.max_)
src += OC::kBitmapEditIndicatorW * 2;
else if (value == attr.min_)
src += OC::kBitmapEditIndicatorW;

graphics.drawBitmap8(x - 5, y + 1, OC::kBitmapEditIndicatorW, src);
}

}; // namespace menu


Expand Down
21 changes: 2 additions & 19 deletions software/o_c_REV/OC_menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,25 +145,8 @@ class ScreenCursor {
int screen_line_;
};

inline void DrawEditIcon(weegfx::coord_t x, weegfx::coord_t y, int value, int min_value, int max_value) {
const uint8_t *src = OC::bitmap_edit_indicators_8;
if (value == max_value)
src += OC::kBitmapEditIndicatorW * 2;
else if (value == min_value)
src += OC::kBitmapEditIndicatorW;

graphics.drawBitmap8(x - 5, y + 1, OC::kBitmapEditIndicatorW, src);
}

inline void DrawEditIcon(weegfx::coord_t x, weegfx::coord_t y, int value, const settings::value_attr &attr) {
const uint8_t *src = OC::bitmap_edit_indicators_8;
if (value == attr.max_)
src += OC::kBitmapEditIndicatorW * 2;
else if (value == attr.min_)
src += OC::kBitmapEditIndicatorW;

graphics.drawBitmap8(x - 5, y + 1, OC::kBitmapEditIndicatorW, src);
}
void DrawEditIcon(weegfx::coord_t x, weegfx::coord_t y, int value, int min_value, int max_value);
void DrawEditIcon(weegfx::coord_t x, weegfx::coord_t y, int value, const settings::value_attr &attr);

inline void DrawChord(weegfx::coord_t x, weegfx::coord_t y, int width, int value, int mem_offset) {

Expand Down

0 comments on commit cee19cc

Please sign in to comment.