0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <linux/string.h>
0013 #include <linux/fb.h>
0014
0015 #include "atafb.h"
0016 #include "atafb_utils.h"
0017
0018
0019
0020
0021
0022
0023 void atafb_mfb_copyarea(struct fb_info *info, u_long next_line,
0024 int sy, int sx, int dy, int dx,
0025 int height, int width)
0026 {
0027 u8 *src, *dest;
0028 u_int rows;
0029
0030 if (sx == 0 && dx == 0 && width == next_line) {
0031 src = (u8 *)info->screen_base + sy * (width >> 3);
0032 dest = (u8 *)info->screen_base + dy * (width >> 3);
0033 fb_memmove(dest, src, height * (width >> 3));
0034 } else if (dy <= sy) {
0035 src = (u8 *)info->screen_base + sy * next_line + (sx >> 3);
0036 dest = (u8 *)info->screen_base + dy * next_line + (dx >> 3);
0037 for (rows = height; rows--;) {
0038 fb_memmove(dest, src, width >> 3);
0039 src += next_line;
0040 dest += next_line;
0041 }
0042 } else {
0043 src = (u8 *)info->screen_base + (sy + height - 1) * next_line + (sx >> 3);
0044 dest = (u8 *)info->screen_base + (dy + height - 1) * next_line + (dx >> 3);
0045 for (rows = height; rows--;) {
0046 fb_memmove(dest, src, width >> 3);
0047 src -= next_line;
0048 dest -= next_line;
0049 }
0050 }
0051 }
0052
0053 void atafb_mfb_fillrect(struct fb_info *info, u_long next_line, u32 color,
0054 int sy, int sx, int height, int width)
0055 {
0056 u8 *dest;
0057 u_int rows;
0058
0059 dest = (u8 *)info->screen_base + sy * next_line + (sx >> 3);
0060
0061 if (sx == 0 && width == next_line) {
0062 if (color)
0063 fb_memset255(dest, height * (width >> 3));
0064 else
0065 fb_memclear(dest, height * (width >> 3));
0066 } else {
0067 for (rows = height; rows--; dest += next_line) {
0068 if (color)
0069 fb_memset255(dest, width >> 3);
0070 else
0071 fb_memclear_small(dest, width >> 3);
0072 }
0073 }
0074 }
0075
0076 void atafb_mfb_linefill(struct fb_info *info, u_long next_line,
0077 int dy, int dx, u32 width,
0078 const u8 *data, u32 bgcolor, u32 fgcolor)
0079 {
0080 u8 *dest;
0081 u_int rows;
0082
0083 dest = (u8 *)info->screen_base + dy * next_line + (dx >> 3);
0084
0085 for (rows = width / 8; rows--; ) {
0086
0087 *dest++ = *data++;
0088 }
0089 }