summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-10-27 20:17:28 -0400
committerFranklin Wei <git@fwei.tk>2017-10-27 20:17:28 -0400
commit9ba899f85040f729d2b5dbfa9a2ae157d38ae576 (patch)
tree637831e74a2cce2c15981d6b03aede083dea94d6
parent8b8e25f1954ab3313e3940cdd1348785d78b682e (diff)
downloadrockbox-9ba899f.tar.gz
rockbox-9ba899f.tar.bz2
rockbox-9ba899f.zip
puzzles: fix clipping and 24-bit handling
Should fix the build. Change-Id: I68f06702570389c2c9d0d76acc064c324cac457b
-rw-r--r--apps/plugins/puzzles/rockbox.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c
index 7b838ddb79..59984a7891 100644
--- a/apps/plugins/puzzles/rockbox.c
+++ b/apps/plugins/puzzles/rockbox.c
@@ -111,7 +111,15 @@ static void zoom_drawpixel(int x, int y)
if(x < zoom_clipl || x >= zoom_clipr)
return;
+#if LCD_DEPTH == 24
+ /* I hate these */
+ unsigned int pix = rb->lcd_get_foreground();
+ zoom_fb[y * zoom_w + x].b = RGB_UNPACK_BLUE(pix);
+ zoom_fb[y * zoom_w + x].g = RGB_UNPACK_GREEN(pix);
+ zoom_fb[y * zoom_w + x].r = RGB_UNPACK_RED(pix);
+#else
zoom_fb[y * zoom_w + x] = rb->lcd_get_foreground();
+#endif
}
static void zoom_hline(int l, int r, int y)
@@ -130,7 +138,14 @@ static void zoom_hline(int l, int r, int y)
if(r >= zoom_clipr)
r = zoom_clipr;
+#if LCD_DEPTH == 24
+ fb_data pixel = { RGB_UNPACK_BLUE(rb->lcd_get_foreground()),
+ RGB_UNPACK_GREEN(rb->lcd_get_foreground()),
+ RGB_UNPACK_RED(rb->lcd_get_foreground()) };
+#else
fb_data pixel = rb->lcd_get_foreground();
+#endif
+
fb_data *ptr = zoom_fb + y * zoom_w + l;
for(int i = 0; i < r - l; ++i)
*ptr++ = pixel;
@@ -202,7 +217,15 @@ static void zoom_mono_bitmap(const unsigned char *bits, int x, int y, int w, int
for(int dy = 0; dy < 8; ++dy)
{
if(column & 1)
+ {
+#if LCD_DEPTH == 24
+ zoom_fb[(y + i * 8 + dy) * zoom_w + x + j].b = RGB_UNPACK_BLUE(LCD_BLACK);
+ zoom_fb[(y + i * 8 + dy) * zoom_w + x + j].g = RGB_UNPACK_GREEN(LCD_BLACK);
+ zoom_fb[(y + i * 8 + dy) * zoom_w + x + j].r = RGB_UNPACK_RED(LCD_BLACK);
+#else
zoom_fb[(y + i * 8 + dy) * zoom_w + x + j] = LCD_BLACK;
+#endif
+ }
column >>= 1;
}
}
@@ -280,9 +303,9 @@ static void rb_unclip(void *handle)
else
{
zoom_clipu = 0;
- zoom_clipd = LCD_HEIGHT;
+ zoom_clipd = zoom_h;
zoom_clipl = 0;
- zoom_clipr = LCD_WIDTH;
+ zoom_clipr = zoom_w;
}
}
@@ -522,11 +545,11 @@ static void rb_draw_rect(void *handle, int x, int y, int w, int h, int color)
else
{
/* TODO: clipping */
+ rb_color(color);
for(int i = y; i < y + h; ++i)
- for(int j = x; j < x + w; ++j)
- {
- zoom_fb[i * zoom_w + j] = colors[color];
- }
+ {
+ zoom_hline(x, x + w, i);
+ }
}
}