summaryrefslogtreecommitdiff
path: root/thirdparty/thekla_atlas/nvimage/BitMap.cpp
blob: 8cc49644ea1c83f67c9b672d283c288eaae37213 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
}