diff --git a/src/state.cpp b/src/state.cpp new file mode 100644 index 0000000..22f9572 --- /dev/null +++ b/src/state.cpp @@ -0,0 +1,39 @@ +/* state.cpp: + * Created: 2025-11-27 + * Author: Aryadev Chavali + * License: See end of file + * Commentary: + */ + +#include "state.hpp" +#include + +namespace cw::state +{ + void DrawState::compute_bounds() + { + bounds.leftmost = state.allocator.get_val(0); + while (bounds.leftmost.left >= 0) + bounds.leftmost = state.allocator.get_val(bounds.leftmost.left); + + bounds.rightmost = state.allocator.get_val(0); + while (bounds.rightmost.right >= 0) + bounds.rightmost = state.allocator.get_val(bounds.rightmost.right); + + bounds.lower_val = std::floorl(bounds.leftmost.value.norm); + bounds.upper_val = std::ceill(bounds.rightmost.value.norm); + } +} // namespace cw::state + +/* Copyright (C) 2025 Aryadev Chavali + + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License Version 2 for + * details. + + * You may distribute and modify this code under the terms of the GNU General + * Public License Version 2, which you should have received a copy of along with + * this program. If not, please go to . + + */