You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
Bitmap: regenerate GdkTexture when Canvas was used on the Bitmap
This commit is contained in:
@@ -1607,13 +1607,24 @@ public final class Bitmap {
|
||||
return texture;
|
||||
}
|
||||
|
||||
/**
|
||||
* internal ATL method to destroy the cached GdkTexture when the Bitmap was touched
|
||||
*/
|
||||
public void destroyTexture() {
|
||||
if (texture != 0) {
|
||||
native_unref_texture(texture);
|
||||
texture = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//////////// native methods
|
||||
|
||||
private native long native_bitmap_from_path(CharSequence path);
|
||||
static native long native_copy(long src);
|
||||
static native long native_subpixbuf(long src, int x, int y, int width, int height);
|
||||
private static native long native_create(int width, int height);
|
||||
public static native long native_paintable_from_pixbuf(long pixbuf);
|
||||
private static native long native_paintable_from_pixbuf(long pixbuf);
|
||||
private static native void native_unref_texture(long texture);
|
||||
|
||||
private static native Bitmap nativeCopy(int srcBitmap, int nativeConfig,
|
||||
boolean isMutable);
|
||||
|
||||
@@ -9,6 +9,7 @@ public class Canvas {
|
||||
public Canvas() {}
|
||||
|
||||
public Canvas(Bitmap bmp) {
|
||||
bmp.destroyTexture(); // invalidate cached texture
|
||||
this.skia_canvas = native_canvas_from_bitmap(bmp.pixbuf);
|
||||
this.widget = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user