From: Igor Grinberg Date: Thu, 24 May 2012 14:42:39 +0300 Subject: [U-Boot] [PATCH 2/7] common lcd: simplify #ifdefs In-Reply-To: <1337859764-16086-1-git-send-email-grinberg@compulab.co.il> References: <1337859764-16086-1-git-send-email-grinberg@compulab.co.il> Message-ID: <1337859764-16086-3-git-send-email-grinberg@compulab.co.il> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Nikita Kiryanov Simplify #ifdefs by slightly changing the order of operations Signed-off-by: Nikita Kiryanov Signed-off-by: Igor Grinberg --- common/lcd.c | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-) diff --git a/common/lcd.c b/common/lcd.c index 506a138..3b2f25f 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -525,20 +525,18 @@ void bitmap_plot(int x, int y) fb = (uchar *)(lcd_base + y * lcd_line_length + x); if (NBITS(panel_info.vl_bpix) < 12) { - /* Leave room for default color map */ + /* Leave room for default color map + * default case: generic system with no cmap (most likely 16bpp) + * We set cmap to the source palette, so no change is done. + * This avoids even more ifdefs in the next stanza + */ + cmap = bmp_logo_palette; #if defined(CONFIG_CPU_PXA) cmap = (ushort *) fbi->palette; #elif defined(CONFIG_MPC823) cmap = (ushort *) &(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]); #elif defined(CONFIG_ATMEL_LCD) cmap = (uint *) (panel_info.mmio + ATMEL_LCDC_LUT(0)); -#else - /* - * default case: generic system with no cmap (most likely 16bpp) - * We set cmap to the source palette, so no change is done. - * This avoids even more ifdef in the next stanza - */ - cmap = bmp_logo_palette; #endif WATCHDOG_RESET(); @@ -680,14 +678,12 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) for (i = 0; i < colors; ++i) { bmp_color_table_entry_t cte = bmp->color_table[i]; #if !defined(CONFIG_ATMEL_LCD) - ushort colreg = + *cmap = ( ((cte.red) << 8) & 0xf800) | ( ((cte.green) << 3) & 0x07e0) | ( ((cte.blue) >> 3) & 0x001f) ; #ifdef CONFIG_SYS_INVERT_COLORS - *cmap = 0xffff - colreg; -#else - *cmap = colreg; + *cmap = 0xffff - *cmap; #endif #if defined(CONFIG_MPC823) cmap--; -- 1.7.1