From 5333dc18382ecb0a2286712718ac3b4225fedf64 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Mon, 15 Apr 2024 21:40:17 +0100 Subject: implement stroke operation --- drawing/op.ha | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'drawing/op.ha') diff --git a/drawing/op.ha b/drawing/op.ha index aa7fac4..82a412f 100644 --- a/drawing/op.ha +++ b/drawing/op.ha @@ -11,7 +11,6 @@ export type op_stroke = struct { pos1: pos, color: u32, radius: u8, - count: u8, }; export type op = (op_circle | op_stroke); @@ -22,7 +21,6 @@ type op_type = enum u8 { export type deser_fail = !void; - // return value must be freed... for now. ehh export fn ser_op(op: op) []u8 = match (op) { case let opc: op_circle => yield ser_op_circle(opc); @@ -68,8 +66,8 @@ fn deser_op_circle(bytes: []u8) (op_circle|deser_fail) = { }; }; -def SER_LEN_STROKE = 23; -// type:1 pos0:8 pos1:8 color:4 radius:1 count:1 +def SER_LEN_STROKE = 22; +// type:1 pos0:8 pos1:8 color:4 radius:1 fn ser_op_stroke(ops: op_stroke) []u8 = { let buf: []u8 = alloc([0...], SER_LEN_STROKE); buf[0] = op_type::STROKE; @@ -79,7 +77,6 @@ fn ser_op_stroke(ops: op_stroke) []u8 = { ser_pos(payload[8..16], ops.pos1); endian::leputu32(payload[16..20], ops.color); payload[20] = ops.radius; - payload[21] = ops.count; return buf; }; fn deser_op_stroke(bytes: []u8) (op_stroke|deser_fail) = { @@ -90,7 +87,6 @@ fn deser_op_stroke(bytes: []u8) (op_stroke|deser_fail) = { pos1 = deser_pos(payload[8..16]), color = endian::legetu32(payload[16..20]), radius = payload[20], - count = payload[21], }; }; -- cgit v1.2.3