/*#*
*#* $Log$
+ *#* Revision 1.5 2006/02/15 09:13:16 bernie
+ *#* Switch to BITMAP_FMT_PLANAR_V_LSB.
+ *#*
+ *#* Revision 1.4 2006/02/10 12:33:49 bernie
+ *#* Make emulator display a bit larger.
+ *#*
+ *#* Revision 1.3 2006/01/23 23:11:07 bernie
+ *#* Use RASTER_SIZE() to compute... err... the raster size.
+ *#*
*#* Revision 1.2 2006/01/17 02:30:43 bernie
*#* Fix QImage format.
*#*
#include "lcd_gfx_qt.h"
#include <emul/emul.h>
#include <cfg/debug.h>
+#include <gfx/gfx.h> // CONFIG_BITMAP_FMT
#include <qpainter.h>
#include <qimage.h>
void EmulLCD::writeRaster(uint8_t *new_raster)
{
+#if CONFIG_BITMAP_FMT == BITMAP_FMT_PLANAR_H_MSB
+
+ /* Straight copy */
memcpy(raster, new_raster, sizeof(raster));
+#elif CONFIG_BITMAP_FMT == BITMAP_FMT_PLANAR_V_LSB
+
+ /* Rotation */
+ for (int y = 0; y < HEIGHT; ++y)
+ {
+ for (int xbyte = 0; xbyte < WIDTH/8; ++xbyte)
+ {
+ uint8_t v = 0;
+ for (int xbit = 0; xbit < 8; ++xbit)
+ v |= (new_raster[(xbyte * 8 + xbit) + (y / 8) * WIDTH] & (1 << (y%8)) )
+ ? (1 << (7 - xbit)) : 0;
+
+ raster[y * ((WIDTH + 7) / 8) + xbyte] = v;
+ }
+ }
+
+#else
+ #error Unsupported bitmap format
+#endif
+
QPainter p(this);
drawContents(&p);
}
/*!
* Raster buffer to draw into.
+ *
* Bits in the bitmap bytes have vertical orientation,
* as required by the LCD driver.
*/
DECLARE_WALL(wall_before_raster, WALL_SIZE)
-static uint8_t lcd_raster[(EmulLCD::WIDTH + 7 / 8) * EmulLCD::HEIGHT];
+static uint8_t lcd_raster[RASTER_SIZE(EmulLCD::WIDTH, EmulLCD::HEIGHT)];
DECLARE_WALL(wall_after_raster, WALL_SIZE)
/*! Default LCD bitmap */
struct Bitmap lcd_bitmap;
-extern "C" void lcd_init(void)
+/*extern "C"*/ void lcd_init(void)
{
- //INIT_WALL(wall_before_raster);
- //INIT_WALL(wall_after_raster);
+ //FIXME INIT_WALL(wall_before_raster);
+ //FIXME INIT_WALL(wall_after_raster);
gfx_bitmapInit(&lcd_bitmap, lcd_raster, EmulLCD::WIDTH, EmulLCD::HEIGHT);
gfx_bitmapClear(&lcd_bitmap);
}
-extern "C" void lcd_blit_bitmap(Bitmap *bm)
+/*extern "C"*/ void lcd_blit_bitmap(Bitmap *bm)
{
- //CHECK_WALL(wall_before_raster);
- //CHECK_WALL(wall_after_raster);
+ //FIXME CHECK_WALL(wall_before_raster);
+ //FIXME CHECK_WALL(wall_after_raster);
emul->emulLCD->writeRaster(bm->raster);
}