fix indent

This commit is contained in:
Fumitoshi UKAI
2002-09-09 13:59:09 +00:00
parent a9a1915238
commit 0317882329
5 changed files with 59 additions and 55 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: fb_gdkpixbuf.c,v 1.7 2002/07/29 15:25:37 ukai Exp $ */ /* $Id: fb_gdkpixbuf.c,v 1.8 2002/09/09 14:00:18 ukai Exp $ */
/************************************************************************** /**************************************************************************
fb_gdkpixbuf.c 0.3 Copyright (C) 2002, hito fb_gdkpixbuf.c 0.3 Copyright (C) 2002, hito
**************************************************************************/ **************************************************************************/
@@ -8,13 +8,13 @@
#include "fb_img.h" #include "fb_img.h"
static void draw(FB_IMAGE * img, int bg, int x, int y, int w, int h, static void draw(FB_IMAGE * img, int bg, int x, int y, int w, int h,
GdkPixbuf * pixbuf); GdkPixbuf * pixbuf);
static GdkPixbuf *resize_image(GdkPixbuf * pixbuf, int width, int height); static GdkPixbuf *resize_image(GdkPixbuf * pixbuf, int width, int height);
int int
get_image_size(char *filename, int *w, int *h) get_image_size(char *filename, int *w, int *h)
{ {
GdkPixbufAnimation * animation; GdkPixbufAnimation *animation;
if (filename == NULL) if (filename == NULL)
return 1; return 1;
animation = gdk_pixbuf_animation_new_from_file(filename); animation = gdk_pixbuf_animation_new_from_file(filename);
@@ -26,13 +26,14 @@ get_image_size(char *filename, int *w, int *h)
return 0; return 0;
} }
FB_IMAGE ** fb_image_load(char *filename, int w, int h) FB_IMAGE **
fb_image_load(char *filename, int w, int h)
{ {
GdkPixbufAnimation * animation; GdkPixbufAnimation *animation;
GList * frames; GList *frames;
double ratio_w, ratio_h; double ratio_w, ratio_h;
int n, i, fw, fh; int n, i, fw, fh;
FB_IMAGE ** fb_frame; FB_IMAGE **fb_frame;
GdkPixbufFrameAction action = GDK_PIXBUF_FRAME_REVERT; GdkPixbufFrameAction action = GDK_PIXBUF_FRAME_REVERT;
if (filename == NULL) if (filename == NULL)
return NULL; return NULL;
@@ -47,7 +48,8 @@ FB_IMAGE ** fb_image_load(char *filename, int w, int h)
w = fw; w = fw;
h = fh; h = fh;
ratio_w = ratio_h = 1; ratio_w = ratio_h = 1;
} else { }
else {
ratio_w = 1.0 * w / fw; ratio_w = 1.0 * w / fw;
ratio_h = 1.0 * h / fh; ratio_h = 1.0 * h / fh;
} }
@@ -55,8 +57,8 @@ FB_IMAGE ** fb_image_load(char *filename, int w, int h)
if (fb_frame == NULL) if (fb_frame == NULL)
goto END; goto END;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
GdkPixbufFrame * frame; GdkPixbufFrame *frame;
GdkPixbuf * org_pixbuf, *pixbuf; GdkPixbuf *org_pixbuf, *pixbuf;
int width, height, ofstx, ofsty; int width, height, ofstx, ofsty;
frame = (GdkPixbufFrame *) g_list_nth_data(frames, i); frame = (GdkPixbufFrame *) g_list_nth_data(frames, i);
org_pixbuf = gdk_pixbuf_frame_get_pixbuf(frame); org_pixbuf = gdk_pixbuf_frame_get_pixbuf(frame);
@@ -66,7 +68,8 @@ FB_IMAGE ** fb_image_load(char *filename, int w, int h)
height = gdk_pixbuf_get_height(org_pixbuf); height = gdk_pixbuf_get_height(org_pixbuf);
if (ofstx == 0 && ofsty == 0 && width == fw && height == fh) { if (ofstx == 0 && ofsty == 0 && width == fw && height == fh) {
pixbuf = resize_image(org_pixbuf, w, h); pixbuf = resize_image(org_pixbuf, w, h);
} else { }
else {
pixbuf = pixbuf =
resize_image(org_pixbuf, width * ratio_w, height * ratio_h); resize_image(org_pixbuf, width * ratio_w, height * ratio_h);
ofstx *= ratio_w; ofstx *= ratio_w;
@@ -81,9 +84,9 @@ FB_IMAGE ** fb_image_load(char *filename, int w, int h)
fb_image_copy(fb_frame[i], fb_frame[i - 1]); fb_image_copy(fb_frame[i], fb_frame[i - 1]);
break; break;
case GDK_PIXBUF_FRAME_DISPOSE: case GDK_PIXBUF_FRAME_DISPOSE:
if(bg_r != 0 || bg_g != 0 || bg_b != 0){ if (bg_r != 0 || bg_g != 0 || bg_b != 0) {
fb_image_fill(fb_frame[i], bg_r, bg_g, bg_b); fb_image_fill(fb_frame[i], bg_r, bg_g, bg_b);
} }
break; break;
case GDK_PIXBUF_FRAME_REVERT: case GDK_PIXBUF_FRAME_REVERT:
fb_image_copy(fb_frame[i], fb_frame[0]); fb_image_copy(fb_frame[i], fb_frame[0]);
@@ -102,10 +105,10 @@ FB_IMAGE ** fb_image_load(char *filename, int w, int h)
return fb_frame; return fb_frame;
} }
static void static void
draw(FB_IMAGE * img, int bg, int x, int y, int w, int h, GdkPixbuf * pixbuf) draw(FB_IMAGE * img, int bg, int x, int y, int w, int h, GdkPixbuf * pixbuf)
{ {
int i, j, r, g, b, offset, bpp, rowstride; int i, j, r, g, b, offset, bpp, rowstride;
guchar * pixels; guchar *pixels;
gboolean alpha; gboolean alpha;
if (img == NULL || pixbuf == NULL) if (img == NULL || pixbuf == NULL)
return; return;
@@ -122,7 +125,8 @@ draw(FB_IMAGE * img, int bg, int x, int y, int w, int h, GdkPixbuf * pixbuf)
if (alpha && pixels[offset + 3] == 0) { if (alpha && pixels[offset + 3] == 0) {
if (bg) if (bg)
fb_image_pset(img, i + x, j + y, bg_r, bg_g, bg_b); fb_image_pset(img, i + x, j + y, bg_r, bg_g, bg_b);
} else { }
else {
fb_image_pset(img, i + x, j + y, r, g, b); fb_image_pset(img, i + x, j + y, r, g, b);
} }
} }
@@ -130,9 +134,9 @@ draw(FB_IMAGE * img, int bg, int x, int y, int w, int h, GdkPixbuf * pixbuf)
return; return;
} }
static GdkPixbuf * static GdkPixbuf *
resize_image(GdkPixbuf * pixbuf, int width, int height) resize_image(GdkPixbuf * pixbuf, int width, int height)
{ {
GdkPixbuf * resized_pixbuf; GdkPixbuf *resized_pixbuf;
int w, h; int w, h;
if (pixbuf == NULL) if (pixbuf == NULL)
return NULL; return NULL;

View File

@@ -1,4 +1,4 @@
/* $Id: fb_imlib2.c,v 1.7 2002/07/29 15:25:37 ukai Exp $ */ /* $Id: fb_imlib2.c,v 1.8 2002/09/09 14:00:42 ukai Exp $ */
/************************************************************************** /**************************************************************************
fb_imlib2.c 0.3 Copyright (C) 2002, hito fb_imlib2.c 0.3 Copyright (C) 2002, hito
**************************************************************************/ **************************************************************************/
@@ -89,7 +89,8 @@ draw(FB_IMAGE * img, Imlib_Image image)
if (a == 0) { if (a == 0) {
fb_image_pset(img, i, j, bg_r, bg_g, bg_b); fb_image_pset(img, i, j, bg_r, bg_g, bg_b);
} else { }
else {
fb_image_pset(img, i, j, r, g, b); fb_image_pset(img, i, j, r, g, b);
} }
} }

View File

@@ -1,4 +1,4 @@
/* $Id: fb_w3mimg.c,v 1.3 2002/07/29 15:25:37 ukai Exp $ */ /* $Id: fb_w3mimg.c,v 1.4 2002/09/09 14:00:49 ukai Exp $ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
@@ -8,7 +8,7 @@
#include "w3mimg/w3mimg.h" #include "w3mimg/w3mimg.h"
static int static int
w3mfb_init(w3mimg_op *self) w3mfb_init(w3mimg_op * self)
{ {
if (self == NULL) if (self == NULL)
return 0; return 0;
@@ -16,7 +16,7 @@ w3mfb_init(w3mimg_op *self)
} }
static int static int
w3mfb_finish(w3mimg_op *self) w3mfb_finish(w3mimg_op * self)
{ {
if (self == NULL) if (self == NULL)
return 0; return 0;
@@ -24,7 +24,7 @@ w3mfb_finish(w3mimg_op *self)
} }
static int static int
w3mfb_active(w3mimg_op *self) w3mfb_active(w3mimg_op * self)
{ {
if (self == NULL) if (self == NULL)
return 0; return 0;
@@ -32,7 +32,7 @@ w3mfb_active(w3mimg_op *self)
} }
static void static void
w3mfb_set_background(w3mimg_op *self, char *background) w3mfb_set_background(w3mimg_op * self, char *background)
{ {
if (self == NULL) if (self == NULL)
return; return;
@@ -44,19 +44,19 @@ w3mfb_set_background(w3mimg_op *self, char *background)
} }
static void static void
w3mfb_sync(w3mimg_op *self) w3mfb_sync(w3mimg_op * self)
{ {
return; return;
} }
static void static void
w3mfb_close(w3mimg_op *self) w3mfb_close(w3mimg_op * self)
{ {
fb_close(); fb_close();
} }
static int static int
w3mfb_load_image(w3mimg_op *self, W3MImage *img, char *fname, int w, int h) w3mfb_load_image(w3mimg_op * self, W3MImage * img, char *fname, int w, int h)
{ {
FB_IMAGE **im; FB_IMAGE **im;
@@ -72,9 +72,8 @@ w3mfb_load_image(w3mimg_op *self, W3MImage *img, char *fname, int w, int h)
} }
static int static int
w3mfb_show_image(w3mimg_op *self, W3MImage *img, int sx, int sy, w3mfb_show_image(w3mimg_op * self, W3MImage * img, int sx, int sy,
int sw, int sh, int sw, int sh, int x, int y)
int x, int y)
{ {
int i; int i;
FB_IMAGE **frame; FB_IMAGE **frame;
@@ -83,32 +82,31 @@ w3mfb_show_image(w3mimg_op *self, W3MImage *img, int sx, int sy,
if (self == NULL) if (self == NULL)
return 0; return 0;
frame = (FB_IMAGE **)img->pixmap; frame = (FB_IMAGE **) img->pixmap;
i = frame[0]->id; i = frame[0]->id;
fb_image_draw(frame[i], fb_image_draw(frame[i],
x + self->offset_x, y + self->offset_y, x + self->offset_x, y + self->offset_y,
sx, sy, sx, sy, (sw ? sw : img->width), (sh ? sh : img->height));
(sw ? sw : img->width), (sh ? sh : img->height)); if (frame[0]->num > 1) {
if(frame[0]->num > 1){ if (frame[1]->id > WAIT_CNT) {
if(frame[1]->id > WAIT_CNT){ frame[1]->id = 0;
frame[1]->id = 0; if (i < frame[0]->num - 1)
if(i < frame[0]->num - 1) frame[0]->id = i + 1;
frame[0]->id = i + 1; else
else frame[0]->id = 0;
frame[0]->id = 0; }
} frame[1]->id += 1;
frame[1]->id += 1;
} }
return 1; return 1;
} }
static void static void
w3mfb_free_image(w3mimg_op *self, W3MImage *img) w3mfb_free_image(w3mimg_op * self, W3MImage * img)
{ {
if (self == NULL) if (self == NULL)
return; return;
if (img && img->pixmap) { if (img && img->pixmap) {
fb_frame_free((FB_IMAGE **)img->pixmap); fb_frame_free((FB_IMAGE **) img->pixmap);
img->pixmap = NULL; img->pixmap = NULL;
img->width = 0; img->width = 0;
img->height = 0; img->height = 0;
@@ -116,7 +114,7 @@ w3mfb_free_image(w3mimg_op *self, W3MImage *img)
} }
static int static int
w3mfb_get_image_size(w3mimg_op *self, W3MImage *img, w3mfb_get_image_size(w3mimg_op * self, W3MImage * img,
char *fname, int *w, int *h) char *fname, int *w, int *h)
{ {
int i; int i;
@@ -133,7 +131,7 @@ w3mimg_op *
w3mimg_fbopen() w3mimg_fbopen()
{ {
w3mimg_op *wop = NULL; w3mimg_op *wop = NULL;
wop = (w3mimg_op *)malloc(sizeof(w3mimg_op)); wop = (w3mimg_op *) malloc(sizeof(w3mimg_op));
if (wop == NULL) if (wop == NULL)
return NULL; return NULL;
memset(wop, 0, sizeof(w3mimg_op)); memset(wop, 0, sizeof(w3mimg_op));
@@ -143,7 +141,7 @@ w3mimg_fbopen()
wop->width = fb_width(); wop->width = fb_width();
wop->height = fb_height(); wop->height = fb_height();
wop->init = w3mfb_init; wop->init = w3mfb_init;
wop->finish = w3mfb_finish; wop->finish = w3mfb_finish;
wop->active = w3mfb_active; wop->active = w3mfb_active;
@@ -157,7 +155,7 @@ w3mimg_fbopen()
wop->get_image_size = w3mfb_get_image_size; wop->get_image_size = w3mfb_get_image_size;
return wop; return wop;
error: error:
free(wop); free(wop);
return NULL; return NULL;
} }

View File

@@ -1,4 +1,4 @@
/* $Id: w3mimg.h,v 1.4 2002/07/22 16:17:32 ukai Exp $ */ /* $Id: w3mimg.h,v 1.5 2002/09/09 13:59:24 ukai Exp $ */
#include "config.h" #include "config.h"
#ifdef USE_W3MIMG_FB #ifdef USE_W3MIMG_FB
@@ -29,7 +29,7 @@ typedef struct _w3mimg_op {
int (*show_image) (struct _w3mimg_op * self, W3MImage * img, int (*show_image) (struct _w3mimg_op * self, W3MImage * img,
int sx, int sy, int sw, int sh, int x, int y); int sx, int sy, int sw, int sh, int x, int y);
void (*free_image) (struct _w3mimg_op * self, W3MImage * img); void (*free_image) (struct _w3mimg_op * self, W3MImage * img);
int (*get_image_size) (struct _w3mimg_op * self, W3MImage * img, int (*get_image_size) (struct _w3mimg_op * self, W3MImage * img,
char *fname, int *w, int *h); char *fname, int *w, int *h);
} w3mimg_op; } w3mimg_op;

View File

@@ -1,4 +1,4 @@
/* $Id: x11_w3mimg.c,v 1.5 2002/07/22 16:17:32 ukai Exp $ */ /* $Id: x11_w3mimg.c,v 1.6 2002/09/09 13:59:09 ukai Exp $ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
@@ -195,7 +195,8 @@ x11_free_image(w3mimg_op * self, W3MImage * img)
} }
static int static int
x11_get_image_size(w3mimg_op * self, W3MImage * img, char *fname, int *w, int *h) x11_get_image_size(w3mimg_op * self, W3MImage * img, char *fname, int *w,
int *h)
{ {
struct x11_info *xi; struct x11_info *xi;
ImlibImage *im; ImlibImage *im;