2
0
Эх сурвалжийг харах

expose consider_rescale()

David Rose 16 жил өмнө
parent
commit
c9114fb40d

+ 36 - 20
panda/src/gobj/texture.cxx

@@ -1643,6 +1643,42 @@ down_to_power_2(int value) {
   return (1 << bit);
   return (1 << bit);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: Texture::consider_rescale
+//       Access: Published
+//  Description: Asks the PNMImage to change its scale when it reads
+//               the image, according to the whims of the Config.prc
+//               file.
+//
+//               This method should be called after
+//               pnmimage.read_header() has been called, but before
+//               pnmimage.read().
+////////////////////////////////////////////////////////////////////
+void Texture::
+consider_rescale(PNMImage &pnmimage) {
+  consider_rescale(pnmimage, get_name());
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: Texture::consider_rescale
+//       Access: Published, Static
+//  Description: Asks the PNMImage to change its scale when it reads
+//               the image, according to the whims of the Config.prc
+//               file.
+//
+//               This method should be called after
+//               pnmimage.read_header() has been called, but before
+//               pnmimage.read().
+////////////////////////////////////////////////////////////////////
+void Texture::
+consider_rescale(PNMImage &pnmimage, const string &name) {
+  int new_x_size = pnmimage.get_x_size();
+  int new_y_size = pnmimage.get_y_size();
+  if (adjust_size(new_x_size, new_y_size, name)) {
+    pnmimage.set_read_size(new_x_size, new_y_size);
+  }
+}
+
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Texture::texture_uploaded
 //     Function: Texture::texture_uploaded
@@ -5294,26 +5330,6 @@ clear_prepared(PreparedGraphicsObjects *prepared_objects) {
   }
   }
 }
 }
 
 
-////////////////////////////////////////////////////////////////////
-//     Function: Texture::consider_rescale
-//       Access: Private, Static
-//  Description: Asks the PNMImage to change its scale when it reads
-//               the image, according to the whims of the Config.prc
-//               file.
-//
-//               This method should be called after
-//               pnmimage.read_header() has been called, but before
-//               pnmimage.read().
-////////////////////////////////////////////////////////////////////
-void Texture::
-consider_rescale(PNMImage &pnmimage, const string &name) {
-  int new_x_size = pnmimage.get_x_size();
-  int new_y_size = pnmimage.get_y_size();
-  if (adjust_size(new_x_size, new_y_size, name)) {
-    pnmimage.set_read_size(new_x_size, new_y_size);
-  }
-}
-
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: Texture::consider_downgrade
 //     Function: Texture::consider_downgrade
 //       Access: Private, Static
 //       Access: Private, Static

+ 3 - 1
panda/src/gobj/texture.h

@@ -438,6 +438,9 @@ PUBLISHED:
   static int up_to_power_2(int value);
   static int up_to_power_2(int value);
   static int down_to_power_2(int value);
   static int down_to_power_2(int value);
 
 
+  void consider_rescale(PNMImage &pnmimage);
+  static void consider_rescale(PNMImage &pnmimage, const string &name);
+
 public:
 public:
   void texture_uploaded();
   void texture_uploaded();
   
   
@@ -600,7 +603,6 @@ private:
 
 
   void clear_prepared(PreparedGraphicsObjects *prepared_objects);
   void clear_prepared(PreparedGraphicsObjects *prepared_objects);
 
 
-  static void consider_rescale(PNMImage &pnmimage, const string &name);
   static void consider_downgrade(PNMImage &pnmimage, int num_channels, const string &name);
   static void consider_downgrade(PNMImage &pnmimage, int num_channels, const string &name);
 
 
   static bool compare_images(const PNMImage &a, const PNMImage &b);
   static bool compare_images(const PNMImage &a, const PNMImage &b);