Skip to content

Commit a6a2881

Browse files
authored
Fix Bounding Box Calculation (#859)
* Fix Bounding Box Calculation At some point when changing our text engine, we introduced a scale value for each individual glyph, possibly during the transition to `cosmic-text`. This is correctly being used when rendering the text, but not when calculating the bounding box of the text. This meant that for certain fonts the dirty region of the image, that is cleared on each frame, was not calculated correctly and thus the previous text was still visible. * Fix WASI 0.1 Target It got renamed to mention the version number in the target name.
1 parent 654b373 commit a6a2881

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[target.wasm32-wasi]
1+
[target.wasm32-wasip1]
22
runner = "wasmtime run --dir ."
33

44
[target.x86_64-pc-windows-msvc]

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
pull_request:
55
push:
66
branches:
7-
- 'master'
7+
- "master"
88
tags:
9-
- '*'
9+
- "*"
1010

1111
jobs:
1212
build:
@@ -36,7 +36,7 @@ jobs:
3636
# WebAssembly
3737
- WebAssembly Unknown
3838
- WebAssembly Web
39-
- WebAssembly WASI
39+
- WebAssembly WASI 0.1
4040

4141
# Windows
4242
- Windows aarch64
@@ -237,8 +237,8 @@ jobs:
237237
install_target: true
238238
features: "--features wasm-web"
239239

240-
- label: WebAssembly WASI
241-
target: wasm32-wasi
240+
- label: WebAssembly WASI 0.1
241+
target: wasm32-wasip1
242242
auto_splitting: skip
243243
cross: skip
244244
dylib: skip
@@ -706,7 +706,7 @@ jobs:
706706
- name: Use Node 10
707707
uses: actions/setup-node@v1
708708
with:
709-
node-version: '10.x'
709+
node-version: "10.x"
710710
- name: Build TypeScript documentation
711711
run: |
712712
cd capi/js

.github/workflows/build_static.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ main() {
1919
wasm32-unknown-unknown)
2020
$cargo rustc -p livesplit-core-capi --crate-type cdylib --target $TARGET $release_flag $FEATURES
2121
;;
22-
wasm32-wasi)
22+
wasm32-wasip1)
2323
$cargo rustc -p livesplit-core-capi --crate-type cdylib --target $TARGET $release_flag $FEATURES
2424
;;
2525
*)

.github/workflows/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ main() {
2222
features="$features,software-rendering"
2323
fi
2424

25-
if [ "$TARGET" = "wasm32-wasi" ]; then
25+
if [ "$TARGET" = "wasm32-wasip1" ]; then
2626
curl https://wasmtime.dev/install.sh -sSf | bash
2727
export PATH="$HOME/.wasmtime/bin:$PATH"
2828
else

crates/livesplit-auto-splitting/tests/sandboxing.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn compile(crate_name: &str) -> anyhow::Result<AutoSplitter<DummyTimer>> {
3737
.current_dir(&path)
3838
.arg("build")
3939
.arg("--target")
40-
.arg("wasm32-wasi")
40+
.arg("wasm32-wasip1")
4141
.stdin(Stdio::null())
4242
.stdout(Stdio::null())
4343
.output()
@@ -49,7 +49,7 @@ fn compile(crate_name: &str) -> anyhow::Result<AutoSplitter<DummyTimer>> {
4949
}
5050

5151
path.push("target");
52-
path.push("wasm32-wasi");
52+
path.push("wasm32-wasip1");
5353
path.push("debug");
5454
let wasm_path = fs::read_dir(path)
5555
.unwrap()

src/rendering/software.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,10 @@ fn calculate_bounds(layer: &[Entity<SkiaPath, SkiaImage, SkiaLabel>]) -> [f32; 2
831831
Entity::Label(label, _, transform) => {
832832
for glyph in label.read().unwrap().glyphs() {
833833
if let Some(path) = &glyph.path {
834-
let transform = transform.pre_translate(glyph.x, glyph.y);
834+
let transform = transform
835+
.pre_translate(glyph.x, glyph.y)
836+
.pre_scale(glyph.scale, glyph.scale);
837+
835838
let bounds = path.bounds();
836839
for y in [bounds.top(), bounds.bottom()] {
837840
let transformed_y = transform.transform_y(y);

0 commit comments

Comments
 (0)