Skip to content

Commit 414480b

Browse files
committed
butterbur: Fixes for Dot
- Fixed broken round dot - Default dot to size 10, round cap - Also fixed seeing dot with size of 1 or 0
1 parent ad6ce26 commit 414480b

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

butterbur/src/GraphicalElement.ec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ public class Arc : Shape
426426

427427
shpType = arc;
428428
innerRadius = 0;
429+
stroke.cap = round;
430+
stroke.width = 10;
429431

430432
public:
431433
property Pointf center

butterbur/src/tesselation/shapesTesselation.ec

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ struct TesselatedShape
5757
bool partialSector = false, fullSector = false;
5858
uint count = 0;
5959
Array<Array<Pointf>> inner = null;
60+
Stroke stroke = shp.stroke;
61+
LineCap cap = stroke.cap;
6062

6163
switch(shp.shpType)
6264
{
@@ -67,6 +69,7 @@ struct TesselatedShape
6769
nodes = tmpNodes.array;
6870
nodes[0] = dot.point;
6971
count = 1;
72+
if(cap == flat) cap = square;
7073
break;
7174
}
7275
case ShapeType::path:
@@ -196,8 +199,6 @@ struct TesselatedShape
196199
}
197200

198201
{
199-
Stroke stroke = shp.stroke;
200-
LineCap cap = stroke.cap;
201202
LineJoin join = stroke.join;
202203
uint i, tc = count;
203204

@@ -221,6 +222,8 @@ struct TesselatedShape
221222
int inc = flip ? -1 : 1;
222223
uint ni = flip ? tc-1 : 0;
223224

225+
if(tc == 1 && lineWidth < 2) lineWidth = 2;
226+
224227
vCount = closed ? (tc * (rCount+1)) : (2*(capCount+1) + ((tc > 2) ? (tc-2) * (rCount+1) : 0));
225228
points = this.points = renew this.points Pointf[vCount];
226229

@@ -251,8 +254,6 @@ struct TesselatedShape
251254

252255
if(i == tc + (tc == 1) - 1)
253256
end = true;
254-
if(i == tc)
255-
i = 0;
256257

257258
{
258259
bool thisFlip = false, isCap = false;

butterbur/tests/graphics/butterbur.ec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,11 @@ class ButterburTest : Window
370370
Dot dot
371371
{
372372
//mge,
373-
point = { 300, 300 };
374-
stroke = { black, width = 20, cap = square };
373+
point = { 250, 300 };
374+
stroke = { black, width = 20,
375+
cap = round
376+
//cap = square
377+
};
375378
};
376379
GraphicalPresentation dotPresentation {/*gSurface*/ scene, graphic = dot };
377380

0 commit comments

Comments
 (0)