z2d context no longer has err return
parent
0c8339d2da
commit
bbbe81efc5
|
|
@ -2239,7 +2239,7 @@ fn draw_branch_node(
|
||||||
@min(float_width - cx, float_height - cy),
|
@min(float_width - cx, float_height - cy),
|
||||||
);
|
);
|
||||||
|
|
||||||
var ctx = canvas.getContext() catch return;
|
var ctx = canvas.getContext();
|
||||||
defer ctx.deinit();
|
defer ctx.deinit();
|
||||||
ctx.setSource(.{ .opaque_pattern = .{
|
ctx.setSource(.{ .opaque_pattern = .{
|
||||||
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
|
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
|
||||||
|
|
@ -2290,7 +2290,7 @@ fn draw_circle(
|
||||||
};
|
};
|
||||||
const r: f64 = 0.5 * @min(float_width, float_height);
|
const r: f64 = 0.5 * @min(float_width, float_height);
|
||||||
|
|
||||||
var ctx = canvas.getContext() catch return;
|
var ctx = canvas.getContext();
|
||||||
defer ctx.deinit();
|
defer ctx.deinit();
|
||||||
ctx.setSource(.{ .opaque_pattern = .{
|
ctx.setSource(.{ .opaque_pattern = .{
|
||||||
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
|
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
|
||||||
|
|
@ -2680,7 +2680,7 @@ fn draw_arc(
|
||||||
// Fraction away from the center to place the middle control points,
|
// Fraction away from the center to place the middle control points,
|
||||||
const s: f64 = 0.25;
|
const s: f64 = 0.25;
|
||||||
|
|
||||||
var ctx = try canvas.getContext();
|
var ctx = canvas.getContext();
|
||||||
defer ctx.deinit();
|
defer ctx.deinit();
|
||||||
ctx.setSource(.{ .opaque_pattern = .{
|
ctx.setSource(.{ .opaque_pattern = .{
|
||||||
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
|
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
|
||||||
|
|
@ -2974,7 +2974,7 @@ fn draw_separated_block_quadrant(self: Box, canvas: *font.sprite.Canvas, comptim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var ctx = try canvas.getContext();
|
var ctx = canvas.getContext();
|
||||||
defer ctx.deinit();
|
defer ctx.deinit();
|
||||||
ctx.setSource(.{ .opaque_pattern = .{
|
ctx.setSource(.{ .opaque_pattern = .{
|
||||||
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
|
.pixel = .{ .alpha8 = .{ .a = @intFromEnum(Shade.on) } },
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,8 @@ pub const Canvas = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Acquires a z2d drawing context, caller MUST deinit context.
|
/// Acquires a z2d drawing context, caller MUST deinit context.
|
||||||
pub fn getContext(self: *Canvas) Allocator.Error!z2d.Context {
|
pub fn getContext(self: *Canvas) z2d.Context {
|
||||||
return try z2d.Context.init(self.alloc, &self.sfc);
|
return z2d.Context.init(self.alloc, &self.sfc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw and fill a single pixel
|
/// Draw and fill a single pixel
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue