WebImage.cc 1.16 KB
Newer Older
1 2 3 4
#include "WebImage.h"

WebImage::WebImage()
    : state(WebImage::UNINITIALIZED)
5 6
    , sourceURL("")
    , image(new QImage)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    , lastReference(0)
    , syncFlag(false)
{

}

void
WebImage::clear(void)
{
    image.clear();
    sourceURL.clear();
    state = WebImage::UNINITIALIZED;
    lastReference = 0;
}

WebImage::State
WebImage::getState(void) const
{
    return state;
}

void
WebImage::setState(State state)
{
    this->state = state;
}

34
const QString&
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
WebImage::getSourceURL(void) const
{
    return sourceURL;
}

void
WebImage::setSourceURL(const QString& url)
{
    sourceURL = url;
}

const uint8_t*
WebImage::getData(void) const
{
    return image->bits();
}

52 53 54 55 56 57
void
WebImage::setData(const QByteArray& data)
{
    image->loadFromData(data);
}

58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
int32_t
WebImage::getWidth(void) const
{
    return image->width();
}

int32_t
WebImage::getHeight(void) const
{
    return image->height();
}

uint64_t
WebImage::getLastReference(void) const
{
    return lastReference;
}

void
WebImage::setLastReference(uint64_t value)
{
    lastReference = value;
}

bool
WebImage::getSyncFlag(void) const
{
    return syncFlag;
}

void
WebImage::setSyncFlag(bool onoff)
{
    syncFlag = onoff;
}