From 76205aef80f970e04d05db11893bdc405528440f Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Wed, 28 Sep 2011 14:31:02 +0000 Subject: [PATCH] 2011-09-28 16:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/gtxwc/gtxwc.h * harbour/src/rtl/gtxwc/gtxwc.c % use common buffer for different box drawing character definitions --- harbour/ChangeLog | 5 +++++ harbour/src/rtl/gtxwc/gtxwc.c | 21 +++++++++++---------- harbour/src/rtl/gtxwc/gtxwc.h | 1 + 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3ec2d8c854..884200186d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,11 @@ The license applies to all entries newer than 2009-04-28. */ +2011-09-28 16:30 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/rtl/gtxwc/gtxwc.h + * harbour/src/rtl/gtxwc/gtxwc.c + % use common buffer for different box drawing character definitions + 2011-09-27 20:06 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/gtqtc/gtqtc.cpp ! deleted unused static function shown by new mingw version. diff --git a/harbour/src/rtl/gtxwc/gtxwc.c b/harbour/src/rtl/gtxwc/gtxwc.c index ab10b27702..077cd236af 100644 --- a/harbour/src/rtl/gtxwc/gtxwc.c +++ b/harbour/src/rtl/gtxwc/gtxwc.c @@ -507,25 +507,29 @@ static void hb_gt_xwc_Enable( void ) static HB_BOOL hb_gt_xwc_DefineBoxChar( PXWND_DEF wnd, HB_USHORT usCh, XWC_CharTrans *bxCh ) { - XSegment segs[9]; - XPoint pts[XWC_MAX_CHAR_POINTS]; - XRectangle rect[4]; + typedef union + { + XSegment segs[ XWC_MAX_CHAR_SEGS ]; + XRectangle rect[ XWC_MAX_CHAR_RECTS ]; + XPoint pts[ XWC_MAX_CHAR_POINTS ]; + } HB_XWC_CHDEF; + HB_XWC_CHDEF chdef; + XSegment * segs = chdef.segs; + XRectangle * rect = chdef.rect; + XPoint * pts = chdef.pts; XWC_CharType type = CH_CHAR; int size = 0; HB_BOOL inverse = HB_FALSE; int cellx = wnd->fontWidth; int celly = wnd->fontHeight; - int i; + int i, y, x, yy, xx, skip, start, mod; switch( usCh ) { case HB_GTXWC_FILLER1: case HB_GTXWC_FILLER2: case HB_GTXWC_FILLER3: - { - int x, y, xx, yy, skip, start, mod; - if( usCh == HB_GTXWC_FILLER1 ) { skip = 4; @@ -553,9 +557,7 @@ static HB_BOOL hb_gt_xwc_DefineBoxChar( PXWND_DEF wnd, HB_USHORT usCh, XWC_CharT * character definition will not be finished */ if( size >= XWC_MAX_CHAR_POINTS ) - { break; - } pts[size].x = x - xx; pts[size].y = y - yy; xx = x; @@ -565,7 +567,6 @@ static HB_BOOL hb_gt_xwc_DefineBoxChar( PXWND_DEF wnd, HB_USHORT usCh, XWC_CharT } type = size == 0 ? CH_NONE : CH_PTS; break; - } case HB_GTXWC_ARROW_R: i = HB_MIN( ( celly >> 1 ), cellx ) - 3; diff --git a/harbour/src/rtl/gtxwc/gtxwc.h b/harbour/src/rtl/gtxwc/gtxwc.h index 8d000f82c3..2c41a242d1 100644 --- a/harbour/src/rtl/gtxwc/gtxwc.h +++ b/harbour/src/rtl/gtxwc/gtxwc.h @@ -96,6 +96,7 @@ typedef HB_USHORT HB_GT_CELLTYPE; #define XWC_MAX_BUTTONS 8 #define XWC_MAX_CHAR_POINTS 1024 #define XWC_MAX_CHAR_RECTS ( XWC_MAX_CHAR_POINTS / 2 ) +#define XWC_MAX_CHAR_SEGS ( XWC_MAX_CHAR_POINTS / 2 ) /* Font definition */ #define XWC_DEFAULT_FONT_HEIGHT 18