summaryrefslogtreecommitdiffstats
path: root/chalk/core/kis_random_accessor.cpp
blob: cfa8ecabe99dd0e2b7909f56a45eb7a59dad54ac (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * This file is part of the Chalk project
 *
 *  Copyright (c) 2006 Cyrille Berger <[email protected]>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; version 2 of the License.
 *
 *  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 for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include "kis_random_accessor.h"

#include "kis_tiled_random_accessor.h"

KisRandomAccessor::KisRandomAccessor(KisTiledDataManager *ktm, TQ_INT32 x, TQ_INT32 y, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable) : m_offsetx(offsetx), m_offsety(offsety)
{
    m_accessor = new KisTiledRandomAccessor(ktm, x, y, writable);
}

KisRandomAccessor::KisRandomAccessor(const KisRandomAccessor& rhs) {
    m_accessor = rhs.m_accessor;
}

KisRandomAccessor::~KisRandomAccessor()
{
    
}

void KisRandomAccessor::moveTo(TQ_INT32 x, TQ_INT32 y)
{
    m_accessor->moveTo(x - m_offsetx, y  - m_offsety);
}

TQ_UINT8* KisRandomAccessor::rawData() const
{
    return m_accessor->rawData();
}

const TQ_UINT8* KisRandomAccessor::oldRawData() const
{
    return m_accessor->oldRawData();
}

KisRandomAccessorPixel::KisRandomAccessorPixel(KisTiledDataManager *ktm, KisTiledDataManager *ktmselect, TQ_INT32 x, TQ_INT32 y, TQ_INT32 offsetx, TQ_INT32 offsety, bool writable) :
        KisRandomAccessor( ktm, x, y, offsetx, offsety, writable),
        KisRandomAccessorPixelTrait( this, (ktmselect) ? new KisRandomAccessor(ktm, x, y, offsetx, offsety, false) : 0 )
{
    
}