Skip to content

Commit 246ef49

Browse files
fix: android build update
1 parent e5c36ce commit 246ef49

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

cpp/react-native-fast-opencv.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
using namespace mrousavy;
1515

1616
void OpenCVPlugin::installOpenCV(jsi::Runtime& runtime, std::shared_ptr<react::CallInvoker> callInvoker) {
17-
17+
1818
auto func = [=](jsi::Runtime& runtime,
1919
const jsi::Value& thisArg,
2020
const jsi::Value* args,
2121
size_t count) -> jsi::Value {
2222
auto plugin = std::make_shared<OpenCVPlugin>(callInvoker);
2323
auto result = jsi::Object::createFromHostObject(runtime, plugin);
24-
24+
2525
return result;
2626
};
2727

@@ -31,7 +31,7 @@ void OpenCVPlugin::installOpenCV(jsi::Runtime& runtime, std::shared_ptr<react::C
3131
func);
3232

3333
runtime.global().setProperty(runtime, "__loadOpenCV", jsiFunc);
34-
34+
3535
}
3636

3737
OpenCVPlugin::OpenCVPlugin(std::shared_ptr<react::CallInvoker> callInvoker) : _callInvoker(callInvoker) {}
@@ -44,7 +44,7 @@ jsi::Value OpenCVPlugin::get(jsi::Runtime& runtime, const jsi::PropNameID& propN
4444
runtime, jsi::PropNameID::forAscii(runtime, "frameBufferToMat"), 1,
4545
[=](jsi::Runtime& runtime, const jsi::Value& thisValue, const jsi::Value* arguments,
4646
size_t count) -> jsi::Object {
47-
47+
4848
jsi::Object input = arguments[2].asObject(runtime);
4949
TypedArrayBase inputBuffer = getTypedArray(runtime, std::move(input));
5050
auto vec = inputBuffer.toVector(runtime);
@@ -60,7 +60,7 @@ jsi::Value OpenCVPlugin::get(jsi::Runtime& runtime, const jsi::PropNameID& propN
6060
runtime, jsi::PropNameID::forAscii(runtime, "frameBufferToMat"), 1,
6161
[=](jsi::Runtime& runtime, const jsi::Value& thisValue, const jsi::Value* arguments,
6262
size_t count) -> jsi::Object {
63-
63+
6464
std::string base64 = arguments[0].asString(runtime).utf8(runtime);
6565

6666
auto mat = ImageConverter::str2mat(base64);
@@ -74,29 +74,29 @@ jsi::Value OpenCVPlugin::get(jsi::Runtime& runtime, const jsi::PropNameID& propN
7474
runtime, jsi::PropNameID::forAscii(runtime, "matToBuffer"), 1,
7575
[=](jsi::Runtime& runtime, const jsi::Value& thisValue, const jsi::Value* arguments,
7676
size_t count) -> jsi::Object {
77-
77+
7878
std::string id = FOCV_JsiObject::id_from_wrap(runtime, arguments[0]);
7979
auto mat = *FOCV_Storage::get<cv::Mat>(id);
80-
80+
8181
jsi::Object value(runtime);
82-
82+
8383
value.setProperty(runtime, "cols", jsi::Value(mat.cols));
8484
value.setProperty(runtime, "rows", jsi::Value(mat.rows));
8585
value.setProperty(runtime, "channels", jsi::Value(mat.channels()));
86-
86+
8787
auto type = arguments[1].asString(runtime).utf8(runtime);
8888
int size = mat.cols * mat.rows * mat.channels();
89-
89+
9090
if(type == "uint8") {
9191
auto arr = TypedArray<TypedArrayKind::Uint8Array>(runtime, size);
9292
arr.updateUnsafe(runtime, (uint8_t*)mat.data, size * sizeof(uint8_t));
9393
value.setProperty(runtime, "buffer", arr);
9494
} else if(type == "float32") {
9595
auto arr = TypedArray<TypedArrayKind::Float32Array>(runtime, size);
96-
arr.updateUnsafe(runtime, (float32_t*)mat.data, size * sizeof(float32_t));
96+
arr.updateUnsafe(runtime, (float*)mat.data, size * sizeof(float));
9797
value.setProperty(runtime, "buffer", arr);
9898
}
99-
99+
100100
return value;
101101
});
102102
} else if (propName == "createObject") {
@@ -139,7 +139,7 @@ jsi::Value OpenCVPlugin::get(jsi::Runtime& runtime, const jsi::PropNameID& propN
139139
runtime, jsi::PropNameID::forAscii(runtime, "clearBuffers"), 1,
140140
[=](jsi::Runtime& runtime, const jsi::Value& thisValue, const jsi::Value* arguments,
141141
size_t count) -> jsi::Value {
142-
142+
143143
FOCV_Storage::clear();
144144
return true;
145145
});

0 commit comments

Comments
 (0)