|
|
|
@ -16,10 +16,7 @@ function push_quad(s, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y, ax, ay, bx, by, th
@@ -16,10 +16,7 @@ function push_quad(s, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y, ax, ay, bx, by, th
|
|
|
|
|
push_point(s, p1x, p1y, ax, ay, bx, by, thickness, r, g, b); |
|
|
|
|
push_point(s, p2x, p2y, ax, ay, bx, by, thickness, r, g, b); |
|
|
|
|
push_point(s, p3x, p3y, ax, ay, bx, by, thickness, r, g, b); |
|
|
|
|
|
|
|
|
|
push_point(s, p4x, p4y, ax, ay, bx, by, thickness, r, g, b); |
|
|
|
|
push_point(s, p3x, p3y, ax, ay, bx, by, thickness, r, g, b); |
|
|
|
|
push_point(s, p2x, p2y, ax, ay, bx, by, thickness, r, g, b); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function push_stroke(s, stroke) { |
|
|
|
@ -88,10 +85,12 @@ function geometry_prepare_stroke(state) {
@@ -88,10 +85,12 @@ function geometry_prepare_stroke(state) {
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const points = process_stroke(state, state.players[state.me].points); |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
'color': state.players[state.me].color, |
|
|
|
|
'width': state.players[state.me].width, |
|
|
|
|
'points': process_stroke(state, state.players[state.me].points), |
|
|
|
|
'points': points, |
|
|
|
|
'user_id': state.me, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
@ -99,8 +98,10 @@ function geometry_prepare_stroke(state) {
@@ -99,8 +98,10 @@ function geometry_prepare_stroke(state) {
|
|
|
|
|
function geometry_add_stroke(state, context, stroke) { |
|
|
|
|
if (!state.online || !stroke) return; |
|
|
|
|
|
|
|
|
|
stroke.bbox = stroke_bbox(stroke.points); |
|
|
|
|
|
|
|
|
|
let bytes_left = context.static_serializer.size - context.static_serializer.offset; |
|
|
|
|
let bytes_needed = stroke.points.length * 6 * config.bytes_per_point; |
|
|
|
|
let bytes_needed = stroke.points.length * 4 * config.bytes_per_point; |
|
|
|
|
|
|
|
|
|
if (bytes_left < bytes_needed) { |
|
|
|
|
const extend_to = Math.ceil((context.static_serializer.size + bytes_needed) * 1.62); |
|
|
|
@ -257,4 +258,4 @@ function image_at(state, x, y) {
@@ -257,4 +258,4 @@ function image_at(state, x, y) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|