1
0
Fork 0
forked from len0rd/rockbox

Grayscale lib: Using a 32x32->32 bit multiplication is better on ARM, as 16x16->32 bit isn't a single instruction. Renamed the macro for pointing out that it's not necessarily 16 bit anymore, and to avoid collisions with similar macros in plugins.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11436 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2006-11-05 14:40:14 +00:00
parent 0b9e266b1e
commit 32c69452d6
4 changed files with 96 additions and 92 deletions

View file

@ -113,9 +113,13 @@ void gray_ub_scroll_down(int count);
#define _GRAY_RUNNING 0x0001 /* greyscale overlay is running */
#define _GRAY_DEFERRED_UPDATE 0x0002 /* lcd_update() requested */
/* unsigned 16 bit multiplication (a single instruction on the SH) */
#define MULU16(a, b) ((unsigned long) \
(((unsigned short) (a)) * ((unsigned short) (b))))
/* fast unsigned multiplication (16x16bit->32bit or 32x32bit->32bit,
* whichever is faster for the architecture) */
#ifdef CPU_ARM
#define _GRAY_MULUQ(a, b) ((uint32_t) (((uint32_t) (a)) * ((uint32_t) (b))))
#else
#define _GRAY_MULUQ(a, b) ((uint32_t) (((uint16_t) (a)) * ((uint16_t) (b))))
#endif
/* The grayscale buffer management structure */
struct _gray_info

View file

@ -225,11 +225,11 @@ static inline void _deferred_update(void)
static void _timer_isr(void)
{
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
_gray_rb->lcd_blit(_gray_info.plane_data + MULU16(_gray_info.plane_size,
_gray_rb->lcd_blit(_gray_info.plane_data + _GRAY_MULUQ(_gray_info.plane_size,
_gray_info.cur_plane), _gray_info.bx, _gray_info.y,
_gray_info.bwidth, _gray_info.height, _gray_info.bwidth);
#else
_gray_rb->lcd_blit(_gray_info.plane_data + MULU16(_gray_info.plane_size,
_gray_rb->lcd_blit(_gray_info.plane_data + _GRAY_MULUQ(_gray_info.plane_size,
_gray_info.cur_plane), _gray_info.x, _gray_info.by,
_gray_info.width, _gray_info.bheight, _gray_info.width);
#endif
@ -373,7 +373,7 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
/* chunky front- & backbuffer */
if (buffered)
{
plane_size = MULU16(width, height);
plane_size = _GRAY_MULUQ(width, height);
buftaken += 2 * plane_size;
if (buftaken > gbuf_size)
return 0;
@ -387,9 +387,9 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
}
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
plane_size = MULU16(bdim, height);
plane_size = _GRAY_MULUQ(bdim, height);
#else
plane_size = MULU16(width, bdim);
plane_size = _GRAY_MULUQ(width, bdim);
#endif
possible_depth = (gbuf_size - buftaken - sizeof(long))
/ (plane_size + sizeof(long));
@ -403,9 +403,9 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
#ifdef SIMULATOR
if (!buffered)
{
long orig_size = MULU16(depth, plane_size) + (depth + 1) * sizeof(long);
long orig_size = _GRAY_MULUQ(depth, plane_size) + (depth + 1) * sizeof(long);
plane_size = MULU16(width, height);
plane_size = _GRAY_MULUQ(width, height);
if (plane_size > orig_size)
{
buftaken += plane_size;
@ -420,7 +420,7 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
}
else
#endif
buftaken += MULU16(depth, plane_size) + (depth + 1) * sizeof(long);
buftaken += _GRAY_MULUQ(depth, plane_size) + (depth + 1) * sizeof(long);
_gray_info.x = 0;
_gray_info.y = 0;
@ -439,8 +439,8 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
_gray_info.cur_plane = 0;
_gray_info.plane_size = plane_size;
_gray_info.plane_data = gbuf;
_gray_rb->memset(gbuf, 0, MULU16(depth, plane_size));
gbuf += MULU16(depth, plane_size);
_gray_rb->memset(gbuf, 0, _GRAY_MULUQ(depth, plane_size));
gbuf += _GRAY_MULUQ(depth, plane_size);
_gray_info.bitpattern = (unsigned long *)gbuf;
i = depth - 1;
@ -481,7 +481,7 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
{
for (i = 0; i < 256; i++)
{
data = MULU16(depth, i) + 127;
data = _GRAY_MULUQ(depth, i) + 127;
_gray_info.idxtable[i] = (data + (data >> 8)) >> 8;
/* approx. data / 255 */
}
@ -492,7 +492,7 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
{
data = exp_s16p16((gamma * log_s16p16(i * 257 + 1)) >> 8) + 128;
data = (data - (data >> 8)) >> 8; /* approx. data /= 257 */
data = MULU16(depth, lcdlinear[data]) + 127;
data = _GRAY_MULUQ(depth, lcdlinear[data]) + 127;
_gray_info.idxtable[i] = (data + (data >> 8)) >> 8;
/* approx. data / 255 */
}
@ -577,11 +577,11 @@ void gray_show(bool enable)
static unsigned long _gray_get_pixel(int x, int y)
{
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
return _gray_info.cur_buffer[MULU16(y - _gray_info.y, _gray_info.width)
return _gray_info.cur_buffer[_GRAY_MULUQ(y - _gray_info.y, _gray_info.width)
+ x - _gray_info.x]
+ (1 << LCD_DEPTH);
#else
return _gray_info.cur_buffer[MULU16(x - _gray_info.x, _gray_info.height)
return _gray_info.cur_buffer[_GRAY_MULUQ(x - _gray_info.x, _gray_info.height)
+ y - _gray_info.y]
+ (1 << LCD_DEPTH);
#endif
@ -630,8 +630,8 @@ void gray_update_rect(int x, int y, int width, int height)
xmax = _gray_info.bwidth - 1;
bwidth = xmax - x + 1;
srcofs = MULU16(_gray_info.width, y) + (x << 3);
dst = _gray_info.plane_data + MULU16(_gray_info.bwidth, y) + x;
srcofs = _GRAY_MULUQ(_gray_info.width, y) + (x << 3);
dst = _gray_info.plane_data + _GRAY_MULUQ(_gray_info.bwidth, y) + x;
/* Copy specified rectangle bitmap to hardware */
for (; height > 0; height--)
@ -982,7 +982,7 @@ void gray_update_rect(int x, int y, int width, int height)
}
addr = dst_row;
end = addr + MULU16(_gray_info.depth, _gray_info.plane_size);
end = addr + _GRAY_MULUQ(_gray_info.depth, _gray_info.plane_size);
/* set the bits for all 8 pixels in all bytes according to the
* precalculated patterns on the pattern stack */
@ -1050,8 +1050,8 @@ void gray_update_rect(int x, int y, int width, int height)
if (ymax >= _gray_info.bheight)
ymax = _gray_info.bheight - 1;
srcofs = (y << 3) + MULU16(_gray_info.height, x);
dst = _gray_info.plane_data + MULU16(_gray_info.width, y) + x;
srcofs = (y << 3) + _GRAY_MULUQ(_gray_info.height, x);
dst = _gray_info.plane_data + _GRAY_MULUQ(_gray_info.width, y) + x;
/* Copy specified rectangle bitmap to hardware */
for (; y <= ymax; y++)
@ -1879,7 +1879,7 @@ void gray_update_rect(int x, int y, int width, int height)
}
addr = dst_row;
end = addr + MULU16(_gray_info.depth, _gray_info.plane_size);
end = addr + _GRAY_MULUQ(_gray_info.depth, _gray_info.plane_size);
/* set the bits for all 8 pixels in all bytes according to the
* precalculated patterns on the pattern stack */
@ -2037,9 +2037,9 @@ static void gray_screendump_hook(int fd)
for (i = _gray_info.depth; i > 0; i--)
{
*clut_entry++ = MULU16(BMP_BLUE, i) / _gray_info.depth;
*clut_entry++ = MULU16(BMP_GREEN, i) / _gray_info.depth;
*clut_entry++ = MULU16(BMP_RED, i) / _gray_info.depth;
*clut_entry++ = _GRAY_MULUQ(BMP_BLUE, i) / _gray_info.depth;
*clut_entry++ = _GRAY_MULUQ(BMP_GREEN, i) / _gray_info.depth;
*clut_entry++ = _GRAY_MULUQ(BMP_RED, i) / _gray_info.depth;
clut_entry++;
}
_gray_rb->write(fd, linebuf, 4*BMP_VARCOLORS);
@ -2052,14 +2052,14 @@ static void gray_screendump_hook(int fd)
gy = y - _gray_info.y;
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
#if LCD_DEPTH == 2
lcdptr = _gray_rb->lcd_framebuffer + MULU16(LCD_FBWIDTH, y);
lcdptr = _gray_rb->lcd_framebuffer + _GRAY_MULUQ(LCD_FBWIDTH, y);
if ((unsigned) gy < (unsigned) _gray_info.height)
{
/* line contains greyscale (and maybe b&w) graphics */
#ifndef SIMULATOR
unsigned char *grayptr = _gray_info.plane_data
+ MULU16(_gray_info.bwidth, gy);
+ _GRAY_MULUQ(_gray_info.bwidth, gy);
#endif
for (x = 0; x < LCD_WIDTH; x += 4)
@ -2069,7 +2069,7 @@ static void gray_screendump_hook(int fd)
if ((unsigned)gx < (unsigned)_gray_info.width)
{
#ifdef SIMULATOR
data = MULU16(gy, _gray_info.width) + gx;
data = _GRAY_MULUQ(gy, _gray_info.width) + gx;
for (i = 0; i < 4; i++)
linebuf[x + i] = BMP_FIXEDCOLORS + _gray_info.depth
@ -2122,14 +2122,14 @@ static void gray_screendump_hook(int fd)
#if LCD_DEPTH == 1
mask = 1 << (y & 7);
by = y >> 3;
lcdptr = _gray_rb->lcd_framebuffer + MULU16(LCD_WIDTH, by);
lcdptr = _gray_rb->lcd_framebuffer + _GRAY_MULUQ(LCD_WIDTH, by);
if ((unsigned) gy < (unsigned) _gray_info.height)
{
/* line contains greyscale (and maybe b&w) graphics */
#ifndef SIMULATOR
unsigned char *grayptr = _gray_info.plane_data
+ MULU16(_gray_info.width, gy >> 3);
+ _GRAY_MULUQ(_gray_info.width, gy >> 3);
#endif
for (x = 0; x < LCD_WIDTH; x++)
@ -2140,7 +2140,7 @@ static void gray_screendump_hook(int fd)
{
#ifdef SIMULATOR
linebuf[x] = BMP_FIXEDCOLORS + _gray_info.depth
- _gray_info.cur_buffer[MULU16(gx, _gray_info.height) + gy];
- _gray_info.cur_buffer[_GRAY_MULUQ(gx, _gray_info.height) + gy];
#else
int idx = BMP_FIXEDCOLORS;
unsigned char *grayptr2 = grayptr + gx;
@ -2170,14 +2170,14 @@ static void gray_screendump_hook(int fd)
#elif LCD_DEPTH == 2
shift = 2 * (y & 3);
by = y >> 2;
lcdptr = _gray_rb->lcd_framebuffer + MULU16(LCD_WIDTH, by);
lcdptr = _gray_rb->lcd_framebuffer + _GRAY_MULUQ(LCD_WIDTH, by);
if ((unsigned)gy < (unsigned)_gray_info.height)
{
/* line contains greyscale (and maybe b&w) graphics */
#ifndef SIMULATOR
unsigned char *grayptr = _gray_info.plane_data
+ MULU16(_gray_info.width, gy >> 3);
+ _GRAY_MULUQ(_gray_info.width, gy >> 3);
mask = 1 << (gy & 7);
#endif
@ -2189,7 +2189,7 @@ static void gray_screendump_hook(int fd)
{
#ifdef SIMULATOR
linebuf[x] = BMP_FIXEDCOLORS + _gray_info.depth
- _gray_info.cur_buffer[MULU16(gx, _gray_info.height) + gy];
- _gray_info.cur_buffer[_GRAY_MULUQ(gx, _gray_info.height) + gy];
#else
int idx = BMP_FIXEDCOLORS;
unsigned char *grayptr2 = grayptr + gx;

View file

@ -65,7 +65,7 @@ void gray_clear_display(void)
_gray_info.fg_index : _gray_info.bg_index;
_gray_rb->memset(_gray_info.cur_buffer, brightness,
MULU16(_gray_info.width, _gray_info.height));
_GRAY_MULUQ(_gray_info.width, _gray_info.height));
}
/* Set a single pixel */
@ -74,10 +74,10 @@ void gray_drawpixel(int x, int y)
if (((unsigned)x < (unsigned)_gray_info.width)
&& ((unsigned)y < (unsigned)_gray_info.height))
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
_gray_pixelfuncs[_gray_info.drawmode](&_gray_info.cur_buffer[MULU16(y,
_gray_pixelfuncs[_gray_info.drawmode](&_gray_info.cur_buffer[_GRAY_MULUQ(y,
_gray_info.width) + x]);
#else
_gray_pixelfuncs[_gray_info.drawmode](&_gray_info.cur_buffer[MULU16(x,
_gray_pixelfuncs[_gray_info.drawmode](&_gray_info.cur_buffer[_GRAY_MULUQ(x,
_gray_info.height) + y]);
#endif
}
@ -138,9 +138,9 @@ void gray_drawline(int x1, int y1, int x2, int y2)
if (((unsigned)x < (unsigned)_gray_info.width)
&& ((unsigned)y < (unsigned)_gray_info.height))
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
pfunc(&_gray_info.cur_buffer[MULU16(y, _gray_info.width) + x]);
pfunc(&_gray_info.cur_buffer[_GRAY_MULUQ(y, _gray_info.width) + x]);
#else
pfunc(&_gray_info.cur_buffer[MULU16(x, _gray_info.height) + y]);
pfunc(&_gray_info.cur_buffer[_GRAY_MULUQ(x, _gray_info.height) + y]);
#endif
if (d < 0)
@ -205,7 +205,7 @@ void gray_hline(int x1, int x2, int y)
}
}
pfunc = _gray_pixelfuncs[_gray_info.drawmode];
dst = &_gray_info.cur_buffer[MULU16(y, _gray_info.width) + x1];
dst = &_gray_info.cur_buffer[_GRAY_MULUQ(y, _gray_info.width) + x1];
if (fillopt)
_gray_rb->memset(dst, bits, x2 - x1 + 1);
@ -245,9 +245,9 @@ void gray_vline(int x, int y1, int y2)
y2 = _gray_info.height - 1;
pfunc = _gray_pixelfuncs[_gray_info.drawmode];
dst = &_gray_info.cur_buffer[MULU16(y1, _gray_info.width) + x];
dst = &_gray_info.cur_buffer[_GRAY_MULUQ(y1, _gray_info.width) + x];
dst_end = dst + MULU16(y2 - y1, _gray_info.width);
dst_end = dst + _GRAY_MULUQ(y2 - y1, _gray_info.width);
do
{
pfunc(dst);
@ -354,9 +354,9 @@ void gray_hline(int x1, int x2, int y)
x2 = _gray_info.width - 1;
pfunc = _gray_pixelfuncs[_gray_info.drawmode];
dst = &_gray_info.cur_buffer[MULU16(x1, _gray_info.height) + y];
dst = &_gray_info.cur_buffer[_GRAY_MULUQ(x1, _gray_info.height) + y];
dst_end = dst + MULU16(x2 - x1, _gray_info.height);
dst_end = dst + _GRAY_MULUQ(x2 - x1, _gray_info.height);
do
{
pfunc(dst);
@ -410,7 +410,7 @@ void gray_vline(int x, int y1, int y2)
}
}
pfunc = _gray_pixelfuncs[_gray_info.drawmode];
dst = &_gray_info.cur_buffer[MULU16(x, _gray_info.height) + y1];
dst = &_gray_info.cur_buffer[_GRAY_MULUQ(x, _gray_info.height) + y1];
if (fillopt)
_gray_rb->memset(dst, bits, y2 - y1 + 1);
@ -556,8 +556,8 @@ void gray_fillrect(int x, int y, int width, int height)
}
pfunc = _gray_pixelfuncs[_gray_info.drawmode];
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
dst = &_gray_info.cur_buffer[MULU16(y, _gray_info.width) + x];
dst_end = dst + MULU16(height, _gray_info.width);
dst = &_gray_info.cur_buffer[_GRAY_MULUQ(y, _gray_info.width) + x];
dst_end = dst + _GRAY_MULUQ(height, _gray_info.width);
do
{
@ -576,8 +576,8 @@ void gray_fillrect(int x, int y, int width, int height)
}
while (dst < dst_end);
#else
dst = &_gray_info.cur_buffer[MULU16(x, _gray_info.height) + y];
dst_end = dst + MULU16(width, _gray_info.height);
dst = &_gray_info.cur_buffer[_GRAY_MULUQ(x, _gray_info.height) + y];
dst_end = dst + _GRAY_MULUQ(width, _gray_info.height);
do
{
@ -639,14 +639,14 @@ void gray_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
if (y + height > _gray_info.height)
height = _gray_info.height - y;
src += MULU16(stride, src_y >> 3) + src_x; /* move starting point */
src += _GRAY_MULUQ(stride, src_y >> 3) + src_x; /* move starting point */
src_y &= 7;
src_end = src + width;
fgfunc = _gray_pixelfuncs[_gray_info.drawmode];
bgfunc = _gray_pixelfuncs[_gray_info.drawmode ^ DRMODE_INVERSEVID];
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
dst = &_gray_info.cur_buffer[MULU16(y, _gray_info.width) + x];
dst = &_gray_info.cur_buffer[_GRAY_MULUQ(y, _gray_info.width) + x];
do
{
@ -655,7 +655,7 @@ void gray_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
unsigned data = *src_col >> src_y;
int numbits = 8 - src_y;
dst_end = dst_col + MULU16(height, _gray_info.width);
dst_end = dst_col + _GRAY_MULUQ(height, _gray_info.width);
do
{
if (data & 0x01)
@ -677,7 +677,7 @@ void gray_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
}
while (src < src_end);
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
dst = &_gray_info.cur_buffer[MULU16(x, _gray_info.height) + y];
dst = &_gray_info.cur_buffer[_GRAY_MULUQ(x, _gray_info.height) + y];
do
{
@ -745,10 +745,10 @@ void gray_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
if (y + height > _gray_info.height)
height = _gray_info.height - y;
src += MULU16(stride, src_y) + src_x; /* move starting point */
src += _GRAY_MULUQ(stride, src_y) + src_x; /* move starting point */
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
dst = &_gray_info.cur_buffer[MULU16(y, _gray_info.width) + x];
dst_end = dst + MULU16(height, _gray_info.width);
dst = &_gray_info.cur_buffer[_GRAY_MULUQ(y, _gray_info.width) + x];
dst_end = dst + _GRAY_MULUQ(height, _gray_info.width);
do
{
@ -765,14 +765,14 @@ void gray_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
}
while (dst < dst_end);
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
dst = &_gray_info.cur_buffer[MULU16(x, _gray_info.height) + y];
dst = &_gray_info.cur_buffer[_GRAY_MULUQ(x, _gray_info.height) + y];
dst_end = dst + height;
do
{
const unsigned char *src_row = src;
unsigned char *dst_row = dst++;
unsigned char *row_end = dst_row + MULU16(width, _gray_info.height);
unsigned char *row_end = dst_row + _GRAY_MULUQ(width, _gray_info.height);
do
{
@ -843,7 +843,7 @@ void gray_putsxy(int x, int y, const unsigned char *str)
void gray_ub_clear_display(void)
{
_gray_rb->memset(_gray_info.cur_buffer, _gray_info.depth,
MULU16(_gray_info.width, _gray_info.height));
_GRAY_MULUQ(_gray_info.width, _gray_info.height));
gray_update();
}
@ -860,7 +860,7 @@ void gray_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
/* Clear the greyscale display (sets all pixels to white) */
void gray_ub_clear_display(void)
{
_gray_rb->memset(_gray_info.plane_data, 0, MULU16(_gray_info.depth,
_gray_rb->memset(_gray_info.plane_data, 0, _GRAY_MULUQ(_gray_info.depth,
_gray_info.plane_size));
}
@ -1172,7 +1172,7 @@ static void _writearray(unsigned char *address, const unsigned char *src,
}
addr = address;
end = addr + MULU16(_gray_info.depth, _gray_info.plane_size);
end = addr + _GRAY_MULUQ(_gray_info.depth, _gray_info.plane_size);
/* set the bits for all 8 pixels in all bytes according to the
* precalculated patterns on the pattern stack */
@ -1243,14 +1243,14 @@ void gray_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
height = _gray_info.height - y;
shift = x & 7;
src += MULU16(stride, src_y) + src_x - shift;
dst = _gray_info.plane_data + (x >> 3) + MULU16(_gray_info.bwidth, y);
src += _GRAY_MULUQ(stride, src_y) + src_x - shift;
dst = _gray_info.plane_data + (x >> 3) + _GRAY_MULUQ(_gray_info.bwidth, y);
nx = width - 1 + shift;
mask = 0xFFu >> shift;
mask_right = 0xFFu << (~nx & 7);
dst_end = dst + MULU16(_gray_info.bwidth, height);
dst_end = dst + _GRAY_MULUQ(_gray_info.bwidth, height);
do
{
const unsigned char *src_row = src;
@ -2038,7 +2038,7 @@ static void _writearray(unsigned char *address, const unsigned char *src,
}
addr = address;
end = addr + MULU16(_gray_info.depth, _gray_info.plane_size);
end = addr + _GRAY_MULUQ(_gray_info.depth, _gray_info.plane_size);
/* set the bits for all 8 pixels in all bytes according to the
* precalculated patterns on the pattern stack */
@ -2109,9 +2109,9 @@ void gray_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
height = _gray_info.height - y;
shift = y & 7;
src += MULU16(stride, src_y) + src_x - MULU16(stride, shift);
src += _GRAY_MULUQ(stride, src_y) + src_x - _GRAY_MULUQ(stride, shift);
dst = _gray_info.plane_data + x
+ MULU16(_gray_info.width, y >> 3);
+ _GRAY_MULUQ(_gray_info.width, y >> 3);
ny = height - 1 + shift;
mask = 0xFFu << shift;

View file

@ -43,7 +43,7 @@ void gray_scroll_left(int count)
return;
data = _gray_info.cur_buffer;
data_end = data + MULU16(_gray_info.width, _gray_info.height);
data_end = data + _GRAY_MULUQ(_gray_info.width, _gray_info.height);
length = _gray_info.width - count;
blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ?
_gray_info.fg_index : _gray_info.bg_index;
@ -67,7 +67,7 @@ void gray_scroll_right(int count)
return;
data = _gray_info.cur_buffer;
data_end = data + MULU16(_gray_info.width, _gray_info.height);
data_end = data + _GRAY_MULUQ(_gray_info.width, _gray_info.height);
length = _gray_info.width - count;
blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ?
_gray_info.fg_index : _gray_info.bg_index;
@ -90,8 +90,8 @@ void gray_scroll_up(int count)
if ((unsigned)count >= (unsigned)_gray_info.height)
return;
shift = MULU16(_gray_info.width, count);
length = MULU16(_gray_info.width, _gray_info.height - count);
shift = _GRAY_MULUQ(_gray_info.width, count);
length = _GRAY_MULUQ(_gray_info.width, _gray_info.height - count);
blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ?
_gray_info.fg_index : _gray_info.bg_index;
@ -109,8 +109,8 @@ void gray_scroll_down(int count)
if ((unsigned)count >= (unsigned)_gray_info.height)
return;
shift = MULU16(_gray_info.width, count);
length = MULU16(_gray_info.width, _gray_info.height - count);
shift = _GRAY_MULUQ(_gray_info.width, count);
length = _GRAY_MULUQ(_gray_info.width, _gray_info.height - count);
blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ?
_gray_info.fg_index : _gray_info.bg_index;
@ -130,8 +130,8 @@ void gray_scroll_left(int count)
if ((unsigned)count >= (unsigned)_gray_info.width)
return;
shift = MULU16(_gray_info.height, count);
length = MULU16(_gray_info.height, _gray_info.width - count);
shift = _GRAY_MULUQ(_gray_info.height, count);
length = _GRAY_MULUQ(_gray_info.height, _gray_info.width - count);
blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ?
_gray_info.fg_index : _gray_info.bg_index;
@ -149,8 +149,8 @@ void gray_scroll_right(int count)
if ((unsigned)count >= (unsigned)_gray_info.width)
return;
shift = MULU16(_gray_info.height, count);
length = MULU16(_gray_info.height, _gray_info.width - count);
shift = _GRAY_MULUQ(_gray_info.height, count);
length = _GRAY_MULUQ(_gray_info.height, _gray_info.width - count);
blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ?
_gray_info.fg_index : _gray_info.bg_index;
@ -169,7 +169,7 @@ void gray_scroll_up(int count)
return;
data = _gray_info.cur_buffer;
data_end = data + MULU16(_gray_info.width, _gray_info.height);
data_end = data + _GRAY_MULUQ(_gray_info.width, _gray_info.height);
length = _gray_info.height - count;
blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ?
_gray_info.fg_index : _gray_info.bg_index;
@ -193,7 +193,7 @@ void gray_scroll_down(int count)
return;
data = _gray_info.cur_buffer;
data_end = data + MULU16(_gray_info.width, _gray_info.height);
data_end = data + _GRAY_MULUQ(_gray_info.width, _gray_info.height);
length = _gray_info.height - count;
blank = (_gray_info.drawmode & DRMODE_INVERSEVID) ?
_gray_info.fg_index : _gray_info.bg_index;
@ -267,7 +267,7 @@ void gray_ub_scroll_left(int count)
{
unsigned char *ptr_row = ptr;
unsigned char *row_end = ptr_row
+ MULU16(_gray_info.plane_size, _gray_info.depth);
+ _GRAY_MULUQ(_gray_info.plane_size, _gray_info.depth);
do
{
_gray_rb->memmove(ptr_row, ptr_row + shift, length);
@ -348,7 +348,7 @@ void gray_ub_scroll_right(int count)
{
unsigned char *ptr_row = ptr;
unsigned char *row_end = ptr_row
+ MULU16(_gray_info.plane_size, _gray_info.depth);
+ _GRAY_MULUQ(_gray_info.plane_size, _gray_info.depth);
do
{
_gray_rb->memmove(ptr_row + shift, ptr_row, length);
@ -415,7 +415,7 @@ void gray_ub_scroll_up(int count)
if ((unsigned) count >= (unsigned) _gray_info.height)
return;
blockshift = MULU16(_gray_info.bwidth, count);
blockshift = _GRAY_MULUQ(_gray_info.bwidth, count);
ptr = _gray_info.plane_data;
ptr_end2 = ptr + _gray_info.plane_size;
ptr_end1 = ptr_end2 - blockshift;
@ -424,7 +424,7 @@ void gray_ub_scroll_up(int count)
{
unsigned char *ptr_row = ptr;
unsigned char *row_end = ptr_row
+ MULU16(_gray_info.plane_size, _gray_info.depth);
+ _GRAY_MULUQ(_gray_info.plane_size, _gray_info.depth);
if (ptr < ptr_end1)
{
do
@ -459,7 +459,7 @@ void gray_ub_scroll_down(int count)
if ((unsigned) count >= (unsigned) _gray_info.height)
return;
blockshift = MULU16(_gray_info.bwidth, count);
blockshift = _GRAY_MULUQ(_gray_info.bwidth, count);
ptr_end2 = _gray_info.plane_data;
ptr_end1 = ptr_end2 + blockshift;
ptr = ptr_end2 + _gray_info.plane_size;
@ -470,7 +470,7 @@ void gray_ub_scroll_down(int count)
ptr -= _gray_info.bwidth;
ptr_row = ptr;
row_end = ptr_row + MULU16(_gray_info.plane_size, _gray_info.depth);
row_end = ptr_row + _GRAY_MULUQ(_gray_info.plane_size, _gray_info.depth);
if (ptr >= ptr_end1)
{
@ -514,7 +514,7 @@ void gray_ub_scroll_left(int count)
{
unsigned char *ptr_row = ptr;
unsigned char *row_end = ptr_row
+ MULU16(_gray_info.plane_size, _gray_info.depth);
+ _GRAY_MULUQ(_gray_info.plane_size, _gray_info.depth);
do
{
_gray_rb->memmove(ptr_row, ptr_row + count, length);
@ -546,7 +546,7 @@ void gray_ub_scroll_right(int count)
{
unsigned char *ptr_row = ptr;
unsigned char *row_end = ptr_row
+ MULU16(_gray_info.plane_size, _gray_info.depth);
+ _GRAY_MULUQ(_gray_info.plane_size, _gray_info.depth);
do
{
_gray_rb->memmove(ptr_row + count, ptr_row, length);
@ -575,7 +575,7 @@ void gray_ub_scroll_up(int count)
if (shift)
{
blockshift = MULU16(_gray_info.width, shift);
blockshift = _GRAY_MULUQ(_gray_info.width, shift);
ptr = _gray_info.plane_data;
ptr_end2 = ptr + _gray_info.plane_size;
ptr_end1 = ptr_end2 - blockshift;
@ -584,7 +584,7 @@ void gray_ub_scroll_up(int count)
{
unsigned char *ptr_row = ptr;
unsigned char *row_end = ptr_row
+ MULU16(_gray_info.plane_size, _gray_info.depth);
+ _GRAY_MULUQ(_gray_info.plane_size, _gray_info.depth);
if (ptr < ptr_end1)
{
do
@ -758,7 +758,7 @@ void gray_ub_scroll_down(int count)
if (shift)
{
blockshift = MULU16(_gray_info.width, shift);
blockshift = _GRAY_MULUQ(_gray_info.width, shift);
ptr_end2 = _gray_info.plane_data;
ptr_end1 = ptr_end2 + blockshift;
ptr = ptr_end2 + _gray_info.plane_size;
@ -769,7 +769,7 @@ void gray_ub_scroll_down(int count)
ptr -= _gray_info.width;
ptr_row = ptr;
row_end = ptr_row + MULU16(_gray_info.plane_size, _gray_info.depth);
row_end = ptr_row + _GRAY_MULUQ(_gray_info.plane_size, _gray_info.depth);
if (ptr >= ptr_end1)
{