Explorar o código

*** empty log message ***

David Rose %!s(int64=25) %!d(string=hai) anos
pai
achega
4f9ef24895
Modificáronse 1 ficheiros con 14 adicións e 15 borrados
  1. 14 15
      pandatool/src/egg-palettize/textureImage.cxx

+ 14 - 15
pandatool/src/egg-palettize/textureImage.cxx

@@ -267,25 +267,24 @@ post_txa_file() {
     _x_size = _request._x_size;
     _x_size = _request._x_size;
     _y_size = _request._y_size;
     _y_size = _request._y_size;
   }
   }
+
+  // Examine the image to determine if we can downgrade the number
+  // of channels, for instance from color to grayscale.
+  if (_properties._got_num_channels &&
+      (_properties._num_channels == 3 || _properties._num_channels == 4)) {
+    consider_grayscale();
+  }
     
     
+  // Also consider downgrading from alpha to non-alpha.
+  if (_properties._got_num_channels &&
+      (_properties._num_channels == 2 || _properties._num_channels == 4)) {
+    consider_unalpha();
+  }
+
+  // However, if we got an explicit request for channels, honor that.
   if (_request._got_num_channels) {
   if (_request._got_num_channels) {
     _properties._got_num_channels = true;
     _properties._got_num_channels = true;
     _properties._num_channels = _request._num_channels;
     _properties._num_channels = _request._num_channels;
-
-  } else {
-    // If we didn't request a particular number of channels, examine
-    // the image to determine if we can downgrade it, for instance
-    // from color to grayscale.  
-    if (_properties._got_num_channels &&
-	(_properties._num_channels == 3 || _properties._num_channels == 4)) {
-      consider_grayscale();
-    }
-    
-    // Also consider downgrading from alpha to non-alpha.
-    if (_properties._got_num_channels &&
-	(_properties._num_channels == 2 || _properties._num_channels == 4)) {
-      consider_unalpha();
-    }
   }
   }
 
 
   if (_request._format != EggTexture::F_unspecified) {
   if (_request._format != EggTexture::F_unspecified) {