2014-10-04 21:25 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/gtqtc/gtqtc1.cpp
    + added support for decoded image data passed to HB_GTI_DISPIMAGE like
      in GTXWC. Supported formats are RGB32, RGB16 and MONO bitmap.
      Unlike GTXWC GTQTC rescales bitmap to passed cords.

  * src/rdd/wafunc.c
    ! fixed very bad bug introduced in previous modification - in fact
      potential problem existed from the beginning anyhow recent modification
      allow to exploit it in all complex index expressions.
This commit is contained in:
Przemysław Czerpak
2014-10-04 21:25:28 +02:00
parent 4dfd5150a3
commit 748cd589e1
3 changed files with 103 additions and 13 deletions

View File

@@ -10,6 +10,17 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2014-10-04 21:25 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/gtqtc/gtqtc1.cpp
+ added support for decoded image data passed to HB_GTI_DISPIMAGE like
in GTXWC. Supported formats are RGB32, RGB16 and MONO bitmap.
Unlike GTXWC GTQTC rescales bitmap to passed cords.
* src/rdd/wafunc.c
! fixed very bad bug introduced in previous modification - in fact
potential problem existed from the beginning anyhow recent modification
allow to exploit it in all complex index expressions.
2014-10-03 19:06 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rtl/gtxwc/gtxwc.c
! fixed typo reported by Rolf

View File

@@ -2251,12 +2251,77 @@ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
break;
case HB_GTI_DISPIMAGE:
if( pInfo->pNewVal && HB_IS_STRING( pInfo->pNewVal ) && pQTC->qWnd )
if( pQTC->qWnd &&
( hb_itemType( pInfo->pNewVal ) & ( HB_IT_STRING | HB_IT_ARRAY ) ) )
{
QImage qImg = QImage();
/* filename or resource */
if( HB_IS_STRING( pInfo->pNewVal ) )
{
QString qStr;
hb_gt_qtc_itemGetQString( pInfo->pNewVal, &qStr );
qImg = QImage( qStr );
}
else if( hb_arrayLen( pInfo->pNewVal ) ==
( hb_arrayGetType( pInfo->pNewVal, 4 ) & HB_IT_NUMERIC ? 4 : 3 ) &&
( hb_arrayGetType( pInfo->pNewVal, 1 ) & ( HB_IT_POINTER | HB_IT_STRING ) ) &&
( hb_arrayGetType( pInfo->pNewVal, 2 ) & HB_IT_NUMERIC ) &&
( hb_arrayGetType( pInfo->pNewVal, 3 ) & HB_IT_NUMERIC ) )
{
HB_SIZE nSize = hb_arrayGetCLen( pInfo->pNewVal, 1 );
int iWidth = hb_arrayGetNI( pInfo->pNewVal, 2 );
int iHeight = hb_arrayGetNI( pInfo->pNewVal, 3 );
int iDepth = hb_arrayGetNI( pInfo->pNewVal, 4 );
int iPitch = 0;
const uchar * data = NULL;
QImage::Format format;
switch( iDepth )
{
case 0:
iDepth = 32;
case 32:
format = QImage::Format_RGB32;
break;
case 16:
format = QImage::Format_RGB16;
break;
case 1:
format = QImage::Format_Mono;
break;
default:
format = QImage::Format_Invalid;
break;
}
if( format != QImage::Format_Invalid && iWidth > 0 && iHeight > 0 )
{
if( nSize > 0 )
{
int iPad = 32;
while( data == NULL && iPad >= 8 )
{
iPitch = ( iWidth * iDepth + iPad - 1 ) / iPad;
if( nSize == ( HB_SIZE ) ( iHeight * iPitch ) )
data = ( const uchar * ) hb_arrayGetCPtr( pInfo->pNewVal, 1 );
else
iPad >>= 1;
}
}
else
data = ( const uchar * ) hb_arrayGetPtr( pInfo->pNewVal, 1 );
}
if( data != NULL )
{
if( iPitch == 0 )
qImg = QImage( data, iWidth, iHeight, QImage::Format_RGB32 );
else
qImg = QImage( data, iWidth, iHeight, iPitch, QImage::Format_RGB32 );
}
}
QRect rx = pQTC->qWnd->qConsole->image->rect();
QString qStr;
hb_gt_qtc_itemGetQString( pInfo->pNewVal, &qStr );
QImage qImg( qStr );
if( pInfo->pNewVal2 && HB_IS_ARRAY( pInfo->pNewVal2 ) )
{

View File

@@ -212,19 +212,33 @@ HB_USHORT hb_rddFieldIndex( AREAP pArea, const char * szName )
if( *szName )
{
PHB_DYNS pDynSym = hb_dynsymFindName( szName );
HB_SIZE nLen = strlen( szName );
if( pDynSym )
while( HB_ISSPACE( szName[ nLen - 1 ] ) )
--nLen;
if( nLen <= HB_SYMBOL_NAME_LEN )
{
LPFIELD pField = pArea->lpFields;
HB_USHORT uiCount = 0;
char szFieldName[ HB_SYMBOL_NAME_LEN + 1 ];
PHB_DYNS pDynSym;
while( pField )
szFieldName[ nLen ] = '\0';
while( nLen-- )
szFieldName[ nLen ] = HB_TOUPPER( szName[ nLen ] );
pDynSym = hb_dynsymFind( szFieldName );
if( pDynSym )
{
++uiCount;
if( pDynSym == ( PHB_DYNS ) pField->sym )
return uiCount;
pField = pField->lpfNext;
LPFIELD pField = pArea->lpFields;
HB_USHORT uiCount = 0;
while( pField )
{
++uiCount;
if( pDynSym == ( PHB_DYNS ) pField->sym )
return uiCount;
pField = pField->lpfNext;
}
}
}
}