src/api-impl: use skia instead of cairo

Using the C API provided by SkiaSharp's skia fork instead of using cairo
significantly improves performance. The API is also closer to the android
Canvas API, which makes the implementation more straightforward.
This commit is contained in:
Mis012
2023-08-28 20:03:32 +02:00
parent 096919ec37
commit 1e47824a79
47 changed files with 3184 additions and 159 deletions

View File

@@ -1,9 +1,14 @@
package android.graphics;
public class Paint {
private int color = 0xFF000000;
public long skia_paint = 0; // should probably be private, but then we'd need to get it from C
private native long native_constructor();
private native void native_set_color(long skia_paint, int color);
private native int native_get_color(long skia_paint);
public Paint() {
skia_paint = native_constructor();
}
public Paint (int flags) {
@@ -12,15 +17,17 @@ public class Paint {
}
public Paint(Paint paint) {
/* TODO: use sk_paint_clone */
this();
setColor(paint.getColor());
}
public void setColor(int color) {
this.color = color;
native_set_color(skia_paint, color);
}
public int getColor() {
return color;
return native_get_color(skia_paint);
}
public void setAntiAlias(boolean aa) {}