Canvas: fix some issues spotted by the CTS

This commit is contained in:
Julian Winkler
2025-02-11 19:40:09 +01:00
parent fb2cba8572
commit 829df70a9f
4 changed files with 20 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ package android.graphics;
*/
public class GskCanvas extends Canvas {
public long snapshot;
private int save_count = 0;
private int save_count = 1;
private static Paint default_paint = new Paint();
@@ -28,6 +28,9 @@ public class GskCanvas extends Canvas {
@Override
public void restoreToCount(int count) {
if (count < 1) {
throw new IllegalArgumentException("count must be >= 1");
}
while (save_count > count) {
restore();
}