Skip to content

Commit

Permalink
chore: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
triniwiz committed Aug 16, 2024
2 parents 44bfb6b + 99f8ab8 commit 6a0969c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ canvas-c = { path = "./crates/canvas-c" }
skia-safe = { version = "0.73.0", features = ["textlayout"] }
itertools = "0.13.0"
wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "c72bc7b84b094f70cc47dd8a1aa8175e3f3dc5b6", features = ["wgsl", "vulkan", "metal", "raw-window-handle"] }
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "c72bc7b84b094f70cc47dd8a1aa8175e3f3dc5b6" }
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "c72bc7b84b094f70cc47dd8a1aa8175e3f3dc5b6" }
41 changes: 20 additions & 21 deletions crates/canvas-android/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ extern crate log;
use std::os::raw::c_void;
use std::sync::OnceLock;

use ::jni::JavaVM;
use ::jni::signature::JavaType;
use ::jni::sys::jint;
use ::jni::JavaVM;
use android_logger::Config;
use itertools::izip;
use jni::NativeMethod;
use jni::sys::jlong;
use jni::{ NativeMethod};
use log::LevelFilter;

use crate::jni_compat::org_nativescript_canvas_NSCCanvas::{nativeContext2DPathTest, nativeContext2DPathTestNormal, nativeContext2DRender, nativeContext2DTest, nativeContext2DTestNormal, nativeCreate2DContext, nativeCreate2DContextNormal, nativeCustomWithBitmapFlush, nativeGetGLPointer, nativeGetGLPointerNormal, nativeGLPointerRefCount, nativeGLPointerRefCountNormal, nativeInitGL, nativeInitGLNoSurface, nativeInitWebGPU, nativeMakeGLCurrent, nativeMakeGLCurrentNormal, nativeReleaseGL, nativeReleaseGLNormal, nativeReleaseGLPointer, nativeReleaseGLPointerNormal, nativeUpdate2DSurface, nativeUpdate2DSurfaceNoSurface, nativeUpdate2DSurfaceNoSurfaceNormal, nativeUpdateGLNoSurface, nativeUpdateGLNoSurfaceNormal, nativeUpdateGLSurface, nativeWebGLC2DRender, nativeWriteCurrentGLContextToBitmap};
Expand All @@ -30,8 +31,6 @@ use crate::utils::{
nativeInitContextWithCustomSurface, nativeInitContextWithCustomSurfaceNormal,
nativeResizeCustomSurface, nativeResizeCustomSurfaceNormal,
};
use crate::utils::gl::st::{SURFACE_TEXTURE, SurfaceTexture};
use crate::utils::gl::texture_render::nativeDrawFrame;

mod jni_compat;
pub mod utils;
Expand Down Expand Up @@ -281,12 +280,12 @@ pub extern "system" fn JNI_OnLoad(vm: JavaVM, _reserved: *const c_void) -> jint
canvas_rendering_context_2d_signatures,
canvas_rendering_context_2d_methods
)
.map(|(name, signature, method)| NativeMethod {
name: name.into(),
sig: signature.into(),
fn_ptr: method,
})
.collect();
.map(|(name, signature, method)| NativeMethod {
name: name.into(),
sig: signature.into(),
fn_ptr: method,
})
.collect();

let _ = env.register_native_methods(
&canvas_rendering_context_2d_class,
Expand Down Expand Up @@ -352,12 +351,12 @@ pub extern "system" fn JNI_OnLoad(vm: JavaVM, _reserved: *const c_void) -> jint
image_asset_signatures,
image_asset_methods
)
.map(|(name, signature, method)| NativeMethod {
name: name.into(),
sig: signature.into(),
fn_ptr: method,
})
.collect();
.map(|(name, signature, method)| NativeMethod {
name: name.into(),
sig: signature.into(),
fn_ptr: method,
})
.collect();

let _ = env
.register_native_methods(&image_asset_class, image_asset_native_methods.as_slice());
Expand Down Expand Up @@ -390,12 +389,12 @@ pub extern "system" fn JNI_OnLoad(vm: JavaVM, _reserved: *const c_void) -> jint
webgl_rendering_signatures,
webgl_rendering_methods
)
.map(|(name, signature, method)| NativeMethod {
name: name.into(),
sig: signature.into(),
fn_ptr: method,
})
.collect();
.map(|(name, signature, method)| NativeMethod {
name: name.into(),
sig: signature.into(),
fn_ptr: method,
})
.collect();

let _ = env.register_native_methods(
&webgl_rendering_class,
Expand Down
1 change: 1 addition & 0 deletions crates/canvas-c/src/webgpu/gpu_buffer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::sync::Arc;
use std::{
borrow::Cow,
ffi::CString,
Expand Down
1 change: 0 additions & 1 deletion crates/canvas-c/src/webgpu/gpu_device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ impl CanvasGPUDevice {
.iter()
.map(|entry| (*entry).into())
.collect::<Vec<_>>();

let desc = wgpu_core::binding_model::BindGroupLayoutDescriptor {
label: label.clone(),
entries: Cow::from(entries),
Expand Down
9 changes: 3 additions & 6 deletions packages/canvas/Canvas/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,9 @@ export class Canvas extends CanvasBase {
this._canvas = new org.nativescript.canvas.NSCCanvas(activity);
}

// const view = this._canvas.getChildAt(0) as android.view.TextureView;
// view.setOpaque(true);

// default canvas size
this._canvas.setSurfaceWidth(300);
this._canvas.setSurfaceHeight(150);
// // default canvas size
// this._canvas.setSurfaceWidth(300);
// this._canvas.setSurfaceHeight(150);

(global as any).__canvasLoaded = true;
const ref = new WeakRef(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>CanvasNative.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>CanvasNative.framework/CanvasNative</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>CanvasNative.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>CanvasNative.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>CanvasNative.framework/CanvasNative</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>CanvasNative.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down

0 comments on commit 6a0969c

Please sign in to comment.