[Horus] Bitmaps must be word aligned!

This commit is contained in:
Bertrand Songis
2016-01-09 01:05:09 +01:00
parent 87f8ea516b
commit 1ff32c64f5
9 changed files with 44 additions and 38 deletions
+16 -16
View File
@@ -200,31 +200,31 @@ const uint8_t * const LBM_MODEL_ICONS[] = {
* Model selection screen bitmaps
*/
const uint8_t LBM_LIBRARY_ICON[] = {
const uint8_t LBM_LIBRARY_ICON[] __attribute__((aligned(32))) = {
#include "mask_library.lbm"
};
const uint8_t LBM_LIBRARY_SLOT[] = {
const uint8_t LBM_LIBRARY_SLOT[] __attribute__((aligned(32))) = {
#include "mask_library_slot.lbm"
};
const uint8_t LBM_LIBRARY_CURSOR[] = {
const uint8_t LBM_LIBRARY_CURSOR[] __attribute__((aligned(32))) = {
#include "mask_library_category_index.lbm"
};
const uint8_t LBM_SCORE0[] = {
const uint8_t LBM_SCORE0[] __attribute__((aligned(32))) = {
#include "mask_library_score_0.lbm"
};
const uint8_t LBM_SCORE1[] = {
const uint8_t LBM_SCORE1[] __attribute__((aligned(32))) = {
#include "mask_library_score_1.lbm"
};
const uint8_t LBM_STAR0[] = {
const uint8_t LBM_STAR0[] __attribute__((aligned(32))) = {
#include "mask_library_star_0.lbm"
};
const uint8_t LBM_STAR1[] = {
const uint8_t LBM_STAR1[] __attribute__((aligned(32))) = {
#include "mask_library_star_1.lbm"
};
@@ -232,30 +232,30 @@ const uint8_t LBM_STAR1[] = {
* Other
*/
const uint8_t LBM_ASTERISK[] = {
const uint8_t LBM_ASTERISK[] __attribute__((aligned(32))) = {
#include "asterisk.lbm"
};
const uint8_t LBM_POINT[] = {
const uint8_t LBM_POINT[] __attribute__((aligned(32))) = {
#include "mask_point.lbm"
};
const uint8_t LBM_CURVE_POINT[] = {
const uint8_t LBM_CURVE_POINT[] __attribute__((aligned(32))) = {
#include "mask_cvpoint.lbm"
};
const uint8_t LBM_CURVE_POINT_CENTER[] = {
const uint8_t LBM_CURVE_POINT_CENTER[] __attribute__((aligned(32))) = {
#include "mask_cvpoint_center.lbm"
};
const uint8_t LBM_CURVE_COORD_SHADOW[] = {
const uint8_t LBM_CURVE_COORD_SHADOW[] __attribute__((aligned(32))) = {
#include "mask_coord_shadow.lbm"
};
/*
const uint8_t LBM_SHUTDOWN[] = {
const uint8_t LBM_SHUTDOWN[] __attribute__((aligned(32))) = {
#include "shutdown.lbm"
};
const uint8_t LBM_SLEEP[] = {
const uint8_t LBM_SLEEP[] __attribute__((aligned(32))) = {
#include "sleep.lbm"
}; */
};
+1
View File
@@ -119,6 +119,7 @@ extern const uint8_t LBM_STAR0[];
extern const uint8_t LBM_STAR1[];
// Other icons
extern const uint8_t LBM_SPLASH[];
extern const uint8_t LBM_ASTERISK[];
extern const uint8_t LBM_POINT[];
extern const uint8_t LBM_CURVE_POINT[];
+10 -10
View File
@@ -870,17 +870,17 @@ inline void lcdDrawBitmapDMA(coord_t x, coord_t y, coord_t width, coord_t height
#endif
#if !defined(BOOT)
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, coord_t width, int scale)
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, coord_t height, int scale)
{
int w = getBitmapWidth(bmp);
int height = getBitmapHeight(bmp);
int width = getBitmapWidth(bmp);
int h = getBitmapHeight(bmp);
if (!width || width > w) {
width = w;
if (!height || height > h) {
height = h;
}
if (x+width > LCD_W) {
width = LCD_W-x;
if (x+height > LCD_W) {
height = LCD_W-x;
}
if (width == 0 || height == 0) {
@@ -888,12 +888,12 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, co
}
if (scale == 0) {
lcdDrawBitmapDMA(x, y, width, height, bmp+4);
lcdDrawBitmapDMA(x, y, width, height, bmp + 4 + offset*width*2);
}
else if (scale < 0) {
for (coord_t i=0, row=0; row<height; i+=1, row-=scale) {
display_t * p = &displayBuf[(y+i)*LCD_W + x];
const uint8_t * q = bmp + 4 + (row*w + offset) * 2;
const uint8_t * q = bmp + 4 + (offset+row)*width*2;
for (coord_t col=0; col<width; col-=scale) {
lcdDrawPixel(p, *((uint16_t *)q));
p++; q-=2*scale;
@@ -904,7 +904,7 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, co
for (coord_t row=0; row<height; row++) {
for (int i=0; i<scale; i++) {
display_t * p = &displayBuf[(y+scale*row+i)*LCD_W + x];
const uint8_t * q = bmp + 4 + (row*w + offset) * 2;
const uint8_t * q = bmp + 4 + (offset+row)*width*2;
for (coord_t col=0; col<width; col++) {
for (int j=0; j<scale; j++) {
lcdDrawPixel(p, *((uint16_t *)q));
+1 -1
View File
@@ -303,7 +303,7 @@ inline int getBitmapScaledSize(int size, int scale)
int getBitmapScale(const uint8_t * bmp, int dstWidth, int dstHeight);
int getTextWidth(const pm_char *s, int len=0, LcdFlags flags=0);
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_t width=0, int scale=0);
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_t height=0, int scale=0);
void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags flags=0, coord_t offset=0, coord_t width=0);
#define lcdSetRefVolt(...)
+2 -2
View File
@@ -20,8 +20,8 @@
#include "../../opentx.h"
const uint8_t LBM_SPLASH[] = {
#include "../../bitmaps/horus/splash.lbm"
const uint8_t LBM_SPLASH[] __attribute__((aligned(32))) = {
#include "splash.lbm"
};
#if defined(SPLASH)
+10 -6
View File
@@ -324,16 +324,20 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
}
#endif
#define SLEEP_BITMAP_WIDTH 60
#define SLEEP_BITMAP_HEIGHT 60
void drawSleepBitmap()
{
/* lcdClear();
lcdDrawBitmap(POPUP_X-80, POPUP_Y-30, LBM_SLEEP);
lcdRefresh(); */
lcdClear();
lcdDrawBitmap((LCD_W-SLEEP_BITMAP_WIDTH)/2, (LCD_H-SLEEP_BITMAP_HEIGHT)/2, LBM_SLEEP);
lcdRefresh();
}
#define SHUTDOWN_BITMAP_WIDTH 60
#define SHUTDOWN_BITMAP_HEIGHT 60
void drawShutdownBitmap(uint8_t index)
{
/*lcdClear();
lcdDrawBitmap(76, 2, LBM_SHUTDOWN, index * 60, 60);
lcdRefresh();*/
lcdClear();
lcdDrawBitmap((LCD_W-SHUTDOWN_BITMAP_WIDTH)/2, (LCD_H-SHUTDOWN_BITMAP_HEIGHT)/2, LBM_SHUTDOWN, index*SHUTDOWN_BITMAP_WIDTH, SHUTDOWN_BITMAP_WIDTH);
lcdRefresh();
}