summarylogtreecommitdiffstats
path: root/non_square_mipmaps.patch
blob: c239a34037647d093787b37a64af845c73bc0c59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Description: Fix size chain for non-square mipmaps
Author: Tony Houghton <h@realh.co.uk>
Forwarded: No
Last-Update: 2016-11-20
Index: gimp-dds-3.0.1/mipmap.c
===================================================================
--- gimp-dds-3.0.1.orig/mipmap.c
+++ gimp-dds-3.0.1/mipmap.c
@@ -143,11 +143,11 @@ unsigned int get_volume_mipmapped_size(i
 int get_next_mipmap_dimensions(int *next_w, int *next_h,
                                int  curr_w, int  curr_h)
 {
-   if(curr_w == 1 || curr_h == 1)
+   if(curr_w == 1 && curr_h == 1)
       return(0);
 
-   if(next_w) *next_w = curr_w >> 1;
-   if(next_h) *next_h = curr_h >> 1;
+   if(next_w) *next_w = curr_w == 1 ? 1 : curr_w >> 1;
+   if(next_h) *next_h = curr_h == 1 ? 1 : curr_h >> 1;
 
    return(1);
 }