Skip to content

Commit

Permalink
Merge pull request #442 from ericblade/dev
Browse files Browse the repository at this point in the history
update node test version, fix #439, #440
  • Loading branch information
ericblade authored Sep 10, 2022
2 parents 59b79b5 + 564b69e commit bc6fedc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 0 additions & 5 deletions src/common/image_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ class ImageWrapper implements SparseImageWrapper {
// tests if a position is within the image, extended out by a border on each side
inImageWithBorder(imgRef: XYSize, border: PositiveNumber = 0): boolean {
assertNumberPositive(border);
// TODO: code_128 starts failing miserably when i only allow imgRef to contain positive numbers.
// TODO: this doesn't make much sense to me, why does it go negative? Tests are not affected by
// returning false, but the whole code_128 reader blows up when i throw on negative imgRef.
// assertNumberPositive(imgRef.x);
// assertNumberPositive(imgRef.y);
return (imgRef.x >= 0)
&& (imgRef.y >= 0)
&& (imgRef.x < (this.size.x + (border * 2)))
Expand Down
7 changes: 5 additions & 2 deletions src/locator/tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const Tracer = {
let y;
let x;

for (i = 0; i < 7; i++) {
for (i = 0; i < searchDirections.length; i++) {
y = current.cy + searchDirections[current.dir][0];
x = current.cx + searchDirections[current.dir][1];
pos = y * width + x;
Expand Down Expand Up @@ -63,6 +63,9 @@ const Tracer = {
Cv.next = P;
P.next = null;
Cv = P;

let totalPixelCount = imageWrapper.size.x * imageWrapper.size.y;
let pixelCounter = 0;
do {
current.dir = (current.dir + 6) % 8;
trace(current, color, label, edgelabel);
Expand All @@ -79,7 +82,7 @@ const Tracer = {
Cv.y = current.cy;
}
ldir = current.dir;
} while (current.cx !== sx || current.cy !== sy);
} while ((current.cx !== sx || current.cy !== sy) && ++pixelCounter < totalPixelCount);
Fv.prev = Cv.prev;
Cv.prev.next = Fv;
}
Expand Down

0 comments on commit bc6fedc

Please sign in to comment.