Skip to content

Commit

Permalink
chore: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
triniwiz committed Oct 14, 2023
1 parent e9b1366 commit 7f16f1c
Show file tree
Hide file tree
Showing 16 changed files with 956 additions and 416 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions packages/canvas/src-native/canvas-native/canvas-2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gl = ["skia-safe/gl"]
[dependencies]
canvas-core = { path = "../canvas-core", features = ["2d"] }
parking_lot = "0.12.1"
regex = "1.5.4"
regex = "1.10.0"
base64 = "0.21.0"
encoding_rs = "0.8.32"
gl-bindings = { path = "../gl-bindings" }
Expand All @@ -19,6 +19,6 @@ csscolorparser = { git = "https://github.com/triniwiz/csscolorparser-rs.git", re
rgb = { version = "0.8.32", features = ["argb"] }
log = "0.4.8"
once_cell = "1.8.0"
skia-bindings = { version = "0.66.2", features = ["gl", "svg"] }
skia-safe = { version = "0.66.2", features = ["gl", "svg"] }
image = {version = "0.24.5" , features = ["png", "jpeg", "gif"]}
skia-bindings = { version = "0.66.3", features = ["gl", "svg"] }
skia-safe = { version = "0.66.3", features = ["gl", "svg"] }
image = {version = "0.24.7" , features = ["png", "jpeg", "gif"]}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ impl TextEncoder {
Self { inner: encoder }
}

pub fn encode(&mut self, text: &str) -> Vec<u8> {
pub fn encode(&self, text: &str) -> Vec<u8> {
let result = self.inner.encode(text);
Vec::from(result.0)
}
Expand Down
2 changes: 0 additions & 2 deletions packages/canvas/src-native/canvas-native/canvas-2d/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
extern crate core;

use std::ffi::c_uint;
use std::os::raw::c_int;

use base64::Engine;
use image::EncodableLayout;
use skia_safe::image::CachingHint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jni = "0.21.0"
once_cell = "1.10.0"
ndk = { version = "0.7.0", features = ["bitmap"] }
#openssl = { version = "0.10.57", features = ["vendored"] }
libloading = "0.8.0"
libloading = "0.8.1"
log = "0.4.17"
android_logger = "0.13.1"
skia-safe = { version = "0.66.2" }
skia-safe = { version = "0.66.3" }
3 changes: 2 additions & 1 deletion packages/canvas/src-native/canvas-native/canvas-c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ canvas-core = { path = "../canvas-core", features = ["2d"] }
canvas-2d = { path = "../canvas-2d", optional = true, features = ["gl"] }
canvas-webgl = { path = "../canvas-webgl", optional = true }
parking_lot = "0.12.0"
ureq = "2.5.0"
ureq = "2.8.0"
bytes = "1.5.0"

[target.'cfg(target_os="ios")'.dependencies]
display-link = "0.2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
autogen_warning = "/* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */"
language = "C"
namespace = "ffi"
include_guard = "CBINDGEN_BINDINGS_H"

[defines]
"target_os = ios" = "TARGET_OS_IOS"
"target_os = macos" = "TARGET_OS_MACOS"
"target_os = android" = "TARGET_OS_ANDROID"
118 changes: 118 additions & 0 deletions packages/canvas/src-native/canvas-native/canvas-c/src/buffers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
use bytes::{Bytes, BytesMut};

pub struct U8BufferMut(BytesMut);

impl Default for U8BufferMut {
fn default() -> Self {
Self(BytesMut::default())
}
}

#[derive(Clone)]
pub struct U8Buffer(Bytes);

impl U8Buffer {
pub fn get_buffer(&self) -> &[u8] {
self.0.as_ref()
}
}

impl Default for U8Buffer {
fn default() -> Self {
Self(Bytes::default())
}
}

impl From<Vec<u8>> for U8Buffer {
fn from(value: Vec<u8>) -> Self {
U8Buffer(bytes::Bytes::from(value))
}
}

pub struct U16Buffer(Vec<u16>);

impl U16Buffer {
pub fn get_buffer(&self) -> &[u16] {
self.0.as_slice()
}
}

impl Default for U16Buffer {
fn default() -> Self {
Self(Vec::new())
}
}

impl From<Vec<u16>> for U16Buffer {
fn from(value: Vec<u16>) -> Self {
Self(value)
}
}

pub struct F32Buffer(Vec<f32>);

impl F32Buffer {
pub fn get_buffer(&self) -> &[f32] {
self.0.as_slice()
}
}

impl Default for F32Buffer {
fn default() -> Self {
Self(Vec::new())
}
}

impl From<Vec<f32>> for F32Buffer {
fn from(value: Vec<f32>) -> Self {
Self(value)
}
}

pub struct I32Buffer(Vec<i32>);

impl I32Buffer {
pub fn get_buffer(&self) -> &[i32] {
self.0.as_slice()
}
}

impl Default for I32Buffer {
fn default() -> Self {
Self(Vec::new())
}
}

impl From<Vec<i32>> for I32Buffer {
fn from(value: Vec<i32>) -> Self {
Self(value)
}
}

pub struct U32Buffer(Vec<u32>);

impl U32Buffer {
pub fn get_buffer(&self) -> &[u32] {
self.0.as_slice()
}
}

impl Default for U32Buffer {
fn default() -> Self {
Self(Vec::new())
}
}

impl From<Vec<u32>> for U32Buffer {
fn from(value: Vec<u32>) -> Self {
Self(value)
}
}

pub struct StringBuffer(Vec<String>);

impl From<Vec<String>> for StringBuffer {
fn from(value: Vec<String>) -> Self {
Self(value)
}
}
Loading

0 comments on commit 7f16f1c

Please sign in to comment.