[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita/core
From: Cyrille Berger <cyb () lepi ! org>
Date: 2006-02-01 1:23:51
Message-ID: 1138757031.077311.26875.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 504428 by berger:
* add nextRow/nextCol in KisH/VLineIterators
* make use of them in convolution (only for REPEAT yet) for an other 25% speed \
improvement :)
M +14 -11 kis_convolution_painter.cc
M +2 -0 kis_iterator.cc
M +10 -4 kis_iterator.h
M +2 -0 tiles/Makefile.am
M +21 -0 tiles/kis_tiledhlineiterator.cc
M +12 -7 tiles/kis_tilediterator.h
M +22 -0 tiles/kis_tiledvlineiterator.cc
--- trunk/koffice/krita/core/kis_convolution_painter.cc #504427:504428
@@ -246,6 +246,18 @@
KisHLineIteratorPixel hit = m_device -> createHLineIterator(x, row, w, \
true); bool needFull = true;
+
+ Q_INT32 itStart = row - khalfHeight;
+ Q_INT32 itH = kh;
+ if(itStart < 0)
+ {
+ itH += itStart;
+ itStart = 0;
+ } else if(itStart + kh > heightMinuskhh)
+ {
+ itH -= itStart + kh - heightMinuskhh;
+ }
+ KisVLineIteratorPixel kit = m_device -> createVLineIterator(col + \
khalfWidth, itStart, itH, false); while (!hit.isDone()) {
if (hit.isSelected()) {
@@ -334,17 +346,8 @@
if(col < widthMinuskhw)
{
Q_INT32 i = kw - 1;
- Q_INT32 itStart = row - khalfHeight;
- Q_INT32 itH = kh;
- if(itStart < 0)
- {
- itH += itStart;
- itStart = 0;
- } else if(itStart + kh > heightMinuskhh)
- {
- itH -= itStart + kh - heightMinuskhh;
- }
- KisVLineIteratorPixel kit = m_device -> \
createVLineIterator(col + khalfWidth, itStart, itH, false); +// \
KisVLineIteratorPixel kit = m_device -> createVLineIterator(col + khalfWidth, \
itStart, itH, false); + kit.nextCol();
if( row < khalfHeight )
{
for(; i < (khalfHeight- row ) * kw; i+=kw)
--- trunk/koffice/krita/core/kis_iterator.cc #504427:504428
@@ -104,6 +104,7 @@
Q_INT32 KisHLineIterator::y() const { return m_iter->y(); }
+void KisHLineIterator::nextRow() { m_iter->nextRow(); }
//---------------------------------------------------------------------------------------
@@ -139,3 +140,4 @@
Q_INT32 KisVLineIterator::y() const { return m_iter->y(); }
+void KisVLineIterator::nextCol() { return m_iter->nextCol(); }
--- trunk/koffice/krita/core/kis_iterator.h #504427:504428
@@ -117,13 +117,16 @@
/// returns true when iterators has reached the end
bool isDone() const;
- // current x position
+ /// current x position
Q_INT32 x() const;
- // current y position
+ /// current y position
Q_INT32 y() const;
+ /// increment to the next row and rewind to the begining
+ void nextRow();
+
private:
KisTiledHLineIteratorSP m_iter;
@@ -152,11 +155,14 @@
/// returns true when iterators has reached the end
bool isDone() const;
- // current x position
+ /// current x position
Q_INT32 x() const;
- // current y position
+ /// current y position
Q_INT32 y() const;
+
+ /// increment to the next column and rewind to the begining
+ void nextCol();
private:
--- trunk/koffice/krita/core/tiles/Makefile.am #504427:504428
@@ -15,3 +15,5 @@
libkritatile_la_SOURCES = kis_tiledvlineiterator.cc kis_tiledhlineiterator.cc \
kis_tileddatamanager.cc kis_tile.cc kis_tilediterator.cc kis_tiledrectiterator.cc \
kis_memento.cc kis_tilemanager.cc libkritatile_la_METASOURCES = AUTO
+include_HEADERS = \
+ kis_tileddatamanager.h
--- trunk/koffice/krita/core/tiles/kis_tiledhlineiterator.cc #504427:504428
@@ -187,3 +187,24 @@
return *this;
}
+
+void KisTiledHLineIterator::nextRow()
+{
+ m_y++;
+ m_yInTile++;
+ Q_INT32 newCol = xToCol(m_left);
+ m_x = m_left;
+ m_leftInTile = m_x - m_leftCol * KisTile::WIDTH;
+ m_xInTile = m_leftInTile;
+ if( m_yInTile >= KisTile::HEIGHT )
+ { // Need a new row
+ m_yInTile = 0;
+ m_row++;
+ m_col = newCol;
+ fetchTileData(m_col, m_row);
+ } else if( newCol != m_col ) {
+ m_col = newCol;
+ fetchTileData(m_col, m_row);
+ }
+ m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+}
--- trunk/koffice/krita/core/tiles/kis_tilediterator.h #504427:504428
@@ -150,6 +150,8 @@
/// returns true when the iterator has reached the end
bool isDone() const { return m_x > m_right; }
+ /// increment to the next row and rewind to the begining
+ void nextRow();
protected:
Q_INT32 m_right;
@@ -190,15 +192,18 @@
/// returns true when the iterator has reached the end
bool isDone() const { return m_y > m_bottom; }
+ /// increment to the next column and rewind to the begining
+ void nextCol();
protected:
- Q_INT32 m_bottom;
- Q_INT32 m_topRow;
- Q_INT32 m_bottomRow;
- Q_INT32 m_xInTile;
- Q_INT32 m_yInTile;
- Q_INT32 m_topInTile;
- Q_INT32 m_bottomInTile;
+ Q_INT32 m_top;
+ Q_INT32 m_bottom;
+ Q_INT32 m_topRow;
+ Q_INT32 m_bottomRow;
+ Q_INT32 m_xInTile;
+ Q_INT32 m_yInTile;
+ Q_INT32 m_topInTile;
+ Q_INT32 m_bottomInTile;
private:
void nextTile();
--- trunk/koffice/krita/core/tiles/kis_tiledvlineiterator.cc #504427:504428
@@ -27,6 +27,7 @@
m_bottom(y + h - 1)
{
m_writable = writable;
+ m_top = y;
m_x = x;
m_y = y;
@@ -118,6 +119,27 @@
}
}
+void KisTiledVLineIterator::nextCol()
+{
+ m_x++;
+ m_xInTile++;
+ Q_INT32 newRow = yToRow(m_top);
+ 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 = newRow;
+ fetchTileData(m_col, m_row);
+ } else if( newRow != m_row ) {
+ m_row = newRow;
+ fetchTileData(m_col, m_row);
+ }
+ m_offset = m_pixelSize * (m_yInTile * KisTile::WIDTH + m_xInTile);
+}
+
/*
KisTiledVLineIterator & KisTiledVLineIterator::operator -- ()
{
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic