op/clip: replace Rect and RoundRect with Rect type

Remembering the order of the corners in the RoundRect is difficult,
which suggest that RoundRect should be a struct with named fields.

Do that, and make Rect the special case where corner radii are all
zero.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-11-18 14:33:28 +01:00
parent 101b65f4e5
commit 7299d1c875
4 changed files with 46 additions and 30 deletions
+1 -1
View File
@@ -249,7 +249,7 @@ func (l *List) layout() Dimensions {
}
var stack op.StackOp
stack.Push(ops)
clip.Rect(ops, toRectF(r)).Add(ops)
clip.Rect{Rect: toRectF(r)}.Op(ops).Add(ops)
op.TransformOp{}.Offset(toPointF(axisPoint(l.Axis, pos, cross))).Add(ops)
child.macro.Add(ops)
stack.Pop()