mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Graphics: Fix issue where drawLine for 2px horizontal lines only drew a 1px dot
This commit is contained in:
parent
6b565f82a6
commit
f6493d5d41
@ -56,6 +56,7 @@
|
||||
RegExp: add optimisation for RegExp that is simply checking if a string ends with something
|
||||
Bangle.js: .setUI now only clears back widget if it hasn't been hidden by widget_utils
|
||||
Fix UtilTimer timings when new task added infront of existing tasks (fix #2575)
|
||||
Graphics: Fix issue where drawLine for 2px horizontal lines only drew a 1px dot
|
||||
|
||||
2v24 : Bangle.js2: Add 'Bangle.touchRd()', 'Bangle.touchWr()'
|
||||
Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off)
|
||||
|
||||
@ -645,14 +645,14 @@ void graphicsDrawLine(JsGraphics *gfx, int x1, int y1, int x2, int y2) {
|
||||
|
||||
int xl = x2-x1;
|
||||
int yl = y2-y1;
|
||||
if (xl<0) xl=-xl; else if (xl==0) xl=1;
|
||||
if (yl<0) yl=-yl; else if (yl==0) yl=1;
|
||||
if (xl<0) xl=-xl;
|
||||
if (yl<0) yl=-yl;
|
||||
if (xl > yl) { // longer in X - scan in X
|
||||
if (x1>x2) {
|
||||
int t;
|
||||
t = x1; x1 = x2; x2 = t;
|
||||
t = y1; y1 = y2; y2 = t;
|
||||
}
|
||||
} else if (xl==0) xl=1;
|
||||
int pos = (y1<<8) + 128; // rounding!
|
||||
int step = ((y2-y1)<<8) / xl;
|
||||
int x;
|
||||
@ -665,7 +665,7 @@ void graphicsDrawLine(JsGraphics *gfx, int x1, int y1, int x2, int y2) {
|
||||
int t;
|
||||
t = x1; x1 = x2; x2 = t;
|
||||
t = y1; y1 = y2; y2 = t;
|
||||
}
|
||||
} else if (yl==0) yl=1;
|
||||
int pos = (x1<<8) + 128; // rounding!
|
||||
int step = ((x2-x1)<<8) / yl;
|
||||
int y;
|
||||
|
||||
@ -27,11 +27,17 @@ g.setColor(9).setBgColor(0);
|
||||
g.drawLine(1,1,14,8);
|
||||
g.drawLineAA(1,1+4,14,8+4);
|
||||
|
||||
g.setColor(1);
|
||||
g.drawLine(10,0,10,0);
|
||||
g.drawLine(10,1,11,1);
|
||||
g.drawLine(10,2,12,2);
|
||||
g.drawLine(10,3,13,3);
|
||||
|
||||
SHOULD_BE(`
|
||||
|
||||
@
|
||||
@@
|
||||
@@
|
||||
.
|
||||
@ ..
|
||||
@@ ...
|
||||
@@ ....
|
||||
@@
|
||||
@= @@
|
||||
+%= @@
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user