2002-09-23 11:17:52 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Alan Korr
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-09-23 11:17:52 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2008-03-09 18:27:12 +00:00
|
|
|
|
2002-09-23 11:17:52 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "lcd.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "thread.h"
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "file.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "font.h"
|
2005-12-06 13:27:15 +00:00
|
|
|
#include "rbunicode.h"
|
2005-08-08 19:23:28 +00:00
|
|
|
#include "bidi.h"
|
2007-07-28 08:12:05 +00:00
|
|
|
#include "scroll_engine.h"
|
2002-10-21 13:14:25 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
#ifndef LCDFN /* Not compiling for remote - define macros for main LCD. */
|
|
|
|
#define LCDFN(fn) lcd_ ## fn
|
|
|
|
#define FBFN(fn) fb_ ## fn
|
2012-02-22 10:18:05 +00:00
|
|
|
#define FBSIZE FRAMEBUFFER_SIZE
|
2008-03-09 18:27:12 +00:00
|
|
|
#define LCDM(ma) LCD_ ## ma
|
2008-04-12 07:53:33 +00:00
|
|
|
#define LCDNAME "lcd_"
|
2012-02-22 10:18:05 +00:00
|
|
|
#define LCDFB(x,y) FBADDR(x, y)
|
2008-03-09 18:27:12 +00:00
|
|
|
#define MAIN_LCD
|
|
|
|
#endif
|
|
|
|
|
2005-06-23 16:53:54 +00:00
|
|
|
/*** globals ***/
|
2012-02-22 10:18:05 +00:00
|
|
|
FBFN(data) LCDFN(static_framebuffer)[LCDM(FBHEIGHT)][LCDM(FBWIDTH)] IRAM_LCDFRAMEBUFFER;
|
|
|
|
FBFN(data) *LCDFN(framebuffer) = &LCDFN(static_framebuffer)[0][0];
|
2003-01-23 14:24:52 +00:00
|
|
|
|
2008-01-07 20:34:11 +00:00
|
|
|
static struct viewport default_vp =
|
|
|
|
{
|
|
|
|
.x = 0,
|
|
|
|
.y = 0,
|
2008-03-09 18:27:12 +00:00
|
|
|
.width = LCDM(WIDTH),
|
|
|
|
.height = LCDM(HEIGHT),
|
2008-01-07 20:34:11 +00:00
|
|
|
.font = FONT_SYSFIXED,
|
|
|
|
.drawmode = DRMODE_SOLID,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct viewport* current_vp = &default_vp;
|
|
|
|
|
|
|
|
/*** Viewports ***/
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(set_viewport)(struct viewport* vp)
|
2008-01-07 20:34:11 +00:00
|
|
|
{
|
|
|
|
if (vp == NULL)
|
|
|
|
current_vp = &default_vp;
|
|
|
|
else
|
|
|
|
current_vp = vp;
|
2009-11-07 18:38:46 +00:00
|
|
|
|
|
|
|
#if defined(SIMULATOR)
|
|
|
|
/* Force the viewport to be within bounds. If this happens it should
|
|
|
|
* be considered an error - the viewport will not draw as it might be
|
|
|
|
* expected.
|
|
|
|
*/
|
|
|
|
if((unsigned) current_vp->x > (unsigned) LCDM(WIDTH)
|
|
|
|
|| (unsigned) current_vp->y > (unsigned) LCDM(HEIGHT)
|
|
|
|
|| current_vp->x + current_vp->width > LCDM(WIDTH)
|
|
|
|
|| current_vp->y + current_vp->height > LCDM(HEIGHT))
|
|
|
|
{
|
|
|
|
#if !defined(HAVE_VIEWPORT_CLIP)
|
|
|
|
DEBUGF("ERROR: "
|
|
|
|
#else
|
|
|
|
DEBUGF("NOTE: "
|
|
|
|
#endif
|
|
|
|
"set_viewport out of bounds: x: %d y: %d width: %d height:%d\n",
|
|
|
|
current_vp->x, current_vp->y,
|
|
|
|
current_vp->width, current_vp->height);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2008-01-07 20:34:11 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(update_viewport)(void)
|
2008-01-07 20:34:11 +00:00
|
|
|
{
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(update_rect)(current_vp->x, current_vp->y,
|
|
|
|
current_vp->width, current_vp->height);
|
2008-01-07 20:34:11 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(update_viewport_rect)(int x, int y, int width, int height)
|
2008-01-07 20:34:11 +00:00
|
|
|
{
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(update_rect)(current_vp->x + x, current_vp->y + y, width, height);
|
2008-01-07 20:34:11 +00:00
|
|
|
}
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2005-06-23 16:53:54 +00:00
|
|
|
/* LCD init */
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(init)(void)
|
2002-09-23 11:17:52 +00:00
|
|
|
{
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(clear_display)();
|
|
|
|
LCDFN(init_device)();
|
|
|
|
#ifdef MAIN_LCD
|
2007-07-28 08:12:05 +00:00
|
|
|
scroll_init();
|
2008-03-09 18:27:12 +00:00
|
|
|
#endif
|
2002-09-23 11:17:52 +00:00
|
|
|
}
|
|
|
|
|
2005-06-23 16:53:54 +00:00
|
|
|
/*** parameter handling ***/
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(set_drawmode)(int mode)
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
2008-01-07 20:34:11 +00:00
|
|
|
current_vp->drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID);
|
2005-06-24 22:33:21 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
int LCDFN(get_drawmode)(void)
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
2008-01-07 20:34:11 +00:00
|
|
|
return current_vp->drawmode;
|
2005-06-24 22:33:21 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
int LCDFN(getwidth)(void)
|
2008-01-07 20:34:11 +00:00
|
|
|
{
|
|
|
|
return current_vp->width;
|
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
int LCDFN(getheight)(void)
|
2008-01-07 20:34:11 +00:00
|
|
|
{
|
|
|
|
return current_vp->height;
|
2002-09-23 11:17:52 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(setfont)(int newfont)
|
2002-09-23 11:17:52 +00:00
|
|
|
{
|
2008-01-07 20:34:11 +00:00
|
|
|
current_vp->font = newfont;
|
2002-09-23 11:17:52 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
int LCDFN(getfont)(void)
|
2008-01-08 01:22:14 +00:00
|
|
|
{
|
|
|
|
return current_vp->font;
|
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
int LCDFN(getstringsize)(const unsigned char *str, int *w, int *h)
|
2002-09-23 11:17:52 +00:00
|
|
|
{
|
2008-01-07 20:34:11 +00:00
|
|
|
return font_getstringsize(str, w, h, current_vp->font);
|
2002-09-23 11:17:52 +00:00
|
|
|
}
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
/*** low-level drawing functions ***/
|
2005-06-23 16:53:54 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
static void setpixel(int x, int y)
|
2003-04-16 00:12:31 +00:00
|
|
|
{
|
2012-02-22 10:18:05 +00:00
|
|
|
*LCDFB(x,y>>3) |= BIT_N(y & 7);
|
2003-04-16 00:12:31 +00:00
|
|
|
}
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
static void clearpixel(int x, int y)
|
2002-09-23 11:17:52 +00:00
|
|
|
{
|
2012-02-22 10:18:05 +00:00
|
|
|
*LCDFB(x,y>>3) &= ~BIT_N(y & 7);
|
2005-06-23 16:53:54 +00:00
|
|
|
}
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
static void flippixel(int x, int y)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
2012-02-22 10:18:05 +00:00
|
|
|
*LCDFB(x,y>>3) ^= BIT_N(y & 7);
|
2005-06-23 16:53:54 +00:00
|
|
|
}
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
static void nopixel(int x, int y)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
2005-06-24 22:33:21 +00:00
|
|
|
(void)x;
|
|
|
|
(void)y;
|
2005-06-23 16:53:54 +00:00
|
|
|
}
|
2004-01-13 14:59:51 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(pixelfunc_type)* const LCDFN(pixelfuncs)[8] = {
|
2005-06-28 23:15:47 +00:00
|
|
|
flippixel, nopixel, setpixel, setpixel,
|
|
|
|
nopixel, clearpixel, nopixel, clearpixel
|
|
|
|
};
|
2005-06-24 22:33:21 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
static void ICODE_ATTR flipblock(FBFN(data) *address, unsigned mask,
|
|
|
|
unsigned bits)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
2005-07-04 06:20:50 +00:00
|
|
|
*address ^= bits & mask;
|
2005-06-24 22:33:21 +00:00
|
|
|
}
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
static void ICODE_ATTR bgblock(FBFN(data) *address, unsigned mask,
|
|
|
|
unsigned bits)
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
2005-07-04 06:20:50 +00:00
|
|
|
*address &= bits | ~mask;
|
2005-06-24 22:33:21 +00:00
|
|
|
}
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
static void ICODE_ATTR fgblock(FBFN(data) *address, unsigned mask,
|
|
|
|
unsigned bits)
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
2005-07-04 06:20:50 +00:00
|
|
|
*address |= bits & mask;
|
2005-06-24 22:33:21 +00:00
|
|
|
}
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
static void ICODE_ATTR solidblock(FBFN(data) *address, unsigned mask,
|
|
|
|
unsigned bits)
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
2006-07-18 00:04:43 +00:00
|
|
|
unsigned data = *(char*)address;
|
|
|
|
|
|
|
|
bits ^= data;
|
|
|
|
*address = data ^ (bits & mask);
|
2005-06-24 22:33:21 +00:00
|
|
|
}
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
static void ICODE_ATTR flipinvblock(FBFN(data) *address, unsigned mask,
|
|
|
|
unsigned bits)
|
2005-06-28 23:15:47 +00:00
|
|
|
{
|
2005-07-04 06:20:50 +00:00
|
|
|
*address ^= ~bits & mask;
|
2005-06-28 23:15:47 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
static void ICODE_ATTR bginvblock(FBFN(data) *address, unsigned mask,
|
|
|
|
unsigned bits)
|
2005-06-28 23:15:47 +00:00
|
|
|
{
|
|
|
|
*address &= ~(bits & mask);
|
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
static void ICODE_ATTR fginvblock(FBFN(data) *address, unsigned mask,
|
|
|
|
unsigned bits)
|
2005-06-28 23:15:47 +00:00
|
|
|
{
|
2005-07-04 06:20:50 +00:00
|
|
|
*address |= ~bits & mask;
|
2005-06-28 23:15:47 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
static void ICODE_ATTR solidinvblock(FBFN(data) *address, unsigned mask,
|
|
|
|
unsigned bits)
|
2005-06-28 23:15:47 +00:00
|
|
|
{
|
2006-07-18 00:04:43 +00:00
|
|
|
unsigned data = *(char *)address;
|
|
|
|
|
|
|
|
bits = ~bits ^ data;
|
|
|
|
*address = data ^ (bits & mask);
|
2005-06-28 23:15:47 +00:00
|
|
|
}
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(blockfunc_type)* const LCDFN(blockfuncs)[8] = {
|
2005-06-28 23:15:47 +00:00
|
|
|
flipblock, bgblock, fgblock, solidblock,
|
|
|
|
flipinvblock, bginvblock, fginvblock, solidinvblock
|
|
|
|
};
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
/*** drawing functions ***/
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
/* Clear the whole display */
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(clear_display)(void)
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
2008-01-07 20:34:11 +00:00
|
|
|
unsigned bits = (current_vp->drawmode & DRMODE_INVERSEVID) ? 0xFFu : 0;
|
2005-06-25 00:28:09 +00:00
|
|
|
|
2012-02-22 10:18:05 +00:00
|
|
|
memset(LCDFN(framebuffer), bits, FBSIZE);
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(scroll_info).lines = 0;
|
2005-06-24 22:33:21 +00:00
|
|
|
}
|
2002-09-24 22:44:59 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
/* Clear the current viewport */
|
|
|
|
void LCDFN(clear_viewport)(void)
|
2008-01-07 20:34:11 +00:00
|
|
|
{
|
|
|
|
int oldmode;
|
|
|
|
|
|
|
|
if (current_vp == &default_vp)
|
|
|
|
{
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(clear_display)();
|
2008-01-07 20:34:11 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
oldmode = current_vp->drawmode;
|
|
|
|
|
|
|
|
/* Invert the INVERSEVID bit and set basic mode to SOLID */
|
|
|
|
current_vp->drawmode = (~current_vp->drawmode & DRMODE_INVERSEVID) |
|
|
|
|
DRMODE_SOLID;
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(fillrect)(0, 0, current_vp->width, current_vp->height);
|
2008-01-07 20:34:11 +00:00
|
|
|
|
|
|
|
current_vp->drawmode = oldmode;
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(scroll_stop)(current_vp);
|
2008-01-07 20:34:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
/* Set a single pixel */
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(drawpixel)(int x, int y)
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
2009-11-07 18:38:46 +00:00
|
|
|
if ( ((unsigned)x < (unsigned)current_vp->width)
|
|
|
|
&& ((unsigned)y < (unsigned)current_vp->height)
|
|
|
|
#if defined(HAVE_VIEWPORT_CLIP)
|
|
|
|
&& ((unsigned)x < (unsigned)LCDM(WIDTH))
|
|
|
|
&& ((unsigned)y < (unsigned)LCDM(HEIGHT))
|
|
|
|
#endif
|
|
|
|
)
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(pixelfuncs)[current_vp->drawmode](current_vp->x + x, current_vp->y + y);
|
2005-06-23 16:53:54 +00:00
|
|
|
}
|
2004-05-14 23:53:25 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
/* Draw a line */
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(drawline)(int x1, int y1, int x2, int y2)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
|
|
|
int numpixels;
|
|
|
|
int i;
|
|
|
|
int deltax, deltay;
|
|
|
|
int d, dinc1, dinc2;
|
|
|
|
int x, xinc1, xinc2;
|
|
|
|
int y, yinc1, yinc2;
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(pixelfunc_type) *pfunc = LCDFN(pixelfuncs)[current_vp->drawmode];
|
2005-06-23 16:53:54 +00:00
|
|
|
|
|
|
|
deltax = abs(x2 - x1);
|
2008-04-12 07:53:33 +00:00
|
|
|
if (deltax == 0)
|
|
|
|
{
|
2010-02-20 06:42:45 +00:00
|
|
|
/* DEBUGF(LCDNAME "drawline() called for vertical line - optimisation.\n"); */
|
2008-04-12 07:53:33 +00:00
|
|
|
LCDFN(vline)(x1, y1, y2);
|
|
|
|
return;
|
|
|
|
}
|
2005-06-23 16:53:54 +00:00
|
|
|
deltay = abs(y2 - y1);
|
2008-04-12 07:53:33 +00:00
|
|
|
if (deltay == 0)
|
|
|
|
{
|
2010-02-20 06:42:45 +00:00
|
|
|
/* DEBUGF(LCDNAME "drawline() called for horizontal line - optimisation.\n"); */
|
2008-04-12 07:53:33 +00:00
|
|
|
LCDFN(hline)(x1, x2, y1);
|
|
|
|
return;
|
|
|
|
}
|
2005-06-24 22:33:21 +00:00
|
|
|
xinc2 = 1;
|
|
|
|
yinc2 = 1;
|
2005-06-23 16:53:54 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
if (deltax >= deltay)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
|
|
|
numpixels = deltax;
|
|
|
|
d = 2 * deltay - deltax;
|
|
|
|
dinc1 = deltay * 2;
|
|
|
|
dinc2 = (deltay - deltax) * 2;
|
|
|
|
xinc1 = 1;
|
|
|
|
yinc1 = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
numpixels = deltay;
|
|
|
|
d = 2 * deltax - deltay;
|
|
|
|
dinc1 = deltax * 2;
|
|
|
|
dinc2 = (deltax - deltay) * 2;
|
|
|
|
xinc1 = 0;
|
|
|
|
yinc1 = 1;
|
|
|
|
}
|
|
|
|
numpixels++; /* include endpoints */
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
if (x1 > x2)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
|
|
|
xinc1 = -xinc1;
|
|
|
|
xinc2 = -xinc2;
|
|
|
|
}
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
if (y1 > y2)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
|
|
|
yinc1 = -yinc1;
|
|
|
|
yinc2 = -yinc2;
|
|
|
|
}
|
|
|
|
|
|
|
|
x = x1;
|
|
|
|
y = y1;
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
for (i = 0; i < numpixels; i++)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
2009-11-07 18:38:46 +00:00
|
|
|
if ( ((unsigned)x < (unsigned)current_vp->width)
|
|
|
|
&& ((unsigned)y < (unsigned)current_vp->height)
|
|
|
|
#if defined(HAVE_VIEWPORT_CLIP)
|
|
|
|
&& ((unsigned)x < (unsigned)LCDM(WIDTH))
|
|
|
|
&& ((unsigned)y < (unsigned)LCDM(HEIGHT))
|
|
|
|
#endif
|
|
|
|
)
|
2008-01-07 20:34:11 +00:00
|
|
|
pfunc(current_vp->x + x, current_vp->y + y);
|
2005-06-23 16:53:54 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
if (d < 0)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
|
|
|
d += dinc1;
|
|
|
|
x += xinc1;
|
|
|
|
y += yinc1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
d += dinc2;
|
|
|
|
x += xinc2;
|
|
|
|
y += yinc2;
|
2002-09-24 22:44:59 +00:00
|
|
|
}
|
2002-09-23 11:17:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
/* Draw a horizontal line (optimised) */
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(hline)(int x1, int x2, int y)
|
2002-09-24 22:44:59 +00:00
|
|
|
{
|
2008-03-09 18:27:12 +00:00
|
|
|
int x, width;
|
2005-07-02 07:21:21 +00:00
|
|
|
unsigned char *dst, *dst_end;
|
2005-06-28 23:15:47 +00:00
|
|
|
unsigned mask;
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(blockfunc_type) *bfunc;
|
2005-06-23 16:53:54 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
/* direction flip */
|
|
|
|
if (x2 < x1)
|
|
|
|
{
|
|
|
|
x = x1;
|
|
|
|
x1 = x2;
|
|
|
|
x2 = x;
|
|
|
|
}
|
|
|
|
|
2009-11-07 18:38:46 +00:00
|
|
|
/******************** In viewport clipping **********************/
|
2005-06-24 22:33:21 +00:00
|
|
|
/* nothing to draw? */
|
2008-01-07 20:34:11 +00:00
|
|
|
if (((unsigned)y >= (unsigned)current_vp->height) || (x1 >= current_vp->width)
|
|
|
|
|| (x2 < 0))
|
2005-06-24 22:33:21 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (x1 < 0)
|
|
|
|
x1 = 0;
|
2008-01-07 20:34:11 +00:00
|
|
|
if (x2 >= current_vp->width)
|
|
|
|
x2 = current_vp->width-1;
|
2005-06-24 22:33:21 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
/* adjust to viewport */
|
2008-01-07 20:34:11 +00:00
|
|
|
x1 += current_vp->x;
|
2009-11-07 18:48:35 +00:00
|
|
|
x2 += current_vp->x;
|
2008-03-09 18:27:12 +00:00
|
|
|
y += current_vp->y;
|
2009-11-07 18:38:46 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_VIEWPORT_CLIP)
|
|
|
|
/********************* Viewport on screen clipping ********************/
|
|
|
|
/* nothing to draw? */
|
|
|
|
if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH))
|
|
|
|
|| (x2 < 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* clipping */
|
|
|
|
if (x1 < 0)
|
|
|
|
x1 = 0;
|
|
|
|
if (x2 >= LCDM(WIDTH))
|
|
|
|
x2 = LCDM(WIDTH)-1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
width = x2 - x1 + 1;
|
2008-01-07 20:34:11 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
|
2012-02-22 10:18:05 +00:00
|
|
|
dst = LCDFB(x1,y>>3);
|
2009-06-07 21:27:05 +00:00
|
|
|
mask = BIT_N(y & 7);
|
2005-06-23 16:53:54 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
dst_end = dst + width;
|
2005-07-02 07:21:21 +00:00
|
|
|
do
|
2005-06-28 23:15:47 +00:00
|
|
|
bfunc(dst++, mask, 0xFFu);
|
2008-03-09 18:27:12 +00:00
|
|
|
while (dst < dst_end);
|
2005-06-24 22:33:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Draw a vertical line (optimised) */
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(vline)(int x, int y1, int y2)
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
|
|
|
int ny;
|
2008-03-09 18:27:12 +00:00
|
|
|
FBFN(data) *dst;
|
2005-06-28 23:15:47 +00:00
|
|
|
unsigned mask, mask_bottom;
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(blockfunc_type) *bfunc;
|
2005-06-23 16:53:54 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
/* direction flip */
|
|
|
|
if (y2 < y1)
|
|
|
|
{
|
|
|
|
ny = y1;
|
|
|
|
y1 = y2;
|
|
|
|
y2 = ny;
|
2005-06-23 16:53:54 +00:00
|
|
|
}
|
|
|
|
|
2009-11-07 18:38:46 +00:00
|
|
|
/******************** In viewport clipping **********************/
|
2005-06-24 22:33:21 +00:00
|
|
|
/* nothing to draw? */
|
2008-01-07 20:34:11 +00:00
|
|
|
if (((unsigned)x >= (unsigned)current_vp->width) || (y1 >= current_vp->height)
|
|
|
|
|| (y2 < 0))
|
2005-06-24 22:33:21 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (y1 < 0)
|
|
|
|
y1 = 0;
|
2008-01-07 20:34:11 +00:00
|
|
|
if (y2 >= current_vp->height)
|
|
|
|
y2 = current_vp->height-1;
|
2005-06-24 22:33:21 +00:00
|
|
|
|
2008-01-07 20:34:11 +00:00
|
|
|
/* adjust for viewport */
|
|
|
|
y1 += current_vp->y;
|
|
|
|
y2 += current_vp->y;
|
|
|
|
x += current_vp->x;
|
2009-11-07 18:38:46 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_VIEWPORT_CLIP)
|
|
|
|
/********************* Viewport on screen clipping ********************/
|
|
|
|
/* nothing to draw? */
|
|
|
|
if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT))
|
|
|
|
|| (y2 < 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* clipping */
|
|
|
|
if (y1 < 0)
|
|
|
|
y1 = 0;
|
|
|
|
if (y2 >= LCDM(HEIGHT))
|
|
|
|
y2 = LCDM(HEIGHT)-1;
|
|
|
|
#endif
|
2008-01-07 20:34:11 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
|
2012-02-22 10:18:05 +00:00
|
|
|
dst = LCDFB(x,y1>>3);
|
2005-06-24 22:33:21 +00:00
|
|
|
ny = y2 - (y1 & ~7);
|
2005-06-28 23:15:47 +00:00
|
|
|
mask = 0xFFu << (y1 & 7);
|
2005-07-04 06:20:50 +00:00
|
|
|
mask_bottom = 0xFFu >> (~ny & 7);
|
2005-06-28 23:15:47 +00:00
|
|
|
|
|
|
|
for (; ny >= 8; ny -= 8)
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
2005-06-28 23:15:47 +00:00
|
|
|
bfunc(dst, mask, 0xFFu);
|
2008-03-09 18:27:12 +00:00
|
|
|
dst += LCDM(WIDTH);
|
2005-06-28 23:15:47 +00:00
|
|
|
mask = 0xFFu;
|
2005-06-23 16:53:54 +00:00
|
|
|
}
|
2005-06-30 18:42:24 +00:00
|
|
|
mask &= mask_bottom;
|
|
|
|
bfunc(dst, mask, 0xFFu);
|
2005-06-23 16:53:54 +00:00
|
|
|
}
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
/* Draw a rectangular box */
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(drawrect)(int x, int y, int width, int height)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
2005-06-24 22:33:21 +00:00
|
|
|
if ((width <= 0) || (height <= 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
int x2 = x + width - 1;
|
|
|
|
int y2 = y + height - 1;
|
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(vline)(x, y, y2);
|
|
|
|
LCDFN(vline)(x2, y, y2);
|
|
|
|
LCDFN(hline)(x, x2, y);
|
|
|
|
LCDFN(hline)(x, x2, y2);
|
2005-06-23 16:53:54 +00:00
|
|
|
}
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
/* Fill a rectangular area */
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(fillrect)(int x, int y, int width, int height)
|
2005-06-23 16:53:54 +00:00
|
|
|
{
|
2005-07-02 07:21:21 +00:00
|
|
|
int ny;
|
2008-03-09 18:27:12 +00:00
|
|
|
FBFN(data) *dst, *dst_end;
|
2005-06-28 23:15:47 +00:00
|
|
|
unsigned mask, mask_bottom;
|
2006-02-22 00:20:28 +00:00
|
|
|
unsigned bits = 0;
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(blockfunc_type) *bfunc;
|
2006-02-22 00:20:28 +00:00
|
|
|
bool fillopt = false;
|
2005-06-24 22:33:21 +00:00
|
|
|
|
2009-11-07 18:38:46 +00:00
|
|
|
/******************** In viewport clipping **********************/
|
2005-06-24 22:33:21 +00:00
|
|
|
/* nothing to draw? */
|
2008-01-07 20:34:11 +00:00
|
|
|
if ((width <= 0) || (height <= 0) || (x >= current_vp->width)
|
|
|
|
|| (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0))
|
2005-06-23 16:53:54 +00:00
|
|
|
return;
|
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
if (x < 0)
|
|
|
|
{
|
|
|
|
width += x;
|
|
|
|
x = 0;
|
|
|
|
}
|
|
|
|
if (y < 0)
|
|
|
|
{
|
|
|
|
height += y;
|
|
|
|
y = 0;
|
|
|
|
}
|
2008-01-07 20:34:11 +00:00
|
|
|
if (x + width > current_vp->width)
|
|
|
|
width = current_vp->width - x;
|
|
|
|
if (y + height > current_vp->height)
|
|
|
|
height = current_vp->height - y;
|
2006-02-22 00:20:28 +00:00
|
|
|
|
2008-01-07 20:34:11 +00:00
|
|
|
/* adjust for viewport */
|
|
|
|
x += current_vp->x;
|
|
|
|
y += current_vp->y;
|
2009-11-07 18:38:46 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_VIEWPORT_CLIP)
|
|
|
|
/********************* Viewport on screen clipping ********************/
|
|
|
|
/* nothing to draw? */
|
|
|
|
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
|
|
|
|
|| (x + width <= 0) || (y + height <= 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* clip image in viewport in screen */
|
|
|
|
if (x < 0)
|
|
|
|
{
|
|
|
|
width += x;
|
|
|
|
x = 0;
|
|
|
|
}
|
|
|
|
if (y < 0)
|
|
|
|
{
|
|
|
|
height += y;
|
|
|
|
y = 0;
|
|
|
|
}
|
|
|
|
if (x + width > LCDM(WIDTH))
|
|
|
|
width = LCDM(WIDTH) - x;
|
|
|
|
if (y + height > LCDM(HEIGHT))
|
|
|
|
height = LCDM(HEIGHT) - y;
|
|
|
|
#endif
|
2008-01-07 20:34:11 +00:00
|
|
|
|
|
|
|
if (current_vp->drawmode & DRMODE_INVERSEVID)
|
2006-02-22 00:20:28 +00:00
|
|
|
{
|
2008-01-07 20:34:11 +00:00
|
|
|
if (current_vp->drawmode & DRMODE_BG)
|
2006-02-22 00:20:28 +00:00
|
|
|
{
|
|
|
|
fillopt = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-01-07 20:34:11 +00:00
|
|
|
if (current_vp->drawmode & DRMODE_FG)
|
2006-02-22 00:20:28 +00:00
|
|
|
{
|
|
|
|
fillopt = true;
|
|
|
|
bits = 0xFFu;
|
|
|
|
}
|
|
|
|
}
|
2008-03-09 18:27:12 +00:00
|
|
|
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
|
2012-02-22 10:18:05 +00:00
|
|
|
dst = LCDFB(x,y>>3);
|
2005-06-24 22:33:21 +00:00
|
|
|
ny = height - 1 + (y & 7);
|
2005-06-28 23:15:47 +00:00
|
|
|
mask = 0xFFu << (y & 7);
|
2005-07-04 06:20:50 +00:00
|
|
|
mask_bottom = 0xFFu >> (~ny & 7);
|
2005-06-24 22:33:21 +00:00
|
|
|
|
2005-06-28 23:15:47 +00:00
|
|
|
for (; ny >= 8; ny -= 8)
|
2005-06-24 22:33:21 +00:00
|
|
|
{
|
2005-06-28 23:15:47 +00:00
|
|
|
if (fillopt && (mask == 0xFFu))
|
2005-06-24 22:33:21 +00:00
|
|
|
memset(dst, bits, width);
|
|
|
|
else
|
|
|
|
{
|
2008-03-09 18:27:12 +00:00
|
|
|
FBFN(data) *dst_row = dst;
|
2005-06-28 23:15:47 +00:00
|
|
|
|
2005-07-02 07:21:21 +00:00
|
|
|
dst_end = dst_row + width;
|
|
|
|
do
|
2005-06-28 23:15:47 +00:00
|
|
|
bfunc(dst_row++, mask, 0xFFu);
|
2005-07-02 07:21:21 +00:00
|
|
|
while (dst_row < dst_end);
|
2005-06-24 22:33:21 +00:00
|
|
|
}
|
2005-06-28 23:15:47 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
dst += LCDM(WIDTH);
|
2005-06-28 23:15:47 +00:00
|
|
|
mask = 0xFFu;
|
2005-06-24 22:33:21 +00:00
|
|
|
}
|
2005-06-30 18:42:24 +00:00
|
|
|
mask &= mask_bottom;
|
2005-06-28 23:15:47 +00:00
|
|
|
|
2005-06-30 18:42:24 +00:00
|
|
|
if (fillopt && (mask == 0xFFu))
|
2005-06-24 22:33:21 +00:00
|
|
|
memset(dst, bits, width);
|
|
|
|
else
|
2005-06-28 23:15:47 +00:00
|
|
|
{
|
2005-07-02 07:21:21 +00:00
|
|
|
dst_end = dst + width;
|
|
|
|
do
|
2005-06-30 18:42:24 +00:00
|
|
|
bfunc(dst++, mask, 0xFFu);
|
2005-07-02 07:21:21 +00:00
|
|
|
while (dst < dst_end);
|
2005-06-28 23:15:47 +00:00
|
|
|
}
|
2005-06-23 16:53:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* About Rockbox' internal bitmap format:
|
2002-09-23 11:17:52 +00:00
|
|
|
*
|
2004-05-14 22:55:05 +00:00
|
|
|
* A bitmap contains one bit for every pixel that defines if that pixel is
|
|
|
|
* black (1) or white (0). Bits within a byte are arranged vertically, LSB
|
|
|
|
* at top.
|
|
|
|
* The bytes are stored in row-major order, with byte 0 being top left,
|
|
|
|
* byte 1 2nd from left etc. The first row of bytes defines pixel rows
|
|
|
|
* 0..7, the second row defines pixel row 8..15 etc.
|
2002-09-23 11:17:52 +00:00
|
|
|
*
|
2005-06-23 16:53:54 +00:00
|
|
|
* This is the same as the internal lcd hw format. */
|
|
|
|
|
2005-06-28 23:15:47 +00:00
|
|
|
/* Draw a partial bitmap */
|
2008-03-09 18:27:12 +00:00
|
|
|
void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x,
|
|
|
|
int src_y, int stride, int x, int y,
|
|
|
|
int width, int height)
|
2002-09-23 11:17:52 +00:00
|
|
|
{
|
2005-07-02 07:21:21 +00:00
|
|
|
int shift, ny;
|
2008-03-09 18:27:12 +00:00
|
|
|
FBFN(data) *dst, *dst_end;
|
2005-06-28 23:15:47 +00:00
|
|
|
unsigned mask, mask_bottom;
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(blockfunc_type) *bfunc;
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2009-11-07 18:38:46 +00:00
|
|
|
/******************** Image in viewport clipping **********************/
|
2005-06-28 23:15:47 +00:00
|
|
|
/* nothing to draw? */
|
2008-01-07 20:34:11 +00:00
|
|
|
if ((width <= 0) || (height <= 0) || (x >= current_vp->width)
|
|
|
|
|| (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0))
|
2002-09-23 11:17:52 +00:00
|
|
|
return;
|
2005-06-28 23:15:47 +00:00
|
|
|
|
2009-11-07 18:38:46 +00:00
|
|
|
/* clip image in viewport */
|
2005-06-28 23:15:47 +00:00
|
|
|
if (x < 0)
|
|
|
|
{
|
|
|
|
width += x;
|
|
|
|
src_x -= x;
|
|
|
|
x = 0;
|
|
|
|
}
|
|
|
|
if (y < 0)
|
|
|
|
{
|
|
|
|
height += y;
|
|
|
|
src_y -= y;
|
|
|
|
y = 0;
|
|
|
|
}
|
2008-01-07 20:34:11 +00:00
|
|
|
if (x + width > current_vp->width)
|
|
|
|
width = current_vp->width - x;
|
|
|
|
if (y + height > current_vp->height)
|
|
|
|
height = current_vp->height - y;
|
|
|
|
|
|
|
|
/* adjust for viewport */
|
|
|
|
x += current_vp->x;
|
|
|
|
y += current_vp->y;
|
2009-11-07 18:38:46 +00:00
|
|
|
|
|
|
|
#if defined(HAVE_VIEWPORT_CLIP)
|
|
|
|
/********************* Viewport on screen clipping ********************/
|
|
|
|
/* nothing to draw? */
|
|
|
|
if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT))
|
|
|
|
|| (x + width <= 0) || (y + height <= 0))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* clip image in viewport in screen */
|
|
|
|
if (x < 0)
|
|
|
|
{
|
|
|
|
width += x;
|
|
|
|
src_x -= x;
|
|
|
|
x = 0;
|
|
|
|
}
|
|
|
|
if (y < 0)
|
|
|
|
{
|
|
|
|
height += y;
|
|
|
|
src_y -= y;
|
|
|
|
y = 0;
|
|
|
|
}
|
|
|
|
if (x + width > LCDM(WIDTH))
|
|
|
|
width = LCDM(WIDTH) - x;
|
|
|
|
if (y + height > LCDM(HEIGHT))
|
|
|
|
height = LCDM(HEIGHT) - y;
|
|
|
|
#endif
|
2002-09-23 11:17:52 +00:00
|
|
|
|
2005-06-28 23:15:47 +00:00
|
|
|
src += stride * (src_y >> 3) + src_x; /* move starting point */
|
|
|
|
src_y &= 7;
|
|
|
|
y -= src_y;
|
2012-02-22 10:18:05 +00:00
|
|
|
dst = LCDFB(x,y>>3);
|
2005-06-28 23:15:47 +00:00
|
|
|
shift = y & 7;
|
|
|
|
ny = height - 1 + shift + src_y;
|
2003-12-23 23:41:45 +00:00
|
|
|
|
2008-03-09 18:27:12 +00:00
|
|
|
bfunc = LCDFN(blockfuncs)[current_vp->drawmode];
|
2005-06-28 23:15:47 +00:00
|
|
|
mask = 0xFFu << (shift + src_y);
|
2005-07-04 06:20:50 +00:00
|
|
|
mask_bottom = 0xFFu >> (~ny & 7);
|
2004-05-14 22:55:05 +00:00
|
|
|
|
2005-06-28 23:15:47 +00:00
|
|
|
if (shift == 0)
|
2003-12-23 23:41:45 +00:00
|
|
|
{
|
2008-01-07 20:34:11 +00:00
|
|
|
bool copyopt = (current_vp->drawmode == DRMODE_SOLID);
|
2005-06-28 23:15:47 +00:00
|
|
|
|
|
|
|
for (; ny >= 8; ny -= 8)
|
2004-05-14 23:08:08 +00:00
|
|
|
{
|
2005-06-28 23:15:47 +00:00
|
|
|
if (copyopt && (mask == 0xFFu))
|
|
|
|
memcpy(dst, src, width);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const unsigned char *src_row = src;
|
2008-03-09 18:27:12 +00:00
|
|
|
FBFN(data) *dst_row = dst;
|
2005-07-02 07:21:21 +00:00
|
|
|
|
|
|
|
dst_end = dst_row + width;
|
|
|
|
do
|
2005-06-28 23:15:47 +00:00
|
|
|
bfunc(dst_row++, mask, *src_row++);
|
2005-07-02 07:21:21 +00:00
|
|
|
while (dst_row < dst_end);
|
2005-06-28 23:15:47 +00:00
|
|
|
}
|
|
|
|
|
2004-05-14 23:08:08 +00:00
|
|
|
src += stride;
|
2008-03-09 18:27:12 +00:00
|
|
|
dst += LCDM(WIDTH);
|
2005-06-28 23:15:47 +00:00
|
|
|
mask = 0xFFu;
|
2004-05-14 23:08:08 +00:00
|
|
|
}
|
2005-06-30 18:42:24 +00:00
|
|
|
mask &= mask_bottom;
|
2003-12-23 23:41:45 +00:00
|
|
|
|
2005-06-30 18:42:24 +00:00
|
|
|
if (copyopt && (mask == 0xFFu))
|
2005-06-28 23:15:47 +00:00
|
|
|
memcpy(dst, src, width);
|
|
|
|
else
|
|
|
|
{
|
2005-07-02 07:21:21 +00:00
|
|
|
dst_end = dst + width;
|
|
|
|
do
|
2005-06-30 18:42:24 +00:00
|
|
|
bfunc(dst++, mask, *src++);
|
2005-07-02 07:21:21 +00:00
|
|
|
while (dst < dst_end);
|
2005-06-28 23:15:47 +00:00
|
|
|
}
|
2002-09-23 11:17:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-07-02 07:21:21 +00:00
|
|
|
dst_end = dst + width;
|
|
|
|
do
|
2002-09-23 11:17:52 +00:00
|
|
|
{
|
2005-06-28 23:15:47 +00:00
|
|
|
const unsigned char *src_col = src++;
|
2008-03-09 18:27:12 +00:00
|
|
|
FBFN(data) *dst_col = dst++;
|
2005-06-28 23:15:47 +00:00
|
|
|
unsigned mask_col = mask;
|
|
|
|
unsigned data = 0;
|
|
|
|
|
|
|
|
for (y = ny; y >= 8; y -= 8)
|
2002-09-23 11:17:52 +00:00
|
|
|
{
|
2004-05-14 22:55:05 +00:00
|
|
|
data |= *src_col << shift;
|
2005-06-28 23:15:47 +00:00
|
|
|
|
|
|
|
if (mask_col & 0xFFu)
|
|
|
|
{
|
|
|
|
bfunc(dst_col, mask_col, data);
|
|
|
|
mask_col = 0xFFu;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
mask_col >>= 8;
|
|
|
|
|
2004-05-14 22:55:05 +00:00
|
|
|
src_col += stride;
|
2008-03-09 18:27:12 +00:00
|
|
|
dst_col += LCDM(WIDTH);
|
2002-09-23 11:17:52 +00:00
|
|
|
data >>= 8;
|
|
|
|
}
|
2004-05-14 22:55:05 +00:00
|
|
|
data |= *src_col << shift;
|
2005-06-28 23:15:47 +00:00
|
|
|
bfunc(dst_col, mask_col & mask_bottom, data);
|
|
|
|
}
|
2005-07-02 07:21:21 +00:00
|
|
|
while (dst < dst_end);
|
2002-09-23 11:17:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-28 23:15:47 +00:00
|
|
|
/* Draw a full bitmap */
|
2008-03-09 18:27:12 +00:00
|
|
|
void LCDFN(bitmap)(const unsigned char *src, int x, int y, int width,
|
|
|
|
int height)
|
2005-06-28 23:15:47 +00:00
|
|
|
{
|
2008-03-09 18:27:12 +00:00
|
|
|
LCDFN(bitmap_part)(src, 0, 0, width, x, y, width, height);
|
2005-06-28 23:15:47 +00:00
|
|
|
}
|
|
|
|
|
2009-08-13 08:02:29 +00:00
|
|
|
#include "lcd-bitmap-common.c"
|