diff options
Diffstat (limited to 'thirdparty/thekla_atlas/nvimage/BitMap.cpp')
-rw-r--r-- | thirdparty/thekla_atlas/nvimage/BitMap.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/thirdparty/thekla_atlas/nvimage/BitMap.cpp b/thirdparty/thekla_atlas/nvimage/BitMap.cpp new file mode 100644 index 0000000000..8cc49644ea --- /dev/null +++ b/thirdparty/thekla_atlas/nvimage/BitMap.cpp @@ -0,0 +1,27 @@ +// This code is in the public domain -- castanyo@yahoo.es + +#include "BitMap.h" + +using namespace nv; + +void BitMap::resize(uint w, uint h, bool initValue) +{ + BitArray tmp(w*h); + + if (initValue) tmp.setAll(); + else tmp.clearAll(); + + // @@ Copying one bit at a time. This could be much faster. + for (uint y = 0; y < m_height; y++) + { + for (uint x = 0; x < m_width; x++) + { + //tmp.setBitAt(y*w + x, bitAt(x, y)); + if (bitAt(x, y) != initValue) tmp.toggleBitAt(y*w + x); + } + } + + swap(m_bitArray, tmp); + m_width = w; + m_height = h; +} |