From f373c97c90e816404c00ab48b2e36b18fd5e6c49 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Fri, 30 Sep 2022 10:25:28 +0100 Subject: [PATCH] Define LCD_STRIDEFORMAT unconditionally Instead of putting "#ifdef LCD_STRIDEFORMAT" at every usage of the macro it's simpler to have config.h define LCD_STRIDEFORMAT to the default of horizontal stride when the target leaves it unspecified. Change-Id: Ib187012aad65ac678dbd837b1464a83bad722411 --- apps/plugins/SOURCES | 3 +-- apps/plugins/SUBDIRS | 3 +-- apps/plugins/bitmaps/native/SOURCES | 3 +-- apps/plugins/imageviewer/jpeg/yuv2rgb.c | 2 +- apps/plugins/imageviewer/ppm/ppm_decoder.c | 2 +- apps/plugins/invadrox.c | 2 +- apps/plugins/lib/bmp_smooth_scale.c | 2 +- apps/plugins/lib/osd.c | 8 ++++---- apps/plugins/lib/pluginlib_bmp.c | 2 +- apps/plugins/lib/xlcd_scroll.c | 4 ++-- apps/plugins/lua/rocklib_img.c | 2 +- apps/plugins/pictureflow/pictureflow.c | 2 +- apps/plugins/puzzles/rockbox.c | 2 +- apps/plugins/test_viewports.c | 2 +- apps/plugins/xworld/sys.c | 12 ++++++------ apps/recorder/resize.c | 2 +- firmware/SOURCES | 2 +- firmware/drivers/lcd-1bit-vert.c | 2 +- firmware/drivers/lcd-2bit-horz.c | 2 +- firmware/drivers/lcd-2bit-vert.c | 2 +- firmware/drivers/lcd-2bit-vi.c | 2 +- firmware/drivers/lcd-color-common.c | 2 +- firmware/export/config.h | 8 ++++++-- firmware/export/lcd.h | 4 ++-- .../target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 4 ++-- firmware/target/hosted/sdl/lcd-sdl.c | 6 +++--- 26 files changed, 44 insertions(+), 43 deletions(-) diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index 942f9a5b20..85227d80d7 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES @@ -82,8 +82,7 @@ crypt_firmware.c /* Overlays loaders */ -#if defined(HAVE_LCD_COLOR) && \ - (!defined(LCD_STRIDEFORMAT) || (LCD_STRIDEFORMAT != VERTICAL_STRIDE)) +#if defined(HAVE_LCD_COLOR) && (LCD_STRIDEFORMAT == HORIZONTAL_STRIDE) #if (PLUGIN_BUFFER_SIZE > 0x14000) && (CONFIG_PLATFORM & (PLATFORM_NATIVE |PLATFORM_HOSTED)) && (defined(CPU_ARM) || defined(CPU_MIPS)) duke3d.c quake.c diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS index 8479e4b3dd..4cb57edb1b 100644 --- a/apps/plugins/SUBDIRS +++ b/apps/plugins/SUBDIRS @@ -9,8 +9,7 @@ clock #endif /* color horizontal-stride LCDs */ -#if defined(HAVE_LCD_COLOR) && \ - (!defined(LCD_STRIDEFORMAT) || (LCD_STRIDEFORMAT != VERTICAL_STRIDE)) +#if defined(HAVE_LCD_COLOR) && (LCD_STRIDEFORMAT == HORIZONTAL_STRIDE) xworld /* for duke3d, wolf3d and quake */ diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES index f207f358b2..d0cc853f5b 100644 --- a/apps/plugins/bitmaps/native/SOURCES +++ b/apps/plugins/bitmaps/native/SOURCES @@ -548,8 +548,7 @@ pegbox_pieces.9x7x1.bmp #endif /* Puzzles */ -#if defined(HAVE_LCD_COLOR) && \ - (!defined(LCD_STRIDEFORMAT) || (LCD_STRIDEFORMAT != VERTICAL_STRIDE)) +#if defined(HAVE_LCD_COLOR) && (LCD_STRIDEFORMAT == HORIZONTAL_STRIDE) puzzles_cursor.11x16x24.bmp #endif diff --git a/apps/plugins/imageviewer/jpeg/yuv2rgb.c b/apps/plugins/imageviewer/jpeg/yuv2rgb.c index 61d7fd6487..3e7f08d8bc 100644 --- a/apps/plugins/imageviewer/jpeg/yuv2rgb.c +++ b/apps/plugins/imageviewer/jpeg/yuv2rgb.c @@ -238,7 +238,7 @@ static fb_data (* const pixel_funcs[COLOUR_NUM_MODES][DITHER_NUM_MODES])(void) = }; /* These defines are used fornormal horizontal strides and vertical strides. */ -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE #define LCDADDR(x, y) (lcd_fb + LCD_HEIGHT*(x) + (y)) #define ROWENDOFFSET (width*LCD_HEIGHT) #define ROWOFFSET (1) diff --git a/apps/plugins/imageviewer/ppm/ppm_decoder.c b/apps/plugins/imageviewer/ppm/ppm_decoder.c index 4a86be1a3a..ccb208b80b 100644 --- a/apps/plugins/imageviewer/ppm/ppm_decoder.c +++ b/apps/plugins/imageviewer/ppm/ppm_decoder.c @@ -177,7 +177,7 @@ static int read_ppm_row(int fd, struct ppm_info *ppm, int row) int col; int r, g, b; #ifdef HAVE_LCD_COLOR -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE fb_data *dst = (fb_data *) ppm->buf + row; const int stride = ppm->x; #else diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c index a164b95cf0..d130ab6108 100644 --- a/apps/plugins/invadrox.c +++ b/apps/plugins/invadrox.c @@ -785,7 +785,7 @@ static fb_data *lcd_fb; /* No standard get_pixel function yet, use this hack instead */ #if (LCD_DEPTH >= 8) -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE static inline fb_data get_pixel(int x, int y) { return lcd_fb[x*LCD_HEIGHT+y]; diff --git a/apps/plugins/lib/bmp_smooth_scale.c b/apps/plugins/lib/bmp_smooth_scale.c index c5f258cdbf..378ff96448 100644 --- a/apps/plugins/lib/bmp_smooth_scale.c +++ b/apps/plugins/lib/bmp_smooth_scale.c @@ -78,7 +78,7 @@ void smooth_resize_bitmap(struct bitmap *src_bmp, struct bitmap *dest_bmp) fb_data *sptr, *dptr; int x, y, end; int val_y = 0, val_x; -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE const int sw = src_bmp->height; const int sh = src_bmp->width; const int dw = dest_bmp->height; diff --git a/apps/plugins/lib/osd.c b/apps/plugins/lib/osd.c index 7d6e10a410..99f77da7dc 100644 --- a/apps/plugins/lib/osd.c +++ b/apps/plugins/lib/osd.c @@ -106,10 +106,10 @@ static struct osd grey_osd; # error Unknown 2-bit format; please define macros # endif /* LCD_PIXELFORMAT */ #elif LCD_DEPTH == 16 -# if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +# if LCD_STRIDEFORMAT == VERTICAL_STRIDE # define _OSD_HEIGHT2BYTES(h) ((h)*2) # define _OSD_BYTES2HEIGHT(b) ((b)/2) -# else /* !defined(LCD_STRIDEFORMAT) || LCD_STRIDEFORMAT != VERTICAL_STRIDE */ +# else /* LCD_STRIDEFORMAT != VERTICAL_STRIDE */ # define _OSD_WIDTH2BYTES(w) ((w)*2) # define _OSD_BYTES2WIDTH(b) ((b)/2) # endif /* end stride type selection */ @@ -160,7 +160,7 @@ static void * _osd_lcd_init_buffers(struct osd *osd, unsigned flags, rb->viewport_set_fullscreen(&osd->vp, SCREEN_MAIN); -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE int colbytes = _OSD_HEIGHT2BYTES(LCD_HEIGHT); int bytecols = *bufsize / colbytes; int w = _OSD_BYTES2WIDTH(bytecols); @@ -193,7 +193,7 @@ static void * _osd_lcd_init_buffers(struct osd *osd, unsigned flags, w = _OSD_BYTES2WIDTH(_OSD_WIDTH2BYTES(w)); osd->lcd_bitmap_stride = _OSD_BYTES2HEIGHT(_OSD_HEIGHT2BYTES(LCD_HEIGHT)); osd->back_bitmap_stride = h; -#else /* !defined(LCD_STRIDEFORMAT) || LCD_STRIDEFORMAT != VERTICAL_STRIDE */ +#else /* LCD_STRIDEFORMAT != VERTICAL_STRIDE */ int rowbytes = _OSD_WIDTH2BYTES(LCD_WIDTH); int byterows = *bufsize / rowbytes; int w = _OSD_BYTES2WIDTH(rowbytes); diff --git a/apps/plugins/lib/pluginlib_bmp.c b/apps/plugins/lib/pluginlib_bmp.c index f3edfbf425..82f84b05af 100644 --- a/apps/plugins/lib/pluginlib_bmp.c +++ b/apps/plugins/lib/pluginlib_bmp.c @@ -94,7 +94,7 @@ int save_bmp_file( char* filename, struct bitmap *bm ) */ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst) { -#if defined(LCD_STRIDEFORMAT) && (LCD_STRIDEFORMAT == VERTICAL_STRIDE) +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE const int srcw = src->height; const int srch = src->width; const int dstw = dst->height; diff --git a/apps/plugins/lib/xlcd_scroll.c b/apps/plugins/lib/xlcd_scroll.c index 5ac4a366e8..906f4eaae1 100644 --- a/apps/plugins/lib/xlcd_scroll.c +++ b/apps/plugins/lib/xlcd_scroll.c @@ -30,7 +30,7 @@ static const unsigned short patterns[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000}; #endif -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE void xlcd_scroll_left(int count) { /*size_t dst_stride;*/ @@ -668,4 +668,4 @@ void xlcd_scroll_down(int count) } #endif /* LCD_PIXELFORMAT, LCD_DEPTH */ -#endif /* defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE */ +#endif /* LCD_STRIDEFORMAT == VERTICAL_STRIDE */ diff --git a/apps/plugins/lua/rocklib_img.c b/apps/plugins/lua/rocklib_img.c index b0ca769ca4..68e5325ce0 100644 --- a/apps/plugins/lua/rocklib_img.c +++ b/apps/plugins/lua/rocklib_img.c @@ -380,7 +380,7 @@ static inline fb_data* rli_get_element(struct rocklua_image* img, int x, int y) pixel_to_native(x, y, &x, &y); -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE /* column major address */ size_t data_address = (stride * (x - 1)) + (y - 1); diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 0e5585681d..eec8313485 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -3101,7 +3101,7 @@ static void render_slide(struct slide_data *slide, const int alpha) const pix_t *ptr = &src[column * bmp->height]; -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE #define PIXELSTEP_Y 1 #define LCDADDR(x, y) (&buffer[BUFFER_HEIGHT*(x) + (y)]) #else diff --git a/apps/plugins/puzzles/rockbox.c b/apps/plugins/puzzles/rockbox.c index 6e34adb1db..9a82cdde10 100644 --- a/apps/plugins/puzzles/rockbox.c +++ b/apps/plugins/puzzles/rockbox.c @@ -1465,7 +1465,7 @@ static void rb_blitter_free(void *handle, blitter *bl) static void rb_blitter_save(void *handle, blitter *bl, int x, int y) { /* no viewport offset */ -#if defined(LCD_STRIDEFORMAT) && (LCD_STRIDEFORMAT == VERTICAL_STRIDE) +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE #error no vertical stride #else if(bl && bl->bmp.data) diff --git a/apps/plugins/test_viewports.c b/apps/plugins/test_viewports.c index 2bada01f79..76f1a9da9b 100644 --- a/apps/plugins/test_viewports.c +++ b/apps/plugins/test_viewports.c @@ -130,7 +130,7 @@ static void *test_address_fn(int x, int y) struct frame_buffer_t *fb = vp0.buffer; /* LCD_STRIDEFORMAT & LCD_NATIVE_STRIDE macros allow Horiz screens to work with RB */ -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE size_t element = (x * LCD_NATIVE_STRIDE(fb->stride)) + y; #else size_t element = (y * LCD_NATIVE_STRIDE(fb->stride)) + x; diff --git a/apps/plugins/xworld/sys.c b/apps/plugins/xworld/sys.c index c57da9456b..a806de5297 100644 --- a/apps/plugins/xworld/sys.c +++ b/apps/plugins/xworld/sys.c @@ -496,7 +496,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16 for (int i = 0; i < w / 2; ++i) { uint8_t pix1 = *(buf + i) >> 4; uint8_t pix2 = *(buf + i) & 0xF; -#if defined(LCD_STRIDEFORMAT) && (LCD_STRIDEFORMAT == VERTICAL_STRIDE) +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE framebuffer[( (h * 2) ) * 320 + i] = sys->palette[pix1]; framebuffer[( (h * 2) + 1) * 320 + i] = sys->palette[pix2]; #else @@ -515,7 +515,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16 for (int i = 0; i < w / 2; ++i) { uint8_t pix1 = *(buf + i) >> 4; uint8_t pix2 = *(buf + i) & 0xF; -#if defined(LCD_STRIDEFORMAT) && (LCD_STRIDEFORMAT == VERTICAL_STRIDE) +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE framebuffer[(200 - h * 2 ) * 320 + ( 320 - i )] = sys->palette[pix1]; framebuffer[(200 - h * 2 - 1) * 320 + ( 320 - i )] = sys->palette[pix2]; #else @@ -531,7 +531,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16 else { int next = 0; -#if defined(LCD_STRIDEFORMAT) && (LCD_STRIDEFORMAT == VERTICAL_STRIDE) +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE for(int x = 0; x < w / 2; ++x) { for(int y = 0; y < h; ++y) @@ -565,7 +565,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16 struct bitmap in_bmp; if(sys->settings.rotation_option) { -#if defined(LCD_STRIDEFORMAT) && (LCD_STRIDEFORMAT == VERTICAL_STRIDE) +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE in_bmp.width = 320; in_bmp.height = 200; #else @@ -575,7 +575,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16 } else { -#if defined(LCD_STRIDEFORMAT) && (LCD_STRIDEFORMAT == VERTICAL_STRIDE) +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE in_bmp.width = 200; in_bmp.height = 320; #else @@ -600,7 +600,7 @@ void sys_copyRect(struct System* sys, uint16_t x, uint16_t y, uint16_t w, uint16 } else { -#if defined(LCD_STRIDEFORMAT) && (LCD_STRIDEFORMAT == VERTICAL_STRIDE) +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE for(int x = 0; x < 320; ++x) { for(int y = 0; y < 200; ++y) diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c index 6f561039c3..c16cec9dc9 100644 --- a/apps/recorder/resize.c +++ b/apps/recorder/resize.c @@ -593,7 +593,7 @@ static inline bool scale_v_linear(struct rowset *rset, static void output_row_32_native_fromyuv(uint32_t row, void * row_in, struct scaler_context *ctx) { -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE #define DEST_STEP (ctx->bm->height) #define Y_STEP (1) #else diff --git a/firmware/SOURCES b/firmware/SOURCES index 49d1d9ac95..abce59fe04 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -300,7 +300,7 @@ drivers/lcd-2bit-vert.c drivers/lcd-2bit-vi.c #endif /* LCD_PIXELFORMAT */ #elif LCD_DEPTH == 16 -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE drivers/lcd-16bit-vert.c #else drivers/lcd-16bit.c diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index ff95eacdbc..e574d4c191 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c @@ -83,7 +83,7 @@ static void *LCDFN(frameaddress_default)(int x, int y) { /* the default expects a buffer the same size as the screen */ struct frame_buffer_t *fb = CURRENT_VP->buffer; -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE size_t element = (x * LCDM(NATIVE_STRIDE)(fb->stride)) + y; #else size_t element = (y * LCDM(NATIVE_STRIDE)(fb->stride)) + x; diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 66313d624b..1bc489247c 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c @@ -81,7 +81,7 @@ static void *lcd_frameaddress_default(int x, int y) /* the default expects a buffer the same size as the screen */ struct frame_buffer_t *fb = lcd_current_viewport->buffer; -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE size_t element = (x * LCD_NATIVE_STRIDE(fb->stride)) + y; #else size_t element = (y * LCD_NATIVE_STRIDE(fb->stride)) + x; diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index 4ce9960419..b206a2d816 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c @@ -83,7 +83,7 @@ static void *lcd_frameaddress_default(int x, int y) /* the default expects a buffer the same size as the screen */ struct frame_buffer_t *fb = lcd_current_viewport->buffer; -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE size_t element = (x * LCD_NATIVE_STRIDE(fb->stride)) + y; #else size_t element = (y * LCD_NATIVE_STRIDE(fb->stride)) + x; diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c index b969c93216..0bcf60767e 100644 --- a/firmware/drivers/lcd-2bit-vi.c +++ b/firmware/drivers/lcd-2bit-vi.c @@ -95,7 +95,7 @@ static void *LCDFN(frameaddress_default)(int x, int y) { /* the default expects a buffer the same size as the screen */ struct frame_buffer_t *fb = CURRENT_VP->buffer; -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE size_t element = (x * LCDM(NATIVE_STRIDE)(fb->stride)) + y; #else size_t element = (y * LCDM(NATIVE_STRIDE)(fb->stride)) + x; diff --git a/firmware/drivers/lcd-color-common.c b/firmware/drivers/lcd-color-common.c index 36144b574c..9feba9f894 100644 --- a/firmware/drivers/lcd-color-common.c +++ b/firmware/drivers/lcd-color-common.c @@ -76,7 +76,7 @@ static void *lcd_frameaddress_default(int x, int y) /* the default expects a buffer the same size as the screen */ struct frame_buffer_t *fb = lcd_current_viewport->buffer; -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE size_t element = (x * LCD_NATIVE_STRIDE(fb->stride)) + y; #else size_t element = (y * LCD_NATIVE_STRIDE(fb->stride)) + x; diff --git a/firmware/export/config.h b/firmware/export/config.h index 2519b87f0d..e83194e0f4 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -772,6 +772,11 @@ Lyre prototype 1 */ #define LCD_SPLIT_LINES 0 #endif +/* Most displays have a horizontal stride */ +#ifndef LCD_STRIDEFORMAT +# define LCD_STRIDEFORMAT HORIZONTAL_STRIDE +#endif + /* Simulator LCD dimensions. Set to standard dimensions if undefined */ #ifndef SIM_LCD_WIDTH #define SIM_LCD_WIDTH LCD_WIDTH @@ -978,8 +983,7 @@ Lyre prototype 1 */ || defined(CPU_S5L870X) || (CONFIG_CPU == S3C2440) \ || defined(APPLICATION) || (CONFIG_CPU == PP5002) \ || (CONFIG_CPU == RK27XX) || (CONFIG_CPU == IMX233) || \ - (defined(HAVE_LCD_COLOR) && \ - (!defined(LCD_STRIDEFORMAT) || (LCD_STRIDEFORMAT != VERTICAL_STRIDE))) + (defined(HAVE_LCD_COLOR) && (LCD_STRIDEFORMAT == HORIZONTAL_STRIDE)) #define HAVE_SEMAPHORE_OBJECTS #endif diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 0edef7b866..67b22190ad 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -82,7 +82,7 @@ enum screen_type { struct scrollinfo; -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE #define STRIDE_MAIN(w, h) (h) #else #define STRIDE_MAIN(w, h) (w) @@ -496,7 +496,7 @@ typedef void lcd_blockfunc_type(fb_data *address, unsigned mask, unsigned bits); #endif #ifndef LCD_NBELEMS -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE #define LCD_NBELEMS(w, h) (((w-1)*STRIDE_MAIN(w, h)) + h) #else #define LCD_NBELEMS(w, h) (((h-1)*STRIDE_MAIN(w, h)) + w) diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c index d952d3d40d..8620c672e1 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c @@ -38,7 +38,7 @@ #if CONFIG_ORIENTATION == SCREEN_PORTRAIT #define LCD_USE_DMA -#elif defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#elif LCD_STRIDEFORMAT == VERTICAL_STRIDE #define LCD_USE_DMA #endif @@ -511,7 +511,7 @@ void lcd_update_rect(int x, int y, int width, int height) #else -#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE +#if LCD_STRIDEFORMAT == VERTICAL_STRIDE #if defined(LCD_USE_DMA) dma_start_transfer16( (char *)FBADDR(0,0), x, y, LCD_HEIGHT, diff --git a/firmware/target/hosted/sdl/lcd-sdl.c b/firmware/target/hosted/sdl/lcd-sdl.c index de19de365a..8cbb6c5651 100644 --- a/firmware/target/hosted/sdl/lcd-sdl.c +++ b/firmware/target/hosted/sdl/lcd-sdl.c @@ -31,9 +31,9 @@ void sdl_update_rect(SDL_Surface *surface, int x_start, int y_start, int width, unsigned long (*getpixel)(int, int)) { SDL_Rect dest; -#if LCD_DEPTH >= 8 && (LCD_PIXELFORMAT == RGB565) \ - && !defined(LCD_STRIDEFORMAT) && !defined(HAVE_LCD_SPLIT) \ - && !defined(HAVE_REMOTE_LCD) +#if LCD_DEPTH >= 8 && (LCD_PIXELFORMAT == RGB565) && \ + (LCD_STRIDEFORMAT == HORIZONTAL_STRIDE) && \ + !defined(HAVE_LCD_SPLIT) && !defined(HAVE_REMOTE_LCD) SDL_Rect src; (void)max_x; (void)max_y;