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
Canvas: use correct destination width and height
This commit is contained in:
@@ -38,12 +38,13 @@ JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawLine(JNIEnv *env
|
||||
cairo_stroke(cr);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawBitmap(JNIEnv *env , jclass this_class, jlong cairo_context, jlong widget, jlong _pixbuf, jfloat src_x, jfloat src_y , jfloat dest_x , jfloat dest_y, jobject paint)
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawBitmap(JNIEnv *env , jclass this_class, jlong cairo_context, jlong widget, jlong _pixbuf, jfloat src_x, jfloat src_y, jfloat dest_x , jfloat dest_y, jfloat dest_w , jfloat dest_h, jobject paint)
|
||||
{
|
||||
cairo_t *cr = (cairo_t *)_PTR(cairo_context);
|
||||
GdkPixbuf *pixbuf = (GdkPixbuf *)_PTR(_pixbuf);
|
||||
|
||||
cairo_translate(cr, dest_x, dest_y);
|
||||
cairo_scale(cr, dest_w / gdk_pixbuf_get_width(pixbuf), dest_h / gdk_pixbuf_get_height(pixbuf));
|
||||
gdk_cairo_set_source_pixbuf(cr, pixbuf, src_x, src_y);
|
||||
cairo_paint(cr);
|
||||
cairo_translate(cr, -dest_x, -dest_y);
|
||||
|
||||
@@ -34,10 +34,10 @@ JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawLine
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
* Method: native_drawBitmap
|
||||
* Signature: (JJJFFFFLandroid/graphics/Paint;)V
|
||||
* Signature: (JJJFFFFFFLandroid/graphics/Paint;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_graphics_Canvas_native_1drawBitmap
|
||||
(JNIEnv *, jclass, jlong, jlong, jlong, jfloat, jfloat, jfloat, jfloat, jobject);
|
||||
(JNIEnv *, jclass, jlong, jlong, jlong, jfloat, jfloat, jfloat, jfloat, jfloat, jfloat, jobject);
|
||||
|
||||
/*
|
||||
* Class: android_graphics_Canvas
|
||||
|
||||
@@ -252,7 +252,7 @@ public class Canvas {
|
||||
if (dst == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
native_drawBitmap(cairo_context, widget, bitmap.pixbuf, src.left, src.top, dst.left, dst.top, paint); // FIXME - ignores width/height
|
||||
native_drawBitmap(cairo_context, widget, bitmap.pixbuf, src.left, src.top, dst.left, dst.top, dst.width(), dst.height(), paint); // FIXME - ignores width/height of source
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -372,7 +372,7 @@ public class Canvas {
|
||||
public void setBitmap(Bitmap bitmap) {}
|
||||
|
||||
private static native void native_drawLine(long cairo_context, long widget, float startX, float startY, float stopX, float stopY, int paint_color); // TODO: pass all the other relevant parameters extracted from paint
|
||||
private static native void native_drawBitmap(long cairo_context, long widget, long pixbuf, float src_x, float src_y, float dest_x, float dest_y, Paint paint); // TODO: make use of "paint"?
|
||||
private static native void native_drawBitmap(long cairo_context, long widget, long pixbuf, float src_x, float src_y, float dest_x, float dest_y, float dest_w, float dest_h, Paint paint); // TODO: make use of "paint"?
|
||||
private static native void native_rotate(long cairo_context, long widget, float angle);
|
||||
private static native void native_rotate_and_translate(long cairo_context, long widget, float angle, float tx, float ty);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user