rename `NativeString` to `CString`
[nit.git] / lib / mnit / android / android_assets.nit
index 4634889..b82d387 100644 (file)
@@ -30,7 +30,7 @@ intrude import android::load_image
 
 extern class AndroidAsset in "C" `{struct AAsset*`}
 
-       fun read(count: Int): nullable String import String.as nullable, NativeString.to_s `{
+       fun read(count: Int): nullable String import String.as nullable, CString.to_s `{
                char *buffer = malloc(sizeof(char) * (count+1));
                int read = AAsset_read(self, buffer, count);
                if (read != count)
@@ -38,7 +38,7 @@ extern class AndroidAsset in "C" `{struct AAsset*`}
                else
                {
                        buffer[count] = '\0';
-                       return String_as_nullable(NativeString_to_s(buffer));
+                       return String_as_nullable(CString_to_s(buffer));
                }
        `}
 
@@ -67,8 +67,10 @@ redef class App
                        jni_env.push_local_frame 4
 
                        var bmp = asset_manager.bitmap(path)
-                       var buf = bmp.copy_pixels
-                       var png = new Opengles1Image.from_data(buf.native_array, bmp.width, bmp.height, bmp.width, bmp.height, bmp.has_alpha)
+                       var buf = bmp.copy_pixels(true, true)
+                       var w2 = bmp.width.next_pow(2)
+                       var h2 = bmp.height.next_pow(2)
+                       var png = new Opengles1Image.from_data(buf.native_array, bmp.width, bmp.height, w2, h2, true)
 
                        buf.destroy
                        jni_env.pop_local_frame