Skip to content

Commit

Permalink
fix [skip skia]
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Jun 8, 2024
1 parent c6af883 commit f313c3f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "link-args=/NODEFAULTLIB:libcmt.lib", "-C", "target-feature=+crt-static"]
rustflags = ["-C", "target-feature=+crt-static"]

[target.aarch64-apple-darwin]
rustflags = ["-C", "target-cpu=apple-a14"]
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ jobs:
yarn build --target x86_64-apple-darwin
downloadTarget: ''
- host: windows-latest
setup: |
choco upgrade llvm
build: yarn build --target x86_64-pc-windows-msvc
target: 'x86_64-pc-windows-msvc'
downloadTarget: ''
Expand Down Expand Up @@ -150,7 +152,7 @@ jobs:
export LDFLAGS="--target=aarch64-linux-android24"
yarn build --target aarch64-linux-android
name: stable - ${{ matrix.settings.target }} - node@18
name: stable - ${{ matrix.settings.target }} - node@20
runs-on: ${{ matrix.settings.host }}

steps:
Expand Down
8 changes: 4 additions & 4 deletions src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ pub(crate) fn css_filters_to_image_filter(filters: Vec<CssFilter>) -> Option<Ima
)
}
CssFilter::Grayscale(amt) => {
let amt = 1.0 - amt.max(0.0).min(1.0);
let amt = 1.0 - amt.clamp(0.0, 1.0);
ImageFilter::make_image_filter(
0.2126 + 0.7874 * amt,
0.7152 - 0.7152 * amt,
Expand Down Expand Up @@ -345,7 +345,7 @@ pub(crate) fn css_filters_to_image_filter(filters: Vec<CssFilter>) -> Option<Ima
)
}
CssFilter::Invert(amt) => {
let amt = amt.max(0.0).min(1.0);
let amt = amt.clamp(0.0, 1.0);
let mut ramp = [0u8; 256];
ramp
.iter_mut()
Expand All @@ -360,7 +360,7 @@ pub(crate) fn css_filters_to_image_filter(filters: Vec<CssFilter>) -> Option<Ima
ImageFilter::from_argb(None, ramp, ramp, ramp, Some(&image_filter))
}
CssFilter::Opacity(opacity) => {
let opacity = opacity.max(0.0).min(1.0);
let opacity = opacity.clamp(0.0, 1.0);
ImageFilter::make_image_filter(
1.0,
0.0,
Expand Down Expand Up @@ -392,7 +392,7 @@ pub(crate) fn css_filters_to_image_filter(filters: Vec<CssFilter>) -> Option<Ima
)
}
CssFilter::Sepia(amt) => {
let amt = 1.0 - amt.max(0.0).min(1.0);
let amt = 1.0 - amt.clamp(0.0, 1.0);
ImageFilter::make_image_filter(
0.393 + 0.607 * amt,
0.769 - 0.769 * amt,
Expand Down
1 change: 1 addition & 0 deletions src/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{CanvasElement, SVGCanvas};

#[derive(Debug, Clone)]
pub enum Pattern {
#[allow(dead_code)]
Color(RGBA, String),
Gradient(Gradient),
Image(ImagePattern),
Expand Down
9 changes: 5 additions & 4 deletions src/sk.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::convert::TryFrom;
use std::f32::consts::PI;
use std::ffi::{c_void, CStr, CString, NulError};
use std::fmt;
use std::fmt::{self, Display};
use std::ops::{Deref, DerefMut};
use std::os::raw::c_char;
use std::ptr;
Expand Down Expand Up @@ -222,6 +222,7 @@ pub mod ffi {
pub type SkiacFontCollectionGetFamily =
Option<unsafe extern "C" fn(width: i32, weight: i32, slant: i32, raw_cb: *mut c_void)>;

#[allow(clippy::duplicated_attributes)]
// https://github.com/rust-lang/rust/issues/96192
#[link(
name = "svg",
Expand Down Expand Up @@ -1480,9 +1481,9 @@ impl TextBaseline {
}
}

impl ToString for TextBaseline {
fn to_string(&self) -> String {
self.as_str().to_owned()
impl Display for TextBaseline {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.as_str())
}
}

Expand Down

0 comments on commit f313c3f

Please sign in to comment.