summaryrefslogtreecommitdiffstats
path: root/chalk/core/tiles/kis_tiledvlineiterator.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-05-23 20:48:35 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-05-29 15:17:38 +0900
commitd63c9d696eb6e2539528b99afc21f4086c9defe3 (patch)
treeb3bfc97a66431a12cdd8f9379c0072673ede43df /chalk/core/tiles/kis_tiledvlineiterator.cpp
parent5363fe3c36504c37bdc6dcfafd5f71daeae251e8 (diff)
downloadkoffice-d63c9d69.tar.gz
koffice-d63c9d69.zip
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit 8b78a8791bc539bcffe7159f9d9714d577cb3d7d)
Diffstat (limited to 'chalk/core/tiles/kis_tiledvlineiterator.cpp')
-rw-r--r--chalk/core/tiles/kis_tiledvlineiterator.cpp154
1 files changed, 154 insertions, 0 deletions
diff --git a/chalk/core/tiles/kis_tiledvlineiterator.cpp b/chalk/core/tiles/kis_tiledvlineiterator.cpp
new file mode 100644
index 000000000..0fe8514f8
--- /dev/null
+++ b/chalk/core/tiles/kis_tiledvlineiterator.cpp
@@ -0,0 +1,154 @@
+/*
+ * This file is part of the Chalk
+ *
+ * Copyright (c) 2004 Casper Boemann <cbr@boemann.dk>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 <kdebug.h>
+
+#include "kis_tile_global.h"
+#include "kis_tilediterator.h"
+
+KisTiledVLineIterator::KisTiledVLineIterator( KisTiledDataManager *ndevice, TQ_INT32 x, TQ_INT32 y, TQ_INT32 h, bool writable) :
+ KisTiledIterator(ndevice),
+ m_bottom(y + h - 1)
+{
+ m_writable = writable;
+ m_top = y;
+ m_x = x;
+ m_y = y;
+
+ // Find tile row,col matching x,y
+ m_col = xToCol(m_x);
+ m_topRow = yToRow(m_y);
+ m_bottomRow = yToRow(m_bottom);
+ m_row = m_topRow;
+
+ // calc limits within the tile
+ m_xInTile = m_x - m_col * KisTile::WIDTH;
+ m_topInTile = m_y - m_topRow * KisTile::HEIGHT;
+
+ if(m_row == m_bottomRow)
+ m_bottomInTile = m_bottom - m_bottomRow * KisTile::HEIGHT;
+ else
+ m_bottomInTile = KisTile::HEIGHT - 1;
+
+ m_yInTile = m_topInTile;
+
+ fetchTileData(m_col, m_row);
+ m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+}
+
+KisTiledVLineIterator::KisTiledVLineIterator(const KisTiledVLineIterator& rhs)
+ : KisTiledIterator(rhs)
+{
+ if (this != &rhs) {
+ m_top = rhs.m_top;
+ m_bottom = rhs.m_bottom;
+ m_topRow = rhs.m_topRow;
+ m_bottomRow = rhs.m_bottomRow;
+ m_xInTile = rhs.m_xInTile;
+ m_yInTile = rhs.m_yInTile;
+ m_topInTile = rhs.m_topInTile;
+ m_bottomInTile = rhs.m_bottomInTile;
+ }
+}
+
+KisTiledVLineIterator& KisTiledVLineIterator::operator=(const KisTiledVLineIterator& rhs)
+{
+ if (this != &rhs) {
+ KisTiledIterator::operator=(rhs);
+
+ m_top = rhs.m_top;
+ m_bottom = rhs.m_bottom;
+ m_topRow = rhs.m_topRow;
+ m_bottomRow = rhs.m_bottomRow;
+ m_xInTile = rhs.m_xInTile;
+ m_yInTile = rhs.m_yInTile;
+ m_topInTile = rhs.m_topInTile;
+ m_bottomInTile = rhs.m_bottomInTile;
+ }
+ return *this;
+}
+
+KisTiledVLineIterator::~KisTiledVLineIterator( )
+{
+}
+
+KisTiledVLineIterator & KisTiledVLineIterator::operator ++ ()
+{
+ if(m_yInTile >= m_bottomInTile)
+ {
+ nextTile();
+ fetchTileData(m_col, m_row);
+ m_yInTile =m_topInTile;
+ m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+ }
+ else
+ {
+ m_yInTile++;
+ m_offset += m_pixelSize * KisTile::WIDTH;
+ }
+ m_y++;
+
+ return *this;
+}
+
+void KisTiledVLineIterator::nextTile()
+{
+ if(m_row < m_bottomRow)
+ {
+ m_row++;
+ m_topInTile = 0;
+
+ if(m_row == m_bottomRow)
+ m_bottomInTile = m_bottom - m_bottomRow * KisTile::HEIGHT;
+ else
+ m_bottomInTile = KisTile::HEIGHT - 1;
+ }
+}
+
+void KisTiledVLineIterator::nextCol()
+{
+ m_x++;
+ m_xInTile++;
+ m_y = m_top;
+ m_topInTile = m_y - m_topRow * KisTile::HEIGHT;
+ m_yInTile = m_topInTile;
+ if( m_xInTile >= KisTile::WIDTH )
+ { // Need a new row
+ m_xInTile = 0;
+ m_col++;
+ m_row = m_topRow;
+ fetchTileData(m_col, m_row);
+ } else if( m_topRow != m_row ) {
+ m_row = m_topRow;
+ fetchTileData(m_col, m_row);
+ }
+ if(m_row == m_bottomRow)
+ m_bottomInTile = m_bottom - m_bottomRow * KisTile::HEIGHT;
+ else
+ m_bottomInTile = KisTile::HEIGHT - 1;
+
+ m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+}
+
+/*
+KisTiledVLineIterator & KisTiledVLineIterator::operator -- ()
+{
+ return *this;
+}
+*/