Commit 74268afd authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Arturo Espinosa
Browse files

Reindented to use the GNOME Indentation.

1999-10-18  Federico Mena Quintero  <federico@redhat.com>

	* src/*: Reindented to use the GNOME Indentation.
parent 3b9835b5
This diff is collapsed.
1999-10-18 Federico Mena Quintero <federico@redhat.com>
* src/*: Reindented to use the GNOME Indentation.
1999-10-18 Havoc Pennington <hp@pobox.com>
* configure.in: Use AM_PATH_GLIB instead of glib-config directly
......
......@@ -4,12 +4,12 @@
/* The optional cache interface */
typedef struct {
int dummy;
} GdkPixBufCache;
} GdkPixbufCache;
GdkPixBufCache *gdk_pixbuf_cache_new (long image_cache_limit,
GdkPixbufCache *gdk_pixbuf_cache_new (long image_cache_limit,
long pixmap_bitmap_cache_limit);
void gdk_pixbuf_cache_destroy (GdkPixBufCache *cache);
void gdk_pixbuf_cache_destroy (GdkPixbufCache *cache);
GdkPixBuf *gdk_pixbuf_cache_load_image (GdkPixBufCache *cache,
GdkPixbuf *gdk_pixbuf_cache_load_image (GdkPixbufCache *cache,
const char *file);
#endif
/*
* gdk-pixbuf-data.c: Code to load images into GdkPixBufs from constant data
* gdk-pixbuf-data.c: Code to load images into GdkPixbufs from constant data
*
* Author:
* Michael Fulbright (drmike@redhat.com)
......@@ -15,10 +15,10 @@
/* This function does all the work. */
static GdkPixBuf *
static GdkPixbuf *
_pixbuf_create_from_rgb_d(unsigned char *data, int w, int h)
{
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
ArtPixBuf *art_pixbuf;
art_u8 *pixels;
......@@ -40,12 +40,10 @@ _pixbuf_create_from_rgb_d(unsigned char *data, int w, int h)
}
GdkPixBuf *
gdk_pixbuf_load_image_from_rgb_d (unsigned char *data,
int rgb_width, int rgb_height)
GdkPixbuf *
gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, int rgb_width, int rgb_height)
{
g_return_val_if_fail (data != NULL, NULL);
return _pixbuf_create_from_rgb_d(data, rgb_width, rgb_height);
}
......@@ -4,11 +4,7 @@
#include <gdk/gdk.h>
#include <gdk-pixbuf.h>
GdkPixBuf *gdk_pixbuf_rgb_from_drawable (GdkWindow *window,
gint x, gint y,
gint width, gint height);
GdkPixBuf *gdk_pixbuf_rgba_from_drawable (GdkWindow *window,
gint x, gint y,
gint width, gint height);
GdkPixbuf *gdk_pixbuf_rgb_from_drawable (GdkWindow *window, gint x, gint y, gint width, gint height);
GdkPixbuf *gdk_pixbuf_rgba_from_drawable (GdkWindow *window, gint x, gint y, gint width, gint height);
#endif /* _GDK_PIXBUF_DRAWABLE_H_ */
/*
* gdk-pixbuf-io.c: Code to load images into GdkPixBufs
* gdk-pixbuf-io.c: Code to load images into GdkPixbufs
*
* Author:
* Miguel de Icaza (miguel@gnu.org)
......@@ -106,7 +106,7 @@ pixbuf_check_ppm (unsigned char *buffer, int size)
if (size < 20)
return FALSE;
if (buffer [0] == 'P'){
if (buffer [0] == 'P') {
if (buffer [1] == '1' ||
buffer [1] == '2' ||
buffer [1] == '3' ||
......@@ -122,8 +122,8 @@ static struct {
char *module_name;
gboolean (*format_check)(unsigned char *buffer, int size);
GModule *module;
GdkPixBuf *(*load)(FILE *f);
int (*save)(GdkPixBuf *p, FILE *f, ...);
GdkPixbuf *(*load)(FILE *f);
int (*save)(GdkPixbuf *p, FILE *f, ...);
} file_formats [] = {
{ "png", pixbuf_check_png, NULL, NULL, NULL },
{ "jpeg", pixbuf_check_jpeg, NULL, NULL, NULL },
......@@ -163,10 +163,10 @@ image_handler_load (int idx)
file_formats [idx].save = save_sym;
}
GdkPixBuf *
GdkPixbuf *
gdk_pixbuf_load_image (const char *file)
{
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
gint n, i;
FILE *f;
char buffer [128];
......@@ -176,17 +176,17 @@ gdk_pixbuf_load_image (const char *file)
return NULL;
n = fread (&buffer, 1, sizeof (buffer), f);
if (n == 0){
if (n == 0) {
fclose (f);
return NULL;
}
for (i = 0; file_formats [i].module_name; i++){
if ((*file_formats [i].format_check)(buffer, n)){
for (i = 0; file_formats [i].module_name; i++) {
if ((*file_formats [i].format_check)(buffer, n)) {
if (!file_formats [i].load)
image_handler_load (i);
if (!file_formats [i].load){
if (!file_formats [i].load) {
fclose (f);
return NULL;
}
......
/*
* gdk-pixbuf.c: Resource management.
/* GdkPixbuf library
*
* Authors:
* Miguel de Icaza (miguel@gnu.org)
* Mark Crichton (crichton@gimp.org)
* Copyright (C) 1999 The Free Software Foundation
*
* Authors: Mark Crichton <crichton@gimp.org>
* Miguel de Icaza <miguel@gnu.org>
* Federico Mena-Quintero <federico@gimp.org>
* Carsten Haitzler <raster@rasterman.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <glib.h>
#include <math.h>
#include <glib.h>
#include <libart_lgpl/art_misc.h>
#include <libart_lgpl/art_affine.h>
#include <libart_lgpl/art_pixbuf.h>
......@@ -16,25 +33,25 @@
#include <libart_lgpl/art_alphagamma.h>
#include "gdk-pixbuf.h"
void
gdk_pixbuf_destroy (GdkPixBuf *pixbuf)
gdk_pixbuf_destroy (GdkPixbuf *pixbuf)
{
art_pixbuf_free (pixbuf->art_pixbuf);
pixbuf->art_pixbuf = NULL;
g_free (pixbuf);
}
GdkPixBuf *
gdk_pixbuf_new (ArtPixBuf *art_pixbuf,
GdkPixBufUnrefFunc *unref_fn)
GdkPixbuf *
gdk_pixbuf_new (ArtPixBuf *art_pixbuf, GdkPixbufUnrefFunc *unref_fn)
{
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
if (!art_pixbuf)
return NULL;
pixbuf = g_new (GdkPixBuf, 1);
pixbuf = g_new (GdkPixbuf, 1);
pixbuf->ref_count = 1;
pixbuf->unref_fn = unref_fn;
pixbuf->art_pixbuf = art_pixbuf;
......@@ -43,7 +60,7 @@ gdk_pixbuf_new (ArtPixBuf *art_pixbuf,
}
void
gdk_pixbuf_ref (GdkPixBuf *pixbuf)
gdk_pixbuf_ref (GdkPixbuf *pixbuf)
{
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->ref_count > 0);
......@@ -52,7 +69,7 @@ gdk_pixbuf_ref (GdkPixBuf *pixbuf)
}
void
gdk_pixbuf_unref (GdkPixBuf *pixbuf)
gdk_pixbuf_unref (GdkPixbuf *pixbuf)
{
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (pixbuf->ref_count > 0);
......@@ -63,15 +80,15 @@ gdk_pixbuf_unref (GdkPixBuf *pixbuf)
gdk_pixbuf_destroy (pixbuf);
}
GdkPixBuf *
gdk_pixbuf_scale (const GdkPixBuf *pixbuf, gint w, gint h)
GdkPixbuf *
gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h)
{
art_u8 *pixels;
gint rowstride;
double affine[6];
ArtAlphaGamma *alphagamma;
ArtPixBuf *art_pixbuf = NULL;
GdkPixBuf *copy = NULL;
GdkPixbuf *copy = NULL;
alphagamma = NULL;
......@@ -102,10 +119,10 @@ gdk_pixbuf_scale (const GdkPixBuf *pixbuf, gint w, gint h)
return copy;
}
GdkPixBuf *
gdk_pixbuf_duplicate (const GdkPixBuf *pixbuf)
GdkPixbuf *
gdk_pixbuf_duplicate (const GdkPixbuf *pixbuf)
{
GdkPixBuf *copy = g_new (GdkPixBuf, 1);
GdkPixbuf *copy = g_new (GdkPixbuf, 1);
copy->ref_count = 1;
copy->unref_fn = pixbuf->unref_fn;
......@@ -114,8 +131,8 @@ gdk_pixbuf_duplicate (const GdkPixBuf *pixbuf)
return copy;
}
GdkPixBuf *
gdk_pixbuf_rotate (GdkPixBuf *pixbuf, gdouble angle)
GdkPixbuf *
gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle)
{
art_u8 *pixels;
gint rowstride, w, h;
......
#ifndef _GDK_PIXBUF_H_
#define _GDK_PIXBUF_H_
/* GdkPixbuf library
*
* Copyright (C) 1999 The Free Software Foundation
*
* Authors: Mark Crichton <crichton@gimp.org>
* Miguel de Icaza <miguel@gnu.org>
* Federico Mena-Quintero <federico@gimp.org>
* Carsten Haitzler <raster@rasterman.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef GDK_PIXBUF_H
#define GDK_PIXBUF_H
#include <libart_lgpl/art_misc.h>
#include <libart_lgpl/art_pixbuf.h>
#include <glib.h>
typedef struct _GdkPixBuf GdkPixBuf;
typedef void (*GdkPixBufUnrefFunc) (GdkPixBuf *pixbuf);
#ifdef __cplusplus
extern "C" {
#endif
struct _GdkPixBuf
{
typedef struct _GdkPixbuf GdkPixbuf;
typedef void (* GdkPixbufUnrefFunc) (GdkPixbuf *pixbuf);
struct _GdkPixbuf {
int ref_count;
ArtPixBuf *art_pixbuf;
GdkPixBufUnrefFunc *unref_fn;
GdkPixbufUnrefFunc *unref_fn;
};
GdkPixBuf *gdk_pixbuf_load_image (const char *file);
GdkPixbuf *gdk_pixbuf_load_image (const char *file);
void gdk_pixbuf_save_image (const char *format_id, const char *file, ...);
GdkPixBuf *gdk_pixbuf_new (ArtPixBuf *art_pixbuf,
GdkPixBufUnrefFunc *unref_fn);
void gdk_pixbuf_ref (GdkPixBuf *pixbuf);
void gdk_pixbuf_unref (GdkPixBuf *pixbuf);
GdkPixBuf *gdk_pixbuf_duplicate (const GdkPixBuf *pixbuf);
GdkPixBuf *gdk_pixbuf_scale (const GdkPixBuf *pixbuf, gint w, gint h);
GdkPixBuf *gdk_pixbuf_rotate (GdkPixBuf *pixbuf, gdouble angle);
void gdk_pixbuf_destroy (GdkPixBuf *pixbuf);
GdkPixbuf *gdk_pixbuf_new (ArtPixBuf *art_pixbuf, GdkPixbufUnrefFunc *unref_fn);
void gdk_pixbuf_ref (GdkPixbuf *pixbuf);
void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
GdkPixbuf *gdk_pixbuf_duplicate (const GdkPixbuf *pixbuf);
GdkPixbuf *gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h);
GdkPixbuf *gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle);
void gdk_pixbuf_destroy (GdkPixbuf *pixbuf);
GdkPixbuf *gdk_pixbuf_load_image_from_rgb_d (unsigned char *data, int rgb_width, int rgb_height);
GdkPixBuf *gdk_pixbuf_load_image_from_rgb_d (unsigned char *data,
int rgb_width, int rgb_height);
#ifdef __cplusplus
}
#endif
#endif /* _GDK_PIXBUF_H_ */
#endif
/*
* io-bmp.c: GdkPixBuf I/O for BMP files.
* io-bmp.c: GdkPixbuf I/O for BMP files.
*
* Copyright (C) 1999 Mark Crichton
* Author: Mark Crichton <crichton@gimp.org>
......@@ -30,12 +30,12 @@
/* Loosely based off the BMP loader from The GIMP, hence it's complexity */
/* Shared library entry point */
GdkPixBuf *image_load(FILE * f)
GdkPixbuf *image_load(FILE * f)
{
art_u8 *pixels;
ArtPixBuf *art_pixbuf;
/* Ok, now stuff the GdkPixBuf with goodies */
/* Ok, now stuff the GdkPixbuf with goodies */
if (is_trans)
art_pixbuf = art_pixbuf_new_rgba (pixels, w, h, (w * 4));
......
/*
* io-gif.c: GdkPixBuf I/O for GIF files.
* io-gif.c: GdkPixbuf I/O for GIF files.
* ...second verse, same as the first...
*
* Copyright (C) 1999 Mark Crichton
......@@ -29,7 +29,8 @@
#include <gif_lib.h>
/* Shared library entry point */
GdkPixBuf *image_load(FILE * f)
GdkPixbuf *
image_load(FILE *f)
{
gint fn, is_trans = FALSE;
gint done = 0;
......@@ -45,7 +46,7 @@ GdkPixBuf *image_load(FILE * f)
int intjump[] =
{8, 8, 4, 2};
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
ArtPixBuf *art_pixbuf;
g_return_val_if_fail(f != NULL, NULL);
......
/*
io-jpeg.c: GdkPixBuf loader for jpeg files.
io-jpeg.c: GdkPixbuf loader for jpeg files.
Based on io-jpeg from gdk_imlib, but not much.
......@@ -19,8 +19,7 @@
#include <jpeglib.h>
/* error handler data */
struct iojpeg_JPEG_error_mgr
{
struct iojpeg_JPEG_error_mgr {
struct jpeg_error_mgr pub;
sigjmp_buf setjmp_buffer;
};
......@@ -39,7 +38,8 @@ g_JPEGFatalErrorHandler(j_common_ptr cinfo)
return;
}
GdkPixBuf *image_load(FILE *f)
GdkPixbuf *
image_load(FILE *f)
{
int w,h,i,j;
art_u8 *pixels=NULL, *dptr;
......@@ -49,7 +49,7 @@ GdkPixBuf *image_load(FILE *f)
**lptr;
struct jpeg_decompress_struct cinfo;
struct iojpeg_JPEG_error_mgr jerr;
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
/* setup error handler */
cinfo.err = jpeg_std_error(&(jerr.pub));
......
/*
* io-png.c: GdkPixBuf I/O for PNG files.
* io-png.c: GdkPixbuf I/O for PNG files.
* Copyright (C) 1999 Mark Crichton
* Author: Mark Crichton <crichton@gimp.org>
*
......@@ -26,7 +26,8 @@
#include <png.h>
/* Shared library entry point */
GdkPixBuf *image_load(FILE * f)
GdkPixbuf *
image_load (FILE *f)
{
png_structp png_ptr;
png_infop info_ptr, end_info;
......@@ -34,7 +35,7 @@ GdkPixBuf *image_load(FILE * f)
png_uint_32 w, h, x, y;
png_bytepp rows;
art_u8 *pixels, *temp, *rowdata;
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
ArtPixBuf *art_pixbuf;
g_return_val_if_fail (f != NULL, NULL);
......@@ -162,7 +163,8 @@ GdkPixBuf *image_load(FILE * f)
return pixbuf;
}
int image_save(GdkPixBuf *pixbuf, FILE *file)
int
image_save (GdkPixbuf *pixbuf, FILE *file)
{
png_structp png_ptr;
png_infop info_ptr;
......
/*
* io-tiff.c: GdkPixBuf I/O for TIFF files.
* io-tiff.c: GdkPixbuf I/O for TIFF files.
* Copyright (C) 1999 Mark Crichton
* Author: Mark Crichton <crichton@gimp.org>
*
......@@ -30,9 +30,10 @@
#include "gdk-pixbuf.h"
/*#include "gdk-pixbuf-io.h" */
GdkPixBuf *image_load(FILE * f)
GdkPixbuf *
image_load (FILE *f)
{
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
TIFF *tiff;
art_u8 *pixels, *tmppix;
gint w, h, x, y, num_pixs, fd;
......
/*
* io-xpm.c: GdkPixBuf I/O for XPM files.
* io-xpm.c: GdkPixbuf I/O for XPM files.
* Copyright (C) 1999 Mark Crichton
* Author: Mark Crichton <crichton@gimp.org>
*
......@@ -61,9 +61,7 @@ struct mem_handle {
} mem_handle;
static gint
xpm_seek_string(FILE * infile,
const gchar * str,
gint skip_comments)
xpm_seek_string(FILE *infile, const gchar *str, gint skip_comments)
{
char instr[1024];
......@@ -83,8 +81,7 @@ static gint
}
static gint
xpm_seek_char(FILE * infile,
gchar c)
xpm_seek_char(FILE *infile, gchar c)
{
gint b, oldb;
......@@ -110,9 +107,7 @@ static gint
}
static gint
xpm_read_string(FILE * infile,
gchar ** buffer,
guint * buffer_size)
xpm_read_string(FILE *infile, gchar **buffer, guint *buffer_size)
{
gint c;
guint cnt = 0, bufsiz, ret = FALSE;
......@@ -124,9 +119,10 @@ static gint
bufsiz = 10 * sizeof(gchar);
buf = g_new(gchar, bufsiz);
}
do
do {
c = getc(infile);
while (c != EOF && c != '"');
} while (c != EOF && c != '"');
if (c != '"')
goto out;
......@@ -159,7 +155,7 @@ static gint
}
static gchar *
xpm_skip_whitespaces(gchar * buffer)
xpm_skip_whitespaces(gchar *buffer)
{
gint32 index = 0;
......@@ -170,7 +166,7 @@ static gchar *
}
static gchar *
xpm_skip_string(gchar * buffer)
xpm_skip_string(gchar *buffer)
{
gint32 index = 0;
......@@ -184,7 +180,7 @@ static gchar *
#define MAX_COLOR_LEN 120
static gchar *
xpm_extract_color(gchar * buffer)
xpm_extract_color(gchar *buffer)
{
gint counter, numnames;
gchar *ptr = NULL, ch, temp[128];
......@@ -247,11 +243,10 @@ static gchar *
return retcol;
}
/* (almost) direct copy from gdkpixmap.c... loads an XPM from a file */
static gchar *
file_buffer(enum buf_op op, gpointer handle)
file_buffer(enum buf_op op, gpointer handle)
{
struct file_handle *h = handle;
......@@ -278,7 +273,7 @@ static gchar *
/* This reads from memory */
static gchar *
mem_buffer(enum buf_op op, gpointer handle)
mem_buffer(enum buf_op op, gpointer handle)
{
struct mem_handle *h = handle;
switch (op) {
......@@ -293,9 +288,8 @@ static gchar *
/* This function does all the work. */
static GdkPixBuf *
_pixbuf_create_from_xpm(gchar * (*get_buf) (enum buf_op op, gpointer handle),
gpointer handle)
static GdkPixbuf *
_pixbuf_create_from_xpm(gchar * (*get_buf) (enum buf_op op, gpointer handle), gpointer handle)
{
gint w, h, n_col, cpp;
gint cnt, xcnt, ycnt, wbytes, n, ns;
......@@ -305,7 +299,7 @@ static GdkPixBuf *
GHashTable *color_hash;
_XPMColor *colors, *color, *fallbackcolor;
art_u8 *pixels, *pixtmp;
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
ArtPixBuf *art_pixbuf;
buffer = (*get_buf) (op_header, handle);
......@@ -402,7 +396,7 @@ static GdkPixBuf *
g_free(colors);
g_free(name_buf);
/* Ok, now stuff the GdkPixBuf with goodies */
/* Ok, now stuff the GdkPixbuf with goodies */
if (is_trans)
art_pixbuf = art_pixbuf_new_rgba(pixels, w, h, (w * 4));
......@@ -418,9 +412,10 @@ static GdkPixBuf *
}
/* Shared library entry point for file loading */
GdkPixBuf *image_load(FILE * f)
GdkPixbuf *
image_load (FILE *f)
{
GdkPixBuf *pixbuf;
GdkPixbuf *pixbuf;
struct file_handle h;
g_return_val_if_fail(f != NULL, NULL);
......
#ifndef _GDK_PIXBUF_H_