mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
text, vector: fix typos and redundant casts (#2537)
This commit is contained in:
parent
a06c15fb66
commit
abd293fae6
@ -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)
|
||||||
|
@ -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?
|
||||||
|
@ -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{}
|
||||||
|
Loading…
Reference in New Issue
Block a user