gg: fix empty circle in native; http: post_form_with_cookies; veb: print veb action in html errors

This commit is contained in:
Alexander Medvednikov 2024-03-11 18:05:59 +03:00
parent 565cdf25b6
commit b2df3264a7
7 changed files with 53 additions and 3 deletions

View file

@ -540,6 +540,13 @@ fn radius_to_segments(r f32) int {
// `radius` defines the radius of the circle.
// `c` is the color of the outline.
pub fn (ctx &Context) draw_circle_empty(x f32, y f32, radius f32, c gx.Color) {
$if macos {
if ctx.native_rendering {
C.darwin_draw_circle_empty(x - radius + 1, ctx.height - (y + radius + 3),
radius, c)
return
}
}
if c.a != 255 {
sgl.load_pipeline(ctx.pipeline.alpha)
}

View file

@ -19,5 +19,6 @@ fn C.darwin_create_image(path string) Image
fn C.darwin_draw_image(f32, f32, f32, f32, &Image)
fn C.darwin_draw_circle(f32, f32, f32, voidptr)
fn C.darwin_draw_circle_empty(f32, f32, f32, voidptr)
//, gx.Color c)

View file

@ -120,3 +120,16 @@ void darwin_draw_circle(float x, float y, float d, gx__Color color) {
[circlePath fill];
// NSRectFill(rect);
}
void darwin_draw_circle_empty(float x, float y, float d, gx__Color color) {
NSColor* outlineColor = nscolor(color);
CGFloat outlineWidth = 1.0; //2.0;
NSRect rect = NSMakeRect(x, y, d * 2, d * 2);
NSBezierPath* circlePath = [NSBezierPath bezierPath];
[circlePath appendBezierPathWithOvalInRect:rect];
[outlineColor setStroke];
[circlePath setLineWidth:outlineWidth];
[circlePath stroke];
}

View file

@ -291,7 +291,9 @@ pub fn (ctx &Context) draw_image_with_config(config DrawImageConfig) {
if config.img_id > 0 {
img = &ctx.image_cache[config.img_id]
} else {
//$if !noggverbose ? {
eprintln('gg: failed to get image to draw natively')
//}
return
}
}