Update for new waveflag semantics.
Previously our copy of waveflag took just an input and output filename. Upstream takes a prefix and one or more input filenames, and concatenates the prefix to the input filename as the output. The makefile is changed to pass a prefix and the input filename, instead of the input filename and the output filename as it formerly did. Unfortunately for us, our inputs have a directory prefix since they're not in the current directory, and we don't want this prefix in the output file path. So we tweak our copy of waveflag.c to call basename on the input file path before we append it to the prefix. We also make the tool a little less noisy by putting more printfs under the debug flag.pull/73/head
parent
741f8b92c9
commit
41fa8181f5
2
Makefile
2
Makefile
|
@ -152,7 +152,7 @@ $(EMOJI_DIR)/%.png: $(EMOJI_SRC_DIR)/%.png | $(EMOJI_DIR)
|
|||
@convert -extent 136x128 -gravity center -background none "$<" "$@"
|
||||
|
||||
$(FLAGS_DIR)/%.png: $(FLAGS_SRC_DIR)/%.png ./waveflag $(PNGQUANT) | $(FLAGS_DIR)
|
||||
@./waveflag "$<" "$@"
|
||||
@./waveflag $(FLAGS_DIR)/ "$<"
|
||||
|
||||
$(RESIZED_FLAGS_DIR)/%.png: $(FLAGS_DIR)/%.png | $(RESIZED_FLAGS_DIR)
|
||||
@convert -extent 136x128 -gravity center -background none "$<" "$@"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
#include <cairo.h>
|
||||
#include <libgen.h> // basename
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
@ -269,7 +270,7 @@ wave_flag (const char *filename, const char *out_prefix)
|
|||
cairo_surface_t *scaled_flag, *waved_flag;
|
||||
cairo_t *cr;
|
||||
|
||||
printf ("Processing %s\n", filename);
|
||||
if (debug) printf ("Processing %s\n", filename);
|
||||
|
||||
scaled_flag = load_scaled_flag (filename, &aspect);
|
||||
|
||||
|
@ -277,7 +278,7 @@ wave_flag (const char *filename, const char *out_prefix)
|
|||
aspect = sqrt (aspect); // Discount the effect
|
||||
if (.9 <= aspect && aspect <= 1.1)
|
||||
{
|
||||
printf ("Standard aspect ratio\n");
|
||||
if (debug) printf ("Standard aspect ratio\n");
|
||||
aspect = 1.;
|
||||
}
|
||||
|
||||
|
@ -335,7 +336,7 @@ wave_flag (const char *filename, const char *out_prefix)
|
|||
}
|
||||
else
|
||||
{
|
||||
printf ("Transparent border\n");
|
||||
if (debug) printf ("Transparent border\n");
|
||||
cairo_new_path (cr);
|
||||
}
|
||||
|
||||
|
@ -410,7 +411,7 @@ wave_flag (const char *filename, const char *out_prefix)
|
|||
|
||||
*out = '\0';
|
||||
strcat (out, out_prefix);
|
||||
strcat (out, filename);
|
||||
strcat (out, basename(filename));
|
||||
|
||||
cairo_surface_write_to_png (cairo_get_target (cr), out);
|
||||
cairo_destroy (cr);
|
||||
|
|
Loading…
Reference in New Issue