Canvas: implement another overload of drawRoundRect()

This commit is contained in:
Julian Winkler
2025-06-02 20:14:09 +02:00
parent b0177f6ccb
commit 5383360c38

View File

@@ -416,13 +416,20 @@ public class Canvas {
gsk_canvas.restoreToCount(count); gsk_canvas.restoreToCount(count);
} }
public void drawRoundRect(RectF rect, float rx, float ry, Paint paint) { public void drawRoundRect(float left, float top, float right, float bottom, float rx, float ry, Paint paint) {
if (paint.getShader() instanceof BitmapShader) { if (paint.getShader() instanceof BitmapShader) {
BitmapShader shader = (BitmapShader)paint.getShader(); BitmapShader shader = (BitmapShader)paint.getShader();
drawBitmap(shader.bitmap, 0, 0, paint); drawBitmap(shader.bitmap, 0, 0, paint);
} else {
gsk_canvas.snapshot = bitmap.getSnapshot();
gsk_canvas.drawRoundRect(left, top, right, bottom, rx, ry, paint);
} }
} }
public void drawRoundRect(RectF rect, float rx, float ry, Paint paint) {
drawRoundRect(rect.left, rect.top, rect.right, rect.bottom, rx, ry, paint);
}
public void getMatrix(Matrix matrix) { public void getMatrix(Matrix matrix) {
matrix.reset(); matrix.reset();
} }
@@ -518,10 +525,6 @@ public class Canvas {
Log.w("Canvas", "STUB: drawArc"); Log.w("Canvas", "STUB: drawArc");
} }
public void drawRoundRect(float left, float top, float right, float bottom, float rx, float ry, Paint paint) {
Log.w("Canvas", "STUB: drawRoundRect");
}
public boolean getClipBounds(Rect outRect) { public boolean getClipBounds(Rect outRect) {
/* UGLY HACK */ /* UGLY HACK */
outRect.set(0, 0, Resources.getSystem().getDisplayMetrics().widthPixels, Resources.getSystem().getDisplayMetrics().heightPixels); outRect.set(0, 0, Resources.getSystem().getDisplayMetrics().widthPixels, Resources.getSystem().getDisplayMetrics().heightPixels);