mirror of https://github.com/status-im/qzxing.git
optimized CameraImageWrapper::getMatrix by removing an extra (uneeded) image copy
This commit is contained in:
parent
07cc5c9c6b
commit
ea5c7c1d52
|
@ -103,10 +103,11 @@ ArrayRef<char> CameraImageWrapper::getMatrix() const
|
|||
{
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
char* matrix = new char[width*height];
|
||||
char* m = matrix;
|
||||
|
||||
ArrayRef<char> tmpRow(0);
|
||||
ArrayRef<char> arr(width*height);
|
||||
|
||||
char* m = &arr[0];
|
||||
|
||||
for(int y=0; y<height; y++)
|
||||
{
|
||||
|
@ -119,12 +120,6 @@ ArrayRef<char> CameraImageWrapper::getMatrix() const
|
|||
m += width * sizeof(unsigned char);
|
||||
}
|
||||
|
||||
ArrayRef<char> arr = ArrayRef<char>(matrix, width*height);
|
||||
|
||||
if (matrix) {
|
||||
delete matrix;
|
||||
}
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue