forked from joejulian/gio
f32: replace Affine2D{} with AffineId() for identity transformations
Reduces ambiguity by introducing AffineId() for representing identity transformation matrices. References: https://todo.sr.ht/~eliasnaur/gio/655 Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
This commit is contained in:
committed by
Elias Naur
parent
3e601e73c4
commit
d76b4272aa
+3
-3
@@ -39,7 +39,7 @@ func (fit Fit) scale(cs layout.Constraints, pos layout.Direction, dims layout.Di
|
||||
|
||||
offset := pos.Position(widgetSize, dims.Size)
|
||||
dims.Baseline += offset.Y
|
||||
return dims, f32.Affine2D{}.Offset(layout.FPt(offset))
|
||||
return dims, f32.AffineId().Offset(layout.FPt(offset))
|
||||
}
|
||||
|
||||
scale := f32.Point{
|
||||
@@ -73,7 +73,7 @@ func (fit Fit) scale(cs layout.Constraints, pos layout.Direction, dims layout.Di
|
||||
|
||||
offset := pos.Position(widgetSize, dims.Size)
|
||||
dims.Baseline += offset.Y
|
||||
return dims, f32.Affine2D{}.Offset(layout.FPt(offset))
|
||||
return dims, f32.AffineId().Offset(layout.FPt(offset))
|
||||
}
|
||||
case Fill:
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func (fit Fit) scale(cs layout.Constraints, pos layout.Direction, dims layout.Di
|
||||
dims.Baseline = int(float32(dims.Baseline) * scale.Y)
|
||||
|
||||
offset := pos.Position(scaledSize, dims.Size)
|
||||
trans := f32.Affine2D{}.
|
||||
trans := f32.AffineId().
|
||||
Scale(f32.Point{}, scale).
|
||||
Offset(layout.FPt(offset))
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ func (im Image) Layout(gtx layout.Context) layout.Dimensions {
|
||||
defer clip.Rect{Max: dims.Size}.Push(gtx.Ops).Pop()
|
||||
|
||||
pixelScale := scale * gtx.Metric.PxPerDp
|
||||
trans = trans.Mul(f32.Affine2D{}.Scale(f32.Point{}, f32.Pt(pixelScale, pixelScale)))
|
||||
trans = trans.Mul(f32.AffineId().Scale(f32.Point{}, f32.Pt(pixelScale, pixelScale)))
|
||||
defer op.Affine(trans).Push(gtx.Ops).Pop()
|
||||
|
||||
im.Src.Add(gtx.Ops)
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ func (it *textIterator) paintGlyph(gtx layout.Context, shaper *text.Shaper, glyp
|
||||
line = append(line, glyph)
|
||||
}
|
||||
if glyph.Flags&text.FlagLineBreak != 0 || cap(line)-len(line) == 0 || !visibleOrBefore {
|
||||
t := op.Affine(f32.Affine2D{}.Offset(it.lineOff)).Push(gtx.Ops)
|
||||
t := op.Affine(f32.AffineId().Offset(it.lineOff)).Push(gtx.Ops)
|
||||
path := shaper.Shape(line)
|
||||
outline := clip.Outline{Path: path}.Op().Push(gtx.Ops)
|
||||
it.material.Add(gtx.Ops)
|
||||
|
||||
Reference in New Issue
Block a user