diff --git a/build.rs b/build.rs index 3f1163ff..af58fdaf 100644 --- a/build.rs +++ b/build.rs @@ -45,7 +45,7 @@ fn main() { } else if !env.contains("windows") && !env.contains("wasm32") { // build scalar on non-windows and non-mac cc::Build::new() - .file("src/native/posix/scalar.cpp") + .file("src/native/posix/scalar.c") .opt_level(3) // always build with opts for scaler so it's fast in debug also .compile("libscalar.a") } diff --git a/src/native/posix/scalar.cpp b/src/native/posix/scalar.c similarity index 94% rename from src/native/posix/scalar.cpp rename to src/native/posix/scalar.c index 06845345..09368155 100644 --- a/src/native/posix/scalar.cpp +++ b/src/native/posix/scalar.c @@ -1,7 +1,6 @@ #include -#include -extern "C" void Image_resize_linear_c(uint32_t* target, const uint32_t* source, int w, int h, int s, int w2, int h2) { +void Image_resize_linear_c(uint32_t* target, const uint32_t* source, int w, int h, int s, int w2, int h2) { if (w2 <= 0) { w2 = 1; } if (h2 <= 0) { h2 = 1; } @@ -51,7 +50,7 @@ static void resize_linear_c_stride(uint32_t* target, const uint32_t* source, int } } -extern "C" void Image_resize_linear_aspect_fill_c( +void Image_resize_linear_aspect_fill_c( uint32_t* target, const uint32_t* source, int w, int h, int s, @@ -62,8 +61,8 @@ extern "C" void Image_resize_linear_aspect_fill_c( target[i] = bg_clear; } - float buffer_aspect = float(w) / float(h); - float win_aspect = float(window_width) / float(window_height); + float buffer_aspect = (float)w / (float)h; + float win_aspect = (float)window_width / (float)window_height; if (buffer_aspect > win_aspect) { int new_height = (int)(window_width / buffer_aspect); @@ -81,7 +80,7 @@ extern "C" void Image_resize_linear_aspect_fill_c( } } -extern "C" void Image_center( +void Image_center( uint32_t* target, const uint32_t* source, int w, int h, int s, @@ -155,7 +154,7 @@ extern "C" void Image_center( } } -extern "C" void Image_upper_left( +void Image_upper_left( uint32_t* target, const uint32_t* source, int w, int h, int s,