Skip to content

Commit 9940d25

Browse files
committed
Arc expansion getPixelColor fix.
1 parent 577fce6 commit 9940d25

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

wled00/FX_fcn.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ uint16_t IRAM_ATTR Segment::virtualLength() const {
674674
if (is2D()) {
675675
unsigned vW = virtualWidth();
676676
unsigned vH = virtualHeight();
677-
unsigned vLen = vW * vH; // use all pixels from segment
677+
unsigned vLen;
678678
switch (map1D2D) {
679679
case M12_pBar:
680680
vLen = vH;
@@ -688,6 +688,9 @@ uint16_t IRAM_ATTR Segment::virtualLength() const {
688688
case M12_sPinwheel:
689689
vLen = getPinwheelLength(vW, vH);
690690
break;
691+
default:
692+
vLen = vW * vH; // use all pixels from segment
693+
break;
691694
}
692695
return vLen;
693696
}
@@ -913,6 +916,10 @@ uint32_t IRAM_ATTR Segment::getPixelColor(int i) const
913916
else return getPixelColorXY(0, vH - i -1);
914917
break;
915918
case M12_pArc:
919+
if (i >= vW && i >= vH) {
920+
unsigned vI = sqrt16(i*i/2);
921+
return getPixelColorXY(vI,vI); // use diagonal
922+
}
916923
case M12_pCorner:
917924
// use longest dimension
918925
return vW>vH ? getPixelColorXY(i, 0) : getPixelColorXY(0, i);

0 commit comments

Comments
 (0)