From e00a52589cb4054d61164300b62bd3e5164871b5 Mon Sep 17 00:00:00 2001 From: benfry Date: Wed, 2 Mar 2005 22:17:47 +0000 Subject: [PATCH] fix for backwards rects and ellipses --- core/PGraphics.java | 18 ++++++++++++++++++ core/todo.txt | 10 ++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/core/PGraphics.java b/core/PGraphics.java index c6ffef713..621844a56 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -824,6 +824,14 @@ public class PGraphics extends PImage implements PConstants { y1 -= vradius; } + if (x1 > x2) { + float temp = x1; x1 = x2; x2 = temp; + } + + if (y1 > y2) { + float temp = y1; y1 = y2; y2 = temp; + } + rectImpl(x1, y1, x2, y2); } @@ -865,6 +873,16 @@ public class PGraphics extends PImage implements PConstants { y = b - d/2f; } + if (w < 0) { // undo negative width + x += w; + w = -w; + } + + if (h < 0) { // undo negative height + y += h; + h = -h; + } + ellipseImpl(x, y, w, h); } diff --git a/core/todo.txt b/core/todo.txt index bae5d475b..572541e4a 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,11 +1,13 @@ 0078 core -X text lines were getting horizontally mashed together -X text lines also getting vertically smashed together -X make a note of the change to font.width() +X text fixes +X lines were getting horizontally mashed together +X lines also getting vertically smashed together +X make a note of the change to font.width() +X backwards rects and backwards ellipses weren't properly drawn +X code now compensates for negative widths or swapped x1/x2 _ get SCREEN_SPACE text working again -_ backwards rects may not be getting drawn in PGraphics2 _ updatePixels() not setting PApplet.pixels _ also throwing NPEs