commit 6cec752e8ebb2614a92b59ac79c90643eef3b0a3
parent 36b6e9c6ad470222c5e591ed8e679609b2d358ed
Author: ukai <ukai>
Date: Tue, 8 Jul 2003 17:29:56 +0000
[w3m-dev 03931] Re: clear image
* w3mimgdisplay.c (ClearImage): offset
* w3mimg/fb/fb.c (fb_clear): memcpy by pixel_size
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat:
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,9 @@
+2003-07-09 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
+
+ * [w3m-dev 03931] Re: clear image
+ * w3mimgdisplay.c (ClearImage): offset
+ * w3mimg/fb/fb.c (fb_clear): memcpy by pixel_size
+
2003-07-08 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03929] clear image
diff --git a/w3mimg/fb/fb.c b/w3mimg/fb/fb.c
@@ -368,8 +368,8 @@ fb_height(void)
int
fb_clear(int x, int y, int w, int h, int r, int g, int b)
{
- unsigned long bg;
- int i, offset_fb;
+ unsigned long work;
+ int i, j, offset_fb;
if (is_open != TRUE || x > fb_width() || y > fb_height())
return 1;
@@ -379,11 +379,12 @@ fb_clear(int x, int y, int w, int h, int r, int g, int b)
h = fb_height() - y;
offset_fb = fscinfo.line_length * y + pixel_size * x;
- bg = ((r >> (CHAR_BIT - vscinfo.red.length)) << vscinfo.red.offset) +
- ((g >> (CHAR_BIT - vscinfo.green.length)) << vscinfo.green.offset) +
- ((b >> (CHAR_BIT - vscinfo.blue.length)) << vscinfo.blue.offset);
+ work = ((r >> (CHAR_BIT - vscinfo.red.length)) << vscinfo.red.offset) +
+ ((g >> (CHAR_BIT - vscinfo.green.length)) << vscinfo.green.offset) +
+ ((b >> (CHAR_BIT - vscinfo.blue.length)) << vscinfo.blue.offset);
for (i = 0; i < h; i++) {
- memcpy(buf + offset_fb, bg, pixel_size * w);
+ for (j = 0; j < w; j++)
+ memcpy(buf + offset_fb + pixel_size * j, &work, pixel_size);
offset_fb += fscinfo.line_length;
}
return 0;
diff --git a/w3mimgdisplay.c b/w3mimgdisplay.c
@@ -324,5 +324,5 @@ ClearImage(char *buf)
for (; isdigit(*p); p++)
h = 10 * h + (*p - '0');
- w_op->clear(w_op, x, y, w, h);
+ w_op->clear(w_op, x + offset_x, y + offset_y, w, h);
}