commit 0d770456d9aae39f9ced181f1239f98a18e22523
parent bc2dbb8e7e3c8149d699e32e41560915b16bdfaf
Author: ukai <ukai>
Date: Sun, 13 Jul 2003 16:19:09 +0000
[w3m-dev 03938] clear region margin
* w3mimgdisplay.c (clearMargin): added
(GetOption): add -margin
(ClearImage): clear margin
* w3mi,g/w3mimg.h (w3mimg_op): clear_margin
* w3mimg/fb/fb.c (fb_clear): x,y must be >= 0
* w3mimg/x11/x11_w3mimg.c (x11_clear): x,y must be >= 0
From: Hiroyuki Ito <hito@crl.go.jp>
Diffstat:
5 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,13 @@
+2003-07-14 Hiroyuki Ito <hito@crl.go.jp>
+
+ * [w3m-dev 03938] clear region margin
+ * w3mimgdisplay.c (clearMargin): added
+ (GetOption): add -margin
+ (ClearImage): clear margin
+ * w3mi,g/w3mimg.h (w3mimg_op): clear_margin
+ * w3mimg/fb/fb.c (fb_clear): x,y must be >= 0
+ * w3mimg/x11/x11_w3mimg.c (x11_clear): x,y must be >= 0
+
2003-07-14 Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
* [w3m-dev 03937] <center> in <table>
diff --git a/w3mimg/fb/fb.c b/w3mimg/fb/fb.c
@@ -357,6 +357,12 @@ fb_clear(int x, int y, int w, int h, int r, int g, int b)
if (is_open != TRUE || x > fb_width() || y > fb_height())
return 1;
+
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+
if (x + w > fb_width())
w = fb_width() - x;
if (y + h > fb_height())
diff --git a/w3mimg/w3mimg.h b/w3mimg/w3mimg.h
@@ -16,6 +16,7 @@ typedef struct _w3mimg_op {
void *priv; /* driver specific data */
int width, height; /* window width, height */
int offset_x, offset_y; /* offset */
+ int clear_margin;
int max_anim;
int (*init) (struct _w3mimg_op * self);
diff --git a/w3mimg/x11/x11_w3mimg.c b/w3mimg/x11/x11_w3mimg.c
@@ -131,6 +131,12 @@ x11_clear(w3mimg_op * self, int x, int y, int w, int h)
xi = (struct x11_info *)self->priv;
if (xi == NULL)
return 0;
+
+ if (x < 0)
+ x = 0;
+ if (y < 0)
+ y = 0;
+
XClearArea(xi->display, xi->window, x, y, w, h, False);
return 1;
}
diff --git a/w3mimgdisplay.c b/w3mimgdisplay.c
@@ -17,7 +17,7 @@ static char *defined_size = NULL;
#define MAX_IMAGE 1000
static W3MImage *imageBuf = NULL;
-static int maxImage = 0, maxAnim = 100;
+static int maxImage = 0, maxAnim = 100, clearMargin = 0;
static void GetOption(int argc, char **argv);
static void DrawImage(char *buf, int redraw);
@@ -58,7 +58,9 @@ main(int argc, char **argv)
w_op->offset_x = offset_x;
if (defined_y)
w_op->offset_y = offset_y;
+
w_op->max_anim = maxAnim;
+ w_op->clear_margin = clearMargin;
if (defined_test) {
printf("%d %d\n", w_op->width - w_op->offset_x,
@@ -192,6 +194,13 @@ GetOption(int argc, char **argv)
exit(1);
maxAnim = atoi(argv[i]);
}
+ else if (!strcmp("-margin", argv[i])) {
+ if (++i >= argc)
+ exit(1);
+ clearMargin = atoi(argv[i]);
+ if (clearMargin < 0)
+ clearMargin = 0;
+ }
else if (!strcmp("-size", argv[i])) {
if (++i >= argc)
exit(1);
@@ -324,5 +333,9 @@ ClearImage(char *buf)
for (; isdigit(*p); p++)
h = 10 * h + (*p - '0');
- w_op->clear(w_op, x + offset_x, y + offset_y, w, h);
+ w_op->clear(w_op,
+ x + offset_x - w_op->clear_margin,
+ y + offset_y - w_op->clear_margin,
+ w + w_op->clear_margin * 2,
+ h + w_op->clear_margin * 2);
}