summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/screen.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/screen.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/screen.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/noncore/apps/opie-console/screen.cpp b/noncore/apps/opie-console/screen.cpp
index 8ebc47d..a796ba1 100644
--- a/noncore/apps/opie-console/screen.cpp
+++ b/noncore/apps/opie-console/screen.cpp
@@ -67,9 +67,9 @@ Screen::Screen(int lines, int columns)
{
this->lines = lines;
this->columns = columns;
- image = (Character*) malloc(lines*columns*sizeof(Character));
+ image = QArray<Character>( lines*columns );
tabstops = NULL; initTabStops();
histCursor = 0;
@@ -81,9 +81,9 @@ Screen::Screen(int lines, int columns)
*/
Screen::~Screen()
{
- free(image);
+ delete image;
if (tabstops) free(tabstops);
}
/* ------------------------------------------------------------------------- */
@@ -393,9 +393,9 @@ void Screen::resizeImage(int new_lines, int new_columns)
}
}
// make new image
- Character* newimg = (Character*) malloc(new_lines*new_columns*sizeof(Character));
+ QArray<Character> newimg = QArray<Character>( new_lines * new_columns );
clearSelection();
// clear new image
@@ -417,9 +417,9 @@ void Screen::resizeImage(int new_lines, int new_columns)
newimg[y*new_columns+x].f = image[loc(x,y)].f;
newimg[y*new_columns+x].b = image[loc(x,y)].b;
newimg[y*new_columns+x].r = image[loc(x,y)].r;
}
- free(image);
+ delete image;
image = newimg;
lines = new_lines;
columns = new_columns;
cuX = QMIN(cuX,columns-1);
@@ -503,9 +503,9 @@ void Screen::effectiveRendition()
freed.
*/
-Character* Screen::getCookedImage()
+QArray<Character> Screen::getCookedImage()
{ int x,y;
Character* merged = (Character*) malloc(lines*columns*sizeof(Character));
Character dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION);
@@ -546,9 +546,11 @@ Character* Screen::getCookedImage()
reverseRendition(&merged[i]); // for reverse display
}
if (getMode(MODE_Cursor) && (cuY+(hist.getLines()-histCursor) < lines)) // cursor visible
reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]);
- return merged;
+ QArray<Character> res( sizeof( merged ) / sizeof( Character ) );
+ res.assign( merged, sizeof( merged ) / sizeof( Character ) );
+ return res;
}
/*!
@@ -1158,9 +1160,9 @@ void Screen::addHistLine()
int end = columns-1;
while (end >= 0 && image[end] == dft)
end -= 1;
- hist.addCells(image,end+1);
+ hist.addCells(image.data(), end+1);
hist.addLine();
// adjust history cursor
histCursor += (hist.getLines()-1 == histCursor);