From edd2acc86bc15bcb7b769d507e92f14f24c61125 Mon Sep 17 00:00:00 2001 From: Kp Date: Fri, 12 Feb 2016 04:02:28 +0000 Subject: [PATCH] Pass color to gr_box --- common/2d/box.cpp | 23 +++++++++++------------ common/include/fwd-gr.h | 4 +++- similar/editor/curves.cpp | 7 ++++--- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/common/2d/box.cpp b/common/2d/box.cpp index 08a4271fe..ae0edeacd 100644 --- a/common/2d/box.cpp +++ b/common/2d/box.cpp @@ -44,19 +44,17 @@ static void gr_ubox0(int left,int top,int right,int bot, const uint8_t color) std::fill_n(ptr2 + 1, (right - left) - 1, color); } -static void gr_box0(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot) +#ifdef EDITOR +static void gr_box0(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot, const uint8_t color) { if (top > MAXY ) return; if (left > MAXX ) return; if (bot > MAXY ) bot = MAXY; if (right > MAXX ) right = MAXX; - - const auto color = COLOR; gr_ubox0(left,top,right,bot, color); - } - +#endif static void gr_ubox12(int left,int top,int right,int bot, const uint8_t color) { @@ -79,18 +77,17 @@ static void gr_ubox12(int left,int top,int right,int bot, const uint8_t color) gr_uline(i2f(left), i2f(bot), i2f(right), i2f(bot), color); } -static void gr_box12(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot) +#ifdef EDITOR +static void gr_box12(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot, const uint8_t color) { if (top > MAXY ) return; if (left > MAXX ) return; if (bot > MAXY ) bot = MAXY; if (right > MAXX ) right = MAXX; - - const auto color = COLOR; gr_ubox12(left, top, right, bot, color); - } +#endif void gr_ubox(int left,int top,int right,int bot, const uint8_t color) { @@ -100,12 +97,14 @@ void gr_ubox(int left,int top,int right,int bot, const uint8_t color) gr_ubox12(left, top, right, bot, color); } -void gr_box(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot) +#ifdef EDITOR +void gr_box(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot, const uint8_t color) { if (TYPE==BM_LINEAR) - gr_box0( left, top, right, bot ); + gr_box0(left, top, right, bot, color); else - gr_box12( left, top, right, bot ); + gr_box12(left, top, right, bot, color); } +#endif } diff --git a/common/include/fwd-gr.h b/common/include/fwd-gr.h index 57ebfd241..bde7b6357 100644 --- a/common/include/fwd-gr.h +++ b/common/include/fwd-gr.h @@ -228,7 +228,9 @@ int gr_disk(fix x,fix y,fix r); int gr_ucircle(fix x,fix y,fix r); // Draw an unfilled rectangle into the current canvas -void gr_box(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot); +#ifdef EDITOR +void gr_box(uint_fast32_t left,uint_fast32_t top,uint_fast32_t right,uint_fast32_t bot, uint8_t color); +#endif void gr_ubox(int left,int top,int right,int bot, uint8_t color); void gr_scanline(int x1, int x2, unsigned y, uint8_t color); diff --git a/similar/editor/curves.cpp b/similar/editor/curves.cpp index c650332cf..7d5e6f6ee 100644 --- a/similar/editor/curves.cpp +++ b/similar/editor/curves.cpp @@ -110,9 +110,10 @@ void plot_parametric(vms_equation *coeffs, fix min_t, fix max_t, fix del_t) { fix t, dt; gr_setcolor(15); - gr_box( 75, 40, 325, 290 ); - gr_box( 75, 310, 325, 560 ); - gr_box( 475, 310, 725, 560 ); + const uint8_t color = 15; + gr_box( 75, 40, 325, 290, color); + gr_box( 75, 310, 325, 560, color); + gr_box(475, 310, 725, 560, color); //gr_pal_fade_in( grd_curscreen->pal ); for (t=min_t;t