[cairo-commit] cairo-demo/cairo_snippets ChangeLog, 1.18,
1.19 Makefile, 1.9, 1.10 cairo_snippets_html.c, 1.6,
1.7 cairo_snippets_png.c, 1.4, 1.5 imagepattern.cairo, NONE,
1.1 prepare_snippets.c, 1.4, 1.5
Carl Worth
commit at pdx.freedesktop.org
Wed Oct 13 11:24:13 PDT 2004
- Previous message: [cairo-commit] libpixman ChangeLog,1.23,1.24
- Next message: [cairo-commit] cairo-ocaml/src ml_cairo_wrappers.h, 1.4,
1.5 ml_cairo_wrappers.c, NONE, 1.1 ml_cairo_status.h, 1.1.1.1,
1.2 ml_cairo_status.c, 1.1.1.1, 1.2 ml_cairo.h, 1.3,
1.4 ml_cairo.c, 1.11, 1.12 cairo.mli, 1.9, 1.10 cairo.ml, 1.8,
1.9 Makefile, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: cworth
Update of /cvs/cairo/cairo-demo/cairo_snippets
In directory gabe:/tmp/cvs-serv3301
Modified Files:
ChangeLog Makefile cairo_snippets_html.c cairo_snippets_png.c
prepare_snippets.c
Added Files:
imagepattern.cairo
Log Message:
* cairo_snippets_html.c (do_index): index() is a C library
function, rename to do_index().
* Makefile: Add -g -Wall -O2, to get good warnings.
* cairo_snippets_html.c prepare_snippets.c: Fix warnings.
* cairo_snippets_png.c: Allow individual snippet names
to be specified on the command line.
Index: ChangeLog
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/ChangeLog,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- ChangeLog 3 Aug 2004 18:44:59 -0000 1.18
+++ ChangeLog 13 Oct 2004 18:24:11 -0000 1.19
@@ -1,3 +1,15 @@
+2004-09-6 Owen Taylor <otaylor at redhat.com>
+
+ * cairo_snippets_html.c (do_index): index() is a C library
+ function, rename to do_index().
+
+ * Makefile: Add -g -Wall -O2, to get good warnings.
+
+ * cairo_snippets_html.c prepare_snippets.c: Fix warnings.
+
+ * cairo_snippets_png.c: Allow individual snippet names
+ to be specified on the command line.
+
2004-08-03 Carl Worth <cworth at isi.edu>
* xxx_clip_rectangle.cairo: Added test to deomnstrate current bug
Index: Makefile
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/Makefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Makefile 21 May 2004 16:09:41 -0000 1.9
+++ Makefile 13 Oct 2004 18:24:11 -0000 1.10
@@ -10,6 +10,8 @@
CFLAGS += `pkg-config --cflags gtkcairo`
LIBS += `pkg-config --libs gtkcairo`
+CFLAGS += -g -Wall -O2
+
OBJS = png_io.o snippets.o
all: $(COMPILE_PROGS)
Index: cairo_snippets_html.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_html.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cairo_snippets_html.c 21 May 2004 22:37:56 -0000 1.6
+++ cairo_snippets_html.c 13 Oct 2004 18:24:11 -0000 1.7
@@ -29,7 +29,7 @@
}
static void
-index(FILE *file, int active)
+do_index(FILE *file, int active)
{
int i;
fprintf (file, "<div id='snippet_list'>\n");
@@ -53,11 +53,10 @@
void
write_index(void)
{
- int i=0;
FILE *file= fopen ("index.html", "w");
embed_file (file, "header.html_template");
- index (file, -2);
+ do_index (file, -2);
embed_file (file, "index.html_template");
embed_file (file, "footer.html_template");
fclose (file);
@@ -75,8 +74,6 @@
fprintf (file, "<div id='snippets'>");
for (i=0;i<snippet_count;i++) {
const char *name=snippet_name[i];
- FILE *srcfile;
- int size;
const char *c=&snippet_source[i][0];
fprintf (file, "<div id='snippet'>\n");
@@ -121,7 +118,7 @@
file = fopen (htmlfile, "w");
embed_file (file, "header.html_template");
- index (file, snippet_no);
+ do_index (file, snippet_no);
if (snippet_no>0) {
fprintf (file, "<div id='snippet_prev'><a href='%s.html'>prev</a></div>\n",
snippet_name [snippet_no-1]);
@@ -132,8 +129,6 @@
}
{
- FILE *srcfile;
- int size;
const char *c=&snippet_source[snippet_no][0];
fprintf (file, "<div id='snippet'>\n");
@@ -181,7 +176,7 @@
exit (-1);
}
- while (read=fread (&c, 1,1, input_file)){
+ while ((read=fread (&c, 1,1, input_file))){
switch (c){
default:
fprintf (file, "%c", c);
Index: cairo_snippets_png.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/cairo_snippets_png.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo_snippets_png.c 18 May 2004 21:54:57 -0000 1.4
+++ cairo_snippets_png.c 13 Oct 2004 18:24:11 -0000 1.5
@@ -14,12 +14,20 @@
snippet_do_png (int no);
int
-main (void)
+main (int argc, char **argv)
{
int i;
- for (i=0;i<snippet_count;i++)
- snippet_do_png (i);
+ if (argc > 1) {
+ for (i = 1; i < argc; i++) {
+ int snippet = snippet_name2no (argv[i]);
+ if (snippet >= 0)
+ snippet_do_png (snippet);
+ }
+ } else {
+ for (i=0;i<snippet_count;i++)
+ snippet_do_png (i);
+ }
return 0;
}
--- NEW FILE: imagepattern.cairo ---
int w,h,stride;
char *buffer;
cairo_surface_t *image;
cairo_pattern_t *pattern;
cairo_matrix_t *matrix;
buffer = read_png_argb32 (
"data/romedalen.png", &w,&h, &stride);
image = cairo_surface_create_for_image (
buffer, CAIRO_FORMAT_ARGB32, w,h, stride);
cairo_surface_set_repeat (image, 1);
pattern = cairo_pattern_create_for_surface (image);
cairo_translate (cr, 0.5, 0.5);
cairo_rotate (cr, M_PI / 4);
cairo_scale (cr, 1 / sqrt (2), 1 / sqrt (2));
cairo_translate (cr, - 0.5, - 0.5);
matrix = cairo_matrix_create ();
cairo_matrix_scale (matrix, w * 5., h * 5.);
cairo_pattern_set_matrix (pattern, matrix);
cairo_matrix_destroy (matrix);
cairo_set_pattern (cr, pattern);
cairo_rectangle (cr, 0, 0, 1.0, 1.0);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
cairo_surface_destroy (image);
free (buffer);
Index: prepare_snippets.c
===================================================================
RCS file: /cvs/cairo/cairo-demo/cairo_snippets/prepare_snippets.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- prepare_snippets.c 7 Jun 2004 01:02:35 -0000 1.4
+++ prepare_snippets.c 13 Oct 2004 18:24:11 -0000 1.5
@@ -3,6 +3,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#define MAX_SNIPPETS 512
@@ -32,7 +33,7 @@
fprintf (out, "\"%s\",\n", snippet_name[i]);
}
fprintf (out, "NULL\n");
- fprintf (out, "};\n", snippet_count);
+ fprintf (out, "};\n");
}
static void
@@ -58,7 +59,7 @@
sprintf (filename, "%s.cairo", snippet_name[i]);
file = fopen (filename, "r");
- while (read=fread (&c, 1,1, file)){
+ while ((read=fread (&c, 1,1, file))){
fprintf (out, "%c", c);
}
@@ -92,7 +93,7 @@
sprintf (filename, "%s.cairo", snippet_name[i]);
file = fopen (filename, "r");
- while (read=fread (&c, 1,1, file)){
+ while ((read=fread (&c, 1,1, file))){
switch (c){
case '\"':
fprintf (out, "\\\"");
@@ -112,7 +113,7 @@
fclose (file);
}
fprintf (out, "NULL\n");
- fprintf (out, "};\n", snippet_count);
+ fprintf (out, "};\n");
}
static void
@@ -202,4 +203,6 @@
make_util ();
fclose (out);
+
+ return 0;
}
- Previous message: [cairo-commit] libpixman ChangeLog,1.23,1.24
- Next message: [cairo-commit] cairo-ocaml/src ml_cairo_wrappers.h, 1.4,
1.5 ml_cairo_wrappers.c, NONE, 1.1 ml_cairo_status.h, 1.1.1.1,
1.2 ml_cairo_status.c, 1.1.1.1, 1.2 ml_cairo.h, 1.3,
1.4 ml_cairo.c, 1.11, 1.12 cairo.mli, 1.9, 1.10 cairo.ml, 1.8,
1.9 Makefile, 1.5, 1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list