Initial changes to clean up the code.
This commit is contained in:
parent
8d3ccd935d
commit
f3f875ee80
8 changed files with 21 additions and 29 deletions
12
matrix.hpp
12
matrix.hpp
|
@ -168,6 +168,10 @@ namespace matrix {
|
|||
size_t bottom = 0;
|
||||
|
||||
box_t(MAT &mat, size_t at_x, size_t at_y, size_t size) :
|
||||
box_t(mat, at_x, at_y, size, size) {
|
||||
}
|
||||
|
||||
box_t(MAT &mat, size_t at_x, size_t at_y, size_t width, size_t height) :
|
||||
from_x(at_x), from_y(at_y)
|
||||
{
|
||||
size_t h = matrix::height(mat);
|
||||
|
@ -175,15 +179,15 @@ namespace matrix {
|
|||
|
||||
// keeps it from going below zero
|
||||
// need extra -1 to compensate for the first next()
|
||||
left = max(from_x, size) - size;
|
||||
left = max(from_x, width) - width;
|
||||
x = left - 1; // must be -1 for next()
|
||||
// keeps it from going above width
|
||||
right = min(from_x + size + 1, w);
|
||||
right = min(from_x + width + 1, w);
|
||||
|
||||
// same for these two
|
||||
top = max(from_y, size) - size;
|
||||
top = max(from_y, height) - height;
|
||||
y = top - (left == 0);
|
||||
bottom = min(from_y + size + 1, h);
|
||||
bottom = min(from_y + height + 1, h);
|
||||
}
|
||||
|
||||
bool next() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue