mirror of
https://github.com/lovell/sharp.git
synced 2026-02-12 01:26:13 +01:00
Refactor conv op to use slightly safer std::vector
Inspired by similar change to recomb op in commit 60c5c50
This commit is contained in:
@@ -1606,7 +1606,7 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) {
|
||||
baton->convKernelScale = sharp::AttrAsDouble(kernel, "scale");
|
||||
baton->convKernelOffset = sharp::AttrAsDouble(kernel, "offset");
|
||||
size_t const kernelSize = static_cast<size_t>(baton->convKernelWidth * baton->convKernelHeight);
|
||||
baton->convKernel = std::unique_ptr<double[]>(new double[kernelSize]);
|
||||
baton->convKernel.resize(kernelSize);
|
||||
Napi::Array kdata = kernel.Get("kernel").As<Napi::Array>();
|
||||
for (unsigned int i = 0; i < kernelSize; i++) {
|
||||
baton->convKernel[i] = sharp::AttrAsDouble(kdata, i);
|
||||
|
||||
Reference in New Issue
Block a user