GskCanvas.drawBitmap(): reuse GdkTexture objects

This commit is contained in:
Julian Winkler
2024-05-25 23:57:31 +02:00
committed by Mis012
parent 6f02565920
commit e8eabb2027
11 changed files with 44 additions and 49 deletions

View File

@@ -25,7 +25,7 @@ public class BitmapDrawable extends Drawable {
public BitmapDrawable(Resources res, Bitmap bitmap) {
this.bitmap = bitmap;
this.paintable = native_paintable_from_pixbuf(bitmap.pixbuf);
this.paintable = bitmap.getTexture();
}
public Bitmap getBitmap() {
@@ -40,6 +40,4 @@ public class BitmapDrawable extends Drawable {
}
a.recycle();
}
static native long native_paintable_from_pixbuf(long pixbuf);
}

View File

@@ -50,7 +50,7 @@ public class VectorDrawable extends Drawable {
String svg = sb.toString();
byte[] bytes = svg.getBytes();
Bitmap bm = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
this.paintable = BitmapDrawable.native_paintable_from_pixbuf(bm.pixbuf);
this.paintable = bm.getTexture();
}
}