restore support for non-square XPM-based tiles (X11 & Gnome)

- change the way the tile sizes are calculated, based on the image size,
so non-square tiles can once again be supported.
- fix Gnome port so it can actually display non-square tiles, several
height/width uses were backwards
- update Install.X11 to note the number of tiles per row in the XPM image
This commit is contained in:
cohrs
2002-03-24 00:04:41 +00:00
parent 658ee6436a
commit 88f0680567
5 changed files with 49 additions and 48 deletions
+8 -11
View File
@@ -306,7 +306,8 @@ init_tiles(wp)
}
/* assume a fixed number of tiles per row */
if (tile_image->width % TILES_PER_ROW != 0) {
if (tile_image->width % TILES_PER_ROW != 0 ||
tile_image->width <= TILES_PER_ROW) {
Sprintf(buf,
"%s is not a multiple of %d (number of tiles/row) pixels wide",
appResources.tile_file, TILES_PER_ROW);
@@ -317,20 +318,16 @@ init_tiles(wp)
goto tiledone;
}
/* infer tile dimensions from image size, assume square tiles */
/* infer tile dimensions from image size and TILES_PER_ROW */
image_width = tile_image->width;
image_height = tile_image->height;
tile_width = image_width / TILES_PER_ROW;
tile_height = tile_width;
tile_count = (image_width * image_height) / (tile_width * tile_height);
if (tile_count < total_tiles_used) {
Sprintf(buf, "%s incomplete, expecting %d tiles, found %d",
appResources.tile_file, total_tiles_used, tile_count);
X11_raw_print(buf);
result = FALSE;
goto tiledone;
tile_count = total_tiles_used;
if ((tile_count % TILES_PER_ROW) != 0) {
tile_count += TILES_PER_ROW - (tile_count % TILES_PER_ROW);
}
tile_width = image_width / TILES_PER_ROW;
tile_height = image_height / (tile_count / TILES_PER_ROW);
#else
/* any less than 16 colours makes tiles useless */
ddepth = DefaultDepthOfScreen(screen);