Diffstat (limited to 'noncore/apps/opie-console/screen.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/screen.cpp | 22 |
1 files changed, 12 insertions, 10 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 @@ -69,5 +69,5 @@ Screen::Screen(int lines, int columns) this->columns = columns; - image = (Character*) malloc(lines*columns*sizeof(Character)); + image = QArray<Character>( lines*columns ); tabstops = NULL; initTabStops(); @@ -83,5 +83,5 @@ Screen::Screen(int lines, int columns) Screen::~Screen() { - free(image); + delete image; if (tabstops) free(tabstops); } @@ -395,5 +395,5 @@ 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(); @@ -419,5 +419,5 @@ void Screen::resizeImage(int new_lines, int new_columns) newimg[y*new_columns+x].r = image[loc(x,y)].r; } - free(image); + delete image; image = newimg; lines = new_lines; @@ -467,5 +467,5 @@ void Screen::resizeImage(int new_lines, int new_columns) */ -void Screen::reverseRendition(Character* p) +void Screen::reverseRendition(Character *p) { UINT8 f = p->f; UINT8 b = p->b; p->f = b; p->b = f; //p->r &= ~RE_TRANSPARENT; @@ -505,7 +505,7 @@ void Screen::effectiveRendition() */ -Character* Screen::getCookedImage() +QArray<Character> Screen::getCookedImage() { int x,y; - Character* merged = (Character*) malloc(lines*columns*sizeof(Character)); + Character* merged = (Character*) malloc( lines * columns * sizeof( Character ) ); Character dft(' ',DEFAULT_FORE_COLOR,DEFAULT_BACK_COLOR,DEFAULT_RENDITION); @@ -516,5 +516,5 @@ Character* Screen::getCookedImage() int yq = (y+histCursor)*columns; - hist.getCells(y+histCursor,0,len,merged+yp); + hist.getCells( y+histCursor, 0, len, merged+yp ); for (x = len; x < columns; x++) merged[yp+x] = dft; for (x = 0; x < columns; x++) @@ -548,5 +548,7 @@ Character* Screen::getCookedImage() 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; } @@ -1160,5 +1162,5 @@ void Screen::addHistLine() end -= 1; - hist.addCells(image,end+1); + hist.addCells(image.data(), end+1); hist.addLine(); |