1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

gg:fix draw_line for android (#9882)

This commit is contained in:
kahsa
2021-04-26 16:01:55 +09:00
committed by GitHub
parent 9d68f924c3
commit f36e46bfde

View File

@ -560,17 +560,19 @@ pub fn (ctx &Context) draw_line(x f32, y f32, x2 f32, y2 f32, c gx.Color) {
if c.a != 255 { if c.a != 255 {
sgl.load_pipeline(ctx.timage_pip) sgl.load_pipeline(ctx.timage_pip)
} }
if ctx.scale > 1 { $if !android {
// Make the line more clear on hi dpi screens: draw a rectangle if ctx.scale > 1 {
mut width := mu.abs(x2 - x) // Make the line more clear on hi dpi screens: draw a rectangle
mut height := mu.abs(y2 - y) mut width := mu.abs(x2 - x)
if width == 0 { mut height := mu.abs(y2 - y)
width = 1 if width == 0 {
} else if height == 0 { width = 1
height = 1 } else if height == 0 {
height = 1
}
ctx.draw_rect(x, y, width, height, c)
return
} }
ctx.draw_rect(x, y, width, height, c)
return
} }
sgl.c4b(c.r, c.g, c.b, c.a) sgl.c4b(c.r, c.g, c.b, c.a)
sgl.begin_line_strip() sgl.begin_line_strip()