Skip to content

Commit

Permalink
feat: chrome/m94
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Aug 24, 2021
1 parent 0fb3563 commit 887a950
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README-zh.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `skr canvas`

![CI](https://github.com/Brooooooklyn/canvas/workflows/CI/badge.svg)
![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm93-hotpink)
![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm94-hotpink)
[![install size](https://packagephobia.com/badge?p=@napi-rs/canvas)](https://packagephobia.com/result?p=@napi-rs/canvas)
[![Downloads](https://img.shields.io/npm/dm/@napi-rs/canvas.svg?sanitize=true)](https://npmcharts.com/compare/@napi-rs/canvas?minimal=true)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `skr canvas`

![CI](https://github.com/Brooooooklyn/canvas/workflows/CI/badge.svg)
![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm93-hotpink)
![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm94-hotpink)
[![install size](https://packagephobia.com/badge?p=@napi-rs/canvas)](https://packagephobia.com/result?p=@napi-rs/canvas)
[![Downloads](https://img.shields.io/npm/dm/@napi-rs/canvas.svg?sanitize=true)](https://npmcharts.com/compare/@napi-rs/canvas?minimal=true)

Expand Down
2 changes: 2 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ fn main() {
println!("cargo:rustc-link-lib=static=skiac");
println!("cargo:rustc-link-lib=skparagraph");
println!("cargo:rustc-link-lib=skshaper");
println!("cargo:rustc-link-lib=static=skunicode");
}

#[cfg(not(target_os = "linux"))]
Expand All @@ -200,6 +201,7 @@ fn main() {
println!("cargo:rustc-link-lib=skiac");
println!("cargo:rustc-link-lib=skparagraph");
println!("cargo:rustc-link-lib=skshaper");
println!("cargo:rustc-link-lib=skunicode");
}
napi_build::setup();
}
14 changes: 14 additions & 0 deletions scripts/build-skia.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { execSync } = require('child_process')
const { readFileSync, writeFileSync } = require('fs')
const path = require('path')
const { platform } = require('os')

Expand Down Expand Up @@ -203,6 +204,19 @@ const OUTPUT_PATH = path.join('out', 'Static')

GN_ARGS.push(`cc=${CC}`, `cxx=${CXX}`, `extra_cflags_cc=[${ExtraCflagsCC}]`, ExtraSkiaBuildFlag)

const SkLoadICUCppFilePath = path.join(__dirname, '..', 'skia', 'third_party', 'icu', 'SkLoadICU.cpp')
const CODE_TO_PATCH = 'good = load_from(executable_directory()) || load_from(library_directory());'
const CODE_I_WANT = 'good = load_from(library_directory()) || load_from(executable_directory());'

if (PLATFORM_NAME === 'win32') {
const content = readFileSync(SkLoadICUCppFilePath, 'utf8')
const patch = content.replace(CODE_TO_PATCH, CODE_I_WANT)
writeFileSync(SkLoadICUCppFilePath, patch)
process.once('beforeExit', () => {
writeFileSync(SkLoadICUCppFilePath, content)
})
}

exec(
`${process.env.GN_EXE ? process.env.GN_EXE : path.join('bin', 'gn')} gen ${OUTPUT_PATH} --args='${GN_ARGS.join(
' ',
Expand Down
2 changes: 1 addition & 1 deletion scripts/release-skia-binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (TARGET && TARGET.startsWith('--target=')) {
TARGET_TRIPLE = TARGET.replace('--target=', '')
}

const LIB = ['skia', 'skparagraph', 'skshaper', 'svg', 'sktext']
const LIB = ['skia', 'skparagraph', 'skshaper', 'svg', 'sktext', 'skunicode']
const ICU_DAT = 'icudtl.dat'

const CLIENT = new Octokit({
Expand Down
2 changes: 1 addition & 1 deletion skia
Submodule skia updated 1044 files

1 comment on commit 887a950

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 887a950 Previous: 0fb3563 Ratio
Draw house#skia-canvas 20 ops/sec (±1.33%) 19.5 ops/sec (±1.23%) 0.97
Draw house#node-canvas 22 ops/sec (±1%) 20.2 ops/sec (±0.88%) 0.92
Draw house#@napi-rs/skia 23 ops/sec (±1.15%) 19.4 ops/sec (±1.14%) 0.84
Draw gradient#skia-canvas 19 ops/sec (±0.55%) 18.8 ops/sec (±1.71%) 0.99
Draw gradient#node-canvas 21 ops/sec (±1.04%) 18.9 ops/sec (±1.7%) 0.90
Draw gradient#@napi-rs/skia 22 ops/sec (±0.86%) 18.1 ops/sec (±2%) 0.82

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.