]> Chaos Git - corbenik/corbenik.git/commitdiff
Shouldn't have done that. Also cleaning.
authorchaoskagami <chaos.kagami@gmail.com>
Fri, 1 Jul 2016 13:19:40 +0000 (09:19 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Fri, 1 Jul 2016 13:19:47 +0000 (09:19 -0400)
source/std/draw.c

index 6fd764a6b2a526a76f3ae084a3a875bbae591e9c..461a37b40fb53d27f14ef3b3ae385d02694a883f 100644 (file)
@@ -169,10 +169,9 @@ void load_bg_top(char* fname_top) {
     }
 
     // See load_bg_bottom for an explanation on the magic value.
-    dim_factor_top = (max - 178);
-
-    if (dim_factor_top < 0)
-        dim_factor_top = 0;
+    dim_factor_top = 0;
+    if (max > 178)
+        dim_factor_top = max - 178;
 }
 
 void load_bg_bottom(char* fname_bottom) {
@@ -196,10 +195,9 @@ void load_bg_bottom(char* fname_bottom) {
     //   The minimum transparency with pure black overlay (I find) is 70% to be readable.
     //   70% of 255 is approximately 178, and 255 - 178 is 77. That's therefore the maximum we want to subtract.
     //   Thus this is the value for 70% transparency.
-    dim_factor_bottom = (max - 178);
-
-    if (dim_factor_bottom < 0)
-        dim_factor_bottom = 0;
+    dim_factor_bottom = 0;
+    if (max > 178)
+        dim_factor_bottom = max - 178;
 }
 
 void set_font(const char* filename) {
@@ -334,9 +332,9 @@ draw_character(uint8_t *screen, const uint32_t character, int ch_x, int ch_y, co
         unsigned char char_dat = ((char*)FCRAM_FONT_LOC)[(character - ' ') * (c_font_w * font_h) + yy];
         for(unsigned int i=0; i < font_w + font_kern; i++) {
             if (color_bg == 0) {
-                screen[pos]     = buffer_bg[pos];
-                screen[pos + 1] = buffer_bg[pos + 1];
-                screen[pos + 2] = buffer_bg[pos + 2];
+                screen[pos]     = 0;
+                screen[pos + 1] = 0;
+                screen[pos + 2] = 0;
                 if (buffer_bg[pos] >= dim_factor)
                     screen[pos]     = buffer_bg[pos] - dim_factor;
                 if (buffer_bg[pos + 1] >= dim_factor)
@@ -351,9 +349,9 @@ draw_character(uint8_t *screen, const uint32_t character, int ch_x, int ch_y, co
 
             if (char_dat & 0x80) {
                 if (color_fg == 0) {
-                    screen[pos]     = buffer_bg[pos];
-                    screen[pos + 1] = buffer_bg[pos + 1];
-                    screen[pos + 2] = buffer_bg[pos + 2];
+                    screen[pos]     = 0;
+                    screen[pos + 1] = 0;
+                    screen[pos + 2] = 0;
                     if (buffer_bg[pos] >= dim_factor)
                         screen[pos]     = buffer_bg[pos] - dim_factor;
                     if (buffer_bg[pos + 1] >= dim_factor)