From 858b7fb0e3b0747d095c3e2319ab67097cfc8afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Wed, 30 Oct 2013 01:56:34 +0100 Subject: [PATCH] 2013-10-30 01:56 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/gtqtc/gtqtc.h * contrib/gtqtc/gtqtc1.cpp % removed redundant rect() usage ! force internal image repainting when font size is changed --- ChangeLog.txt | 6 ++++++ contrib/gtqtc/gtqtc.h | 1 + contrib/gtqtc/gtqtc1.cpp | 16 +++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index fc5d74f369..b9d0f01d9c 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,12 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-10-30 01:56 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/gtqtc/gtqtc.h + * contrib/gtqtc/gtqtc1.cpp + % removed redundant rect() usage + ! force internal image repainting when font size is changed + 2013-10-30 01:15 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/gtqtc/gtqtc1.cpp % small simplification: use set{Max,Min}imumSize() diff --git a/contrib/gtqtc/gtqtc.h b/contrib/gtqtc/gtqtc.h index 9d00702213..21f9ed4972 100644 --- a/contrib/gtqtc/gtqtc.h +++ b/contrib/gtqtc/gtqtc.h @@ -329,6 +329,7 @@ typedef struct HB_BOOL fMaximized; /* enter/leave mximize mode */ HB_BOOL fFullScreen; /* enable/disable fullscreen mode */ HB_BOOL fSelectCopy; /* allow marking texts by mouse left button with shift */ + HB_BOOL fRepaint; /* force internal image repainting */ int iResizeMode; /* Sets the resizing mode either to FONT or ROWS */ } diff --git a/contrib/gtqtc/gtqtc1.cpp b/contrib/gtqtc/gtqtc1.cpp index 766bd210cf..f467f52902 100644 --- a/contrib/gtqtc/gtqtc1.cpp +++ b/contrib/gtqtc/gtqtc1.cpp @@ -1372,6 +1372,7 @@ static PHB_GTQTC hb_gt_qtc_new( PHB_GT pGT ) pQTC->fMaximized = HB_FALSE; pQTC->fFullScreen = HB_FALSE; pQTC->fSelectCopy = HB_FALSE; + pQTC->fRepaint = HB_TRUE; { PHB_ITEM pItem = hb_itemPutCPtr( NULL, hb_cmdargBaseProgName() ); @@ -2559,10 +2560,14 @@ void QTConsole::setFontSize( int iFH, int iFW ) pQTC->fontWidth = iWidth; pQTC->fontAscent = iAscent; + pQTC->fRepaint = pQTC->cellX != pQTC->fontWidth || + pQTC->cellY != pQTC->fontHeight; + pQTC->cellX = pQTC->fontWidth; pQTC->cellY = pQTC->fontHeight; - hb_gt_qtc_resetBoxCharBitmaps( pQTC ); + if( pQTC->fRepaint ) + hb_gt_qtc_resetBoxCharBitmaps( pQTC ); setImageSize(); } @@ -2575,8 +2580,13 @@ void QTConsole::setImageSize( void ) { delete image; image = new QImage( iWidth, iHeight, QImage::Format_RGB32 ); + pQTC->fRepaint = HB_TRUE; + } + if( pQTC->fRepaint ) + { image->fill( BLACK ); repaintChars( image->rect() ); + pQTC->fRepaint = HB_FALSE; } } @@ -3431,13 +3441,13 @@ void QTCWindow::setWindowSize( void ) { if( ( windowState() & ( Qt::WindowMaximized | Qt::WindowFullScreen ) ) != 0 ) { - qConsole->pQTC->marginLeft = rect().width() - qConsole->image->width(); + qConsole->pQTC->marginLeft = width() - qConsole->image->width(); if( qConsole->pQTC->marginLeft > 0 ) qConsole->pQTC->marginLeft >>= 1; else qConsole->pQTC->marginLeft = 0; - qConsole->pQTC->marginTop = rect().height() - qConsole->image->height(); + qConsole->pQTC->marginTop = height() - qConsole->image->height(); if( qConsole->pQTC->marginTop > 0 ) qConsole->pQTC->marginTop >>= 1; else