Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified sources/net.sf.j2s.java.core/SwingJS-site.zip
Binary file not shown.
12 changes: 12 additions & 0 deletions sources/net.sf.j2s.java.core/src/swingjs/JSGraphics2D.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ private void doCirc(int left, int top, int diameter, boolean fill) {

private void doArc(double x, double y, double width, double height, double startAngle,
double arcAngle, boolean fill) {
if (width < 0 || height < 0)
return;
// boolean doClose = (arcAngle - startAngle == 360);
ctx.save();
{
Expand Down Expand Up @@ -230,6 +232,8 @@ private void doPoly(int[] axPoints, int[] ayPoints, int nPoints,


public void drawRect(int x, int y, int width, int height) {
if (width <= 0 || height <= 0)
return;
ctx.beginPath();
ctx.rect(x, y, width, height);
ctx.stroke();
Expand All @@ -245,11 +249,15 @@ public void fillPolygon(int[] axPoints, int[] ayPoints, int nPoints) {


public void fillRect(int x, int y, int width, int height) {
if (width <= 0 || height <= 0)
return;
backgroundPainted = true;
ctx.fillRect(x, y, width, height);
}

public void fill3DRect(int x, int y, int width, int height, boolean raised) {
if (width <= 0 || height <= 0)
return;
Paint p = getPaint();
Color c = getColor();
Color brighter = c.brighter();
Expand Down Expand Up @@ -374,6 +382,8 @@ public boolean drawImage(Image img, int x, int y, ImageObserver observer) {

public boolean drawImage(Image img, int x, int y, int width, int height,
ImageObserver observer) {
if (width <= 0 || height <= 0)
return true;
backgroundPainted = true;
if (img != null) {
DOMNode imgNode = getImageNode(img);
Expand Down Expand Up @@ -406,6 +416,8 @@ public boolean drawImage(Image img, int x, int y, Color bgcolor,

public boolean drawImage(Image img, int x, int y, int width, int height,
Color bgcolor, ImageObserver observer) {
if (width <= 0 || height <= 0)
return false;
backgroundPainted = true;
JSUtil.notImplemented(null);
return drawImage(img, x, y, width, height, observer);
Expand Down