aboutsummaryrefslogtreecommitdiffstats
path: root/w3mimg/fb/fb.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2003-07-07 15:48:16 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2003-07-07 15:48:16 +0000
commit0bbf6748bb7cd8cf187fcb7a8261c1dcddd03df5 (patch)
tree7361b0c822440318261d7ead736a2f8911f36ff0 /w3mimg/fb/fb.c
parent[w3m-dev 03927] deflate (diff)
downloadw3m-0bbf6748bb7cd8cf187fcb7a8261c1dcddd03df5.tar.gz
w3m-0bbf6748bb7cd8cf187fcb7a8261c1dcddd03df5.zip
[w3m-dev 03929] clear image
* image.c (syncImage): added (drawImage): rewrite using syncImage() (clearImage): use clear image command (6) * w3mimgdisplay.c: change protocol 2 => terminate drawing 6 => clear image (main): '2' calls TermImage() '6' calls ClearImage() TermImage() when exit (TermImage): renamed from ClearImage (ClearImage): rewritten to call w_op->clear() * w3mimg.h/w3mimg.h (w3mimg_op): add clear() * w3mimg/fb/fb.c (fb_clear): added * w3mimg/fb/fb.h (fb_clear): added * w3mimg/fb/fb_img.c (fb_image_clear): added * w3mimg/fb/fb_w3mimg.c (w3mfb_clear): added (w3mimg_fbopen): initialize wop->clear * w3mimg/x11/x11_w3mimg.c (x11_clear): added (w3mimg_x11open): initialize wop->clear From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r--w3mimg/fb/fb.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/w3mimg/fb/fb.c b/w3mimg/fb/fb.c
index c936784..954525a 100644
--- a/w3mimg/fb/fb.c
+++ b/w3mimg/fb/fb.c
@@ -1,4 +1,4 @@
-/* $Id: fb.c,v 1.9 2002/10/31 09:36:22 ukai Exp $ */
+/* $Id: fb.c,v 1.10 2003/07/07 15:48:17 ukai Exp $ */
/**************************************************************************
fb.c 0.3 Copyright (C) 2002, hito
**************************************************************************/
@@ -365,6 +365,30 @@ fb_height(void)
return vscinfo.yres;
}
+int
+fb_clear(int x, int y, int w, int h, int r, int g, int b)
+{
+ unsigned long bg;
+ int i, offset_fb;
+
+ if (is_open != TRUE || x > fb_width() || y > fb_height())
+ return 1;
+ if (x + w > fb_width())
+ w = fb_width() - x;
+ if (y + h > fb_height())
+ 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);
+ for (i = 0; i < h; i++) {
+ memcpy(buf + offset_fb, bg, pixel_size * w);
+ offset_fb += fscinfo.line_length;
+ }
+ return 0;
+}
+
/********* static functions **************/
static
int