text, vector: fix typos and redundant casts (#2537)

This commit is contained in:
Pierre Curto 2023-01-12 19:28:41 +01:00 committed by GitHub
parent a06c15fb66
commit abd293fae6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -52,7 +52,7 @@ func adjustOffsetGranularity(x fixed.Int26_6) fixed.Int26_6 {
return x / (1 << 4) * (1 << 4) return x / (1 << 4) * (1 << 4)
} }
func drawGlyph(dst *ebiten.Image, face font.Face, r rune, img *ebiten.Image, topleft fixed.Point26_6, op *ebiten.DrawImageOptions) { func drawGlyph(dst *ebiten.Image, img *ebiten.Image, topleft fixed.Point26_6, op *ebiten.DrawImageOptions) {
if img == nil { if img == nil {
return return
} }
@ -259,7 +259,7 @@ func DrawWithOptions(dst *ebiten.Image, text string, face font.Face, options *eb
Y: b.Min.Y & ((1 << 6) - 1), Y: b.Min.Y & ((1 << 6) - 1),
} }
img := getGlyphImage(face, r, offset) img := getGlyphImage(face, r, offset)
drawGlyph(dst, face, r, img, fixed.Point26_6{ drawGlyph(dst, img, fixed.Point26_6{
X: dx + b.Min.X - offset.X, X: dx + b.Min.X - offset.X,
Y: dy + b.Min.Y - offset.Y, Y: dy + b.Min.Y - offset.Y,
}, options) }, options)

View File

@ -275,7 +275,7 @@ func (p *Path) ArcTo(x1, y1, x2, y2, radius float32) {
theta := math.Acos(float64(d0.x*d1.x + d0.y*d1.y)) theta := math.Acos(float64(d0.x*d1.x + d0.y*d1.y))
// TODO: When theta is bigger than π/2, the arc should be split into two. // TODO: When theta is bigger than π/2, the arc should be split into two.
// dist is the distance between the control point and the arc's begenning and ending points. // dist is the distance between the control point and the arc's beginning and ending points.
dist := radius / float32(math.Tan(theta/2)) dist := radius / float32(math.Tan(theta/2))
// TODO: What if dist is too big? // TODO: What if dist is too big?

View File

@ -94,7 +94,7 @@ func StrokeRect(dst *ebiten.Image, x, y, width, height float32, strokeWidth floa
// DrawFilledCircle filles a circle with the specified center position (cx, cy), the radius (r), width and color. // DrawFilledCircle filles a circle with the specified center position (cx, cy), the radius (r), width and color.
func DrawFilledCircle(dst *ebiten.Image, cx, cy, r float32, clr color.Color) { func DrawFilledCircle(dst *ebiten.Image, cx, cy, r float32, clr color.Color) {
var path Path var path Path
path.Arc(float32(cx), float32(cy), float32(r), 0, 2*math.Pi, Clockwise) path.Arc(cx, cy, r, 0, 2*math.Pi, Clockwise)
vs, is := path.AppendVerticesAndIndicesForFilling(nil, nil) vs, is := path.AppendVerticesAndIndicesForFilling(nil, nil)
drawVerticesForUtil(dst, vs, is, clr) drawVerticesForUtil(dst, vs, is, clr)
@ -105,7 +105,7 @@ func DrawFilledCircle(dst *ebiten.Image, cx, cy, r float32, clr color.Color) {
// clr has be to be a solid (non-transparent) color. // clr has be to be a solid (non-transparent) color.
func StrokeCircle(dst *ebiten.Image, cx, cy, r float32, strokeWidth float32, clr color.Color) { func StrokeCircle(dst *ebiten.Image, cx, cy, r float32, strokeWidth float32, clr color.Color) {
var path Path var path Path
path.Arc(float32(cx), float32(cy), float32(r), 0, 2*math.Pi, Clockwise) path.Arc(cx, cy, r, 0, 2*math.Pi, Clockwise)
path.Close() path.Close()
strokeOp := &StrokeOptions{} strokeOp := &StrokeOptions{}