mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Fixed the double delete problem remaining in issue 503.
git-svn-id: https://zxing.googlecode.com/svn/trunk@1536 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
e68b2951f4
commit
56e9cef5b3
|
@ -48,14 +48,16 @@ unsigned char* GreyscaleLuminanceSource::getRow(int y, unsigned char* row) {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char* GreyscaleLuminanceSource::getMatrix() {
|
unsigned char* GreyscaleLuminanceSource::getMatrix() {
|
||||||
if (left_ != 0 || top_ != 0 || dataWidth_ != width_ || dataHeight_ != height_) {
|
int size = width_ * height_;
|
||||||
unsigned char* cropped = new unsigned char[width_ * height_];
|
unsigned char* result = new unsigned char[size];
|
||||||
|
if (left_ == 0 && top_ == 0 && dataWidth_ == width_ && dataHeight_ == height_) {
|
||||||
|
memcpy(result, greyData_, size);
|
||||||
|
} else {
|
||||||
for (int row = 0; row < height_; row++) {
|
for (int row = 0; row < height_; row++) {
|
||||||
memcpy(cropped + row * width_, greyData_ + (top_ + row) * dataWidth_ + left_, width_);
|
memcpy(result + row * width_, greyData_ + (top_ + row) * dataWidth_ + left_, width_);
|
||||||
}
|
}
|
||||||
return cropped;
|
|
||||||
}
|
}
|
||||||
return greyData_;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<LuminanceSource> GreyscaleLuminanceSource::rotateCounterClockwise() {
|
Ref<LuminanceSource> GreyscaleLuminanceSource::rotateCounterClockwise() {
|
||||||
|
|
Loading…
Reference in a new issue