Skip to content

Commit

Permalink
Make fillTriangle work again
Browse files Browse the repository at this point in the history
  • Loading branch information
zb3 committed Mar 25, 2024
1 parent e2babf5 commit 2077bbf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/javax/microedition/lcdui/Graphics.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public void fillRect(int x, int y, int width, int height) { }

public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { }

public void drawTriangle(int x1, int y1, int x2, int y2, int x3, int y3) { }

public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3) { }

public int getColor() { return color; }
Expand Down
12 changes: 12 additions & 0 deletions src/org/recompile/mobile/PlatformGraphics.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,16 @@ public void getPixels(int[] pixels, int offset, int scanlength, int x, int y, in
//System.out.println("getPixels B");
canvas.getRGB(x, y, width, height, pixels, offset, scanlength);
}

// these methods are not Direct Graphics specific

@Override
public void drawTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
drawPolygon(new int[]{x1, x2, x3}, 0, new int[]{y1, y2, y3}, 0, 3);
}

@Override
public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
fillPolygon(new int[]{x1, x2, x3}, 0, new int[]{y1, y2, y3}, 0, 3);
}
}

0 comments on commit 2077bbf

Please sign in to comment.