Wrong uncompressed formats... oops
[convexer.git] / nbvtf / nbvtf.h
index c0071c98546df187baedba91bd1fecdcbde98292..111ba9e2f301a07d6c0874bedeeae5b2cff8c27f 100644 (file)
@@ -33,7 +33,7 @@
 //   w, h - MAXIMUM image dimentions of final product. Set as 0 to be automatic
 //
 // version history:
-//   v1.03  - Added quality switch
+//   v1.03  - Added quality switch, moved init (major api revision)
 //   v1.02  - Improved box filtering, small bug fixes
 //   v1.01  - switch to OpenGL normal format for input
 //   v1.00  - (hgn) first release
@@ -450,17 +450,19 @@ uint32_t nbvtf_sizeimg( int w, int h, EImageFormat_t format )
        return 0;
 }
 
-void nbvtf_dxt_block( uint8_t *dest, uint8_t *src, int alpha, int qual )
+#ifdef NBVTF_AS_SO
+__attribute__((visibility("default")))
+#endif
+void nbvtf_init(void)
 {
 #ifdef USE_LIBRGBCX
-       // TODO: move this somewehre else
-       static int init = 0;
-       if( !init )
-       {
-               rgbcx__init();
-               init = 1;
-       }
+   rgbcx__init();
+#endif
+}
 
+void nbvtf_dxt_block( uint8_t *dest, uint8_t *src, int alpha, int qual )
+{
+#ifdef USE_LIBRGBCX
        if( alpha )
        {
                rgbcx__encode_bc3( qual, dest, src );
@@ -766,12 +768,15 @@ int nbvtf_convert( const char *src, int w, int h, int mipmap,
                        return 0;
                }
                
-               // Image size needs retargeting
+               // Image size needs to be made smaller
                if( (w && h) && ( x > w || y > h ) )
+      {
          nbvtf_downscale( data, x, y, w, h, data );
+         x = w;
+         y = h;
+      }
                
-               int status = nbvtf_write( data, w, h, mipmap, format, qual, 
-            usr_flags, dest );
+               int status = nbvtf_write( data, x,y, mipmap, format, qual, usr_flags, dest );
 
                stbi_image_free( data );