Skip to content

Commit

Permalink
feat: chrome/m110 [skip skia] (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jan 2, 2023
1 parent 6796c89 commit e1efc1d
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 36 deletions.
29 changes: 21 additions & 8 deletions .github/workflows/skia.yaml
Expand Up @@ -288,7 +288,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
check-latest: true
cache: 'yarn'

Expand All @@ -301,20 +301,33 @@ jobs:
run: echo "${PWD}/depot_tools" >> $GITHUB_PATH
shell: bash

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/arm/v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/arm/v7

- name: Install cross compile tools
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | sudo tee -a /etc/apt/sources.list > /dev/null
echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | sudo tee -a /etc/apt/sources.list > /dev/null
sudo apt-get update
sudo apt-get install gcc-10-arm-linux-gnueabihf g++-10-arm-linux-gnueabihf -y
sudo apt-get install llvm-15 clang-15 lld-15 gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx build --load --platform linux/arm/v7 -t ubuntu:jammy-armv7 . -f jammy-armv7.Dockerfile
docker run --rm -dt --name ubuntu-jammy-armv7 ubuntu:jammy-armv7
sudo mkdir -p /usr/arm-linux-gnueabihf/lib/llvm-14
sudo docker cp ubuntu-jammy-armv7:/usr/lib/llvm-14/lib /usr/arm-linux-gnueabihf/lib/llvm-14/lib
sudo docker cp ubuntu-jammy-armv7:/usr/lib/llvm-14/include /usr/arm-linux-gnueabihf/lib/llvm-14/include
docker stop ubuntu-jammy-armv7
- name: Compile skia
run: node ./scripts/build-skia.js --target=armv7-unknown-linux-gnueabihf

- name: Cache yarn
uses: actions/cache@v3
with:
path: .yarn/cache
key: build-skia-linux-armv7-gnueabihf-yarn-cache-node-16

- name: Install dependencies
run: yarn install --immutable --mode=skip-build

Expand Down
2 changes: 1 addition & 1 deletion README-zh.md
@@ -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%2Fm108-hotpink)
![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm110-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
@@ -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%2Fm108-hotpink)
![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm110-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
19 changes: 3 additions & 16 deletions __test__/pathkit.spec.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scripts/build-skia.js
Expand Up @@ -170,7 +170,7 @@ switch (TARGET_TRIPLE) {
ExtraCflags = `"--target=arm-unknown-linux-gnueabihf", "-I/usr/arm-linux-gnueabihf/include/c++/${armv7GccVersion}/arm-linux-gnueabihf", "-march=armv7-a", "-mthumb"`
ExtraCflagsCC += `,"-stdlib=libc++", "-static", "--target=arm-unknown-linux-gnueabihf", "-I/usr/arm-linux-gnueabihf/include/c++/${armv7GccVersion}/arm-linux-gnueabihf", "-march=armv7-a", "-mthumb"`
ExtraLdFlags =
'"--target=arm-unknown-linux-gnueabihf", "-B/usr/arm-linux-gnueabihf/bin", "-L/usr/arm-linux-gnueabihf/lib"'
'"--target=arm-unknown-linux-gnueabihf", "-B/usr/arm-linux-gnueabihf/bin", "-L/usr/arm-linux-gnueabihf/lib", "-L/usr/arm-linux-gnueabihf/lib/llvm-14/lib"'
ExtraAsmFlags =
'"--sysroot=/usr/arm-linux-gnueabihf", "--target=arm-unknown-linux-gnueabihf", "-march=armv7-a", "-mthumb"'

Expand Down
2 changes: 1 addition & 1 deletion skia
Submodule skia updated 2894 files
21 changes: 13 additions & 8 deletions skia-c/skia_c.cpp
Expand Up @@ -760,11 +760,13 @@ extern "C"

void skiac_path_to_svg_string(skiac_path *c_path, skiac_string *c_string)
{
auto string = new SkString();
SkParsePath::ToSVGString(*PATH_CAST, string);
c_string->length = string->size();
c_string->ptr = string->c_str();
c_string->sk_string = string;
auto string = SkParsePath::ToSVGString(*PATH_CAST);
auto length = string.size();
auto result_string = new SkString(length);
string.swap(*result_string);
c_string->length = length;
c_string->ptr = result_string->c_str();
c_string->sk_string = result_string;
}

bool skiac_path_simplify(skiac_path *c_path)
Expand All @@ -786,8 +788,9 @@ extern "C"
p.setStrokeJoin((SkPaint::Join)join);
p.setStrokeWidth(width);
p.setStrokeMiter(miter_limit);

return p.getFillPath(*path, path);
const SkPath *const_path = path;
const SkPaint const_paint = p;
return FillPathWithPaint(*const_path, const_paint, path);
}

void skiac_path_compute_tight_bounds(skiac_path *c_path, skiac_rect *c_rect)
Expand Down Expand Up @@ -949,7 +952,9 @@ extern "C"

bool result;
auto precision = 0.3; // Based on config in Chromium
if (paint.getFillPath(*path, &traced_path, nullptr, precision))
const SkPath *const_path = path;
const SkPaint const_paint = paint;
if (FillPathWithPaint(*const_path, const_paint, &traced_path, nullptr, precision))
{
result = traced_path.contains(x, y);
}
Expand Down
2 changes: 2 additions & 0 deletions skia-c/skia_c.hpp
Expand Up @@ -9,6 +9,7 @@
#include <include/pathops/SkPathOps.h>
#include <include/utils/SkParsePath.h>
#include <include/core/SkBitmap.h>
#include <include/core/SkBlurTypes.h>
#include <include/core/SkCanvas.h>
#include <include/core/SkColorFilter.h>
#include <include/core/SkData.h>
Expand All @@ -17,6 +18,7 @@
#include <include/core/SkFontMgr.h>
#include <include/core/SkPaint.h>
#include <include/core/SkPathEffect.h>
#include <include/core/SkPathUtils.h>
#include <include/core/SkSurface.h>
#include <include/core/SkMaskFilter.h>
#include <include/core/SkStream.h>
Expand Down

0 comments on commit e1efc1d

Please sign in to comment.