diff --git a/shader/coarse.wgsl b/shader/coarse.wgsl index 6eced0d..58fe409 100644 --- a/shader/coarse.wgsl +++ b/shader/coarse.wgsl @@ -126,13 +126,11 @@ fn write_grad(ty: u32, index: u32, info_offset: u32) { cmd_offset += 3u; } -fn write_image(xy: u32, width_height: u32, info_offset: u32) { - alloc_cmd(4u); +fn write_image(info_offset: u32) { + alloc_cmd(2u); ptcl[cmd_offset] = CMD_IMAGE; ptcl[cmd_offset + 1u] = info_offset; - ptcl[cmd_offset + 2u] = xy; - ptcl[cmd_offset + 3u] = width_height; - cmd_offset += 4u; + cmd_offset += 2u; } fn write_begin_clip() { @@ -387,12 +385,10 @@ fn main( } } // DRAWTAG_FILL_IMAGE - case 0x1c8u: { + case 0x248u: { let linewidth = bitcast(info_bin_data[di]); if write_path(tile, linewidth) { - let xy = scene[dd]; - let width_height = scene[dd + 1u]; - write_image(xy, width_height, di + 1u); + write_image(di + 1u); } } // DRAWTAG_BEGIN_CLIP diff --git a/shader/draw_leaf.wgsl b/shader/draw_leaf.wgsl index d0873de..b149d27 100644 --- a/shader/draw_leaf.wgsl +++ b/shader/draw_leaf.wgsl @@ -125,7 +125,7 @@ fn main( linewidth *= sqrt(abs(matrx.x * matrx.w - matrx.y * matrx.z)); } switch tag_word { - // DRAWTAG_FILL_COLOR, DRAWTAG_FILL_IMAGE + // DRAWTAG_FILL_COLOR case 0x44u: { info[di] = bitcast(linewidth); } @@ -172,7 +172,7 @@ fn main( info[di + 10u] = bitcast(roff); } // DRAWTAG_FILL_IMAGE - case 0x1c8u: { + case 0x248u: { info[di] = bitcast(linewidth); let inv_det = 1.0 / (matrx.x * matrx.w - matrx.y * matrx.z); let inv_mat = inv_det * vec4(matrx.w, -matrx.y, -matrx.z, matrx.x); @@ -183,6 +183,8 @@ fn main( info[di + 4u] = bitcast(inv_mat.w); info[di + 5u] = bitcast(inv_tr.x); info[di + 6u] = bitcast(inv_tr.y); + info[di + 7u] = scene[dd]; + info[di + 8u] = scene[dd + 1u]; } default: {} } diff --git a/shader/fine.wgsl b/shader/fine.wgsl index 38e6b96..8292090 100644 --- a/shader/fine.wgsl +++ b/shader/fine.wgsl @@ -86,14 +86,14 @@ fn read_rad_grad(cmd_ix: u32) -> CmdRadGrad { fn read_image(cmd_ix: u32) -> CmdImage { let info_offset = ptcl[cmd_ix + 1u]; - let xy = ptcl[cmd_ix + 2u]; - let width_height = ptcl[cmd_ix + 3u]; let m0 = bitcast(info[info_offset]); let m1 = bitcast(info[info_offset + 1u]); let m2 = bitcast(info[info_offset + 2u]); let m3 = bitcast(info[info_offset + 3u]); let matrx = vec4(m0, m1, m2, m3); let xlat = vec2(bitcast(info[info_offset + 4u]), bitcast(info[info_offset + 5u])); + let xy = info[info_offset + 6u]; + let width_height = info[info_offset + 7u]; // The following are not intended to be bitcasts let x = f32(xy >> 16u); let y = f32(xy & 0xffffu); @@ -307,7 +307,7 @@ fn main( rgba[i] = rgba[i] * (1.0 - fg_i.a) + fg_i; } } - cmd_ix += 4u; + cmd_ix += 2u; } // CMD_BEGIN_CLIP case 9u: { diff --git a/shader/shared/drawtag.wgsl b/shader/shared/drawtag.wgsl index d2646b8..0d532d1 100644 --- a/shader/shared/drawtag.wgsl +++ b/shader/shared/drawtag.wgsl @@ -19,7 +19,7 @@ let DRAWTAG_NOP = 0u; let DRAWTAG_FILL_COLOR = 0x44u; let DRAWTAG_FILL_LIN_GRADIENT = 0x114u; let DRAWTAG_FILL_RAD_GRADIENT = 0x2dcu; -let DRAWTAG_FILL_IMAGE = 0x1c8u; +let DRAWTAG_FILL_IMAGE = 0x248u; let DRAWTAG_BEGIN_CLIP = 0x9u; let DRAWTAG_END_CLIP = 0x21u; diff --git a/src/encoding/draw.rs b/src/encoding/draw.rs index fb3aa1f..64fdd16 100644 --- a/src/encoding/draw.rs +++ b/src/encoding/draw.rs @@ -38,7 +38,7 @@ impl DrawTag { pub const RADIAL_GRADIENT: Self = Self(0x2dc); /// Image fill. - pub const IMAGE: Self = Self(0x1c8); + pub const IMAGE: Self = Self(0x248); /// Begin layer/clip. pub const BEGIN_CLIP: Self = Self(0x9);