MCPcopy Create free account
hub / github.com/NetHack/NetHack / ghack_init_glyphs

Function ghack_init_glyphs

outdated/win/gnome/gnglyph.c:50–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 */
49
50int
51ghack_init_glyphs(const char *xpmFile)
52{
53 ghack_glyphs.im = gdk_imlib_load_image((char *) xpmFile);
54 if (!ghack_glyphs.im) {
55 g_error("Couldn't load required xpmFile!");
56 return -1;
57 }
58
59 gdk_imlib_render(ghack_glyphs.im, ghack_glyphs.im->rgb_width,
60 ghack_glyphs.im->rgb_height);
61
62 if ((ghack_glyphs.im->rgb_width % TILES_PER_ROW) != 0
63 || ghack_glyphs.im->rgb_width <= TILES_PER_ROW) {
64 g_error(
65 "%s is not a multiple of %d (number of tiles/row) pixels wide",
66 xpmFile, TILES_PER_ROW);
67 return -1;
68 }
69 ghack_glyphs.count = total_tiles_used;
70 if ((ghack_glyphs.count % TILES_PER_ROW) != 0) {
71 ghack_glyphs.count +=
72 TILES_PER_ROW - (ghack_glyphs.count % TILES_PER_ROW);
73 }
74 ghack_glyphs.width = ghack_glyphs.im->rgb_width / TILES_PER_ROW;
75 ghack_glyphs.height =
76 ghack_glyphs.im->rgb_height / (ghack_glyphs.count / TILES_PER_ROW);
77
78 /* Assume the tiles are organized in rows of TILES_PER_ROW */
79 ghack_tiles = g_new0(GdkImlibImage *, ghack_glyphs.count);
80 return (ghack_tiles == NULL) ? -1 : 0;
81}
82
83void
84ghack_free_glyphs()

Callers 2

gnome_init_nhwindowsFunction · 0.85
ghack_settings_dialogFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected