mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
Fix cached pen remaining after color preference changed.
This commit is contained in:
parent
ee820361e2
commit
11ca0d54d0
2 changed files with 21 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* -*- fill-column: 77; 4; compile-command: "make TARGET_OS=wince DEBUG=TRUE"; -*- */
|
/* -*- fill-column: 77; compile-command: "make TARGET_OS=wince DEBUG=TRUE"; -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright 2000-2008 by Eric House (xwords@eehouse.org). All rights reserved.
|
* Copyright 2000-2008 by Eric House (xwords@eehouse.org). All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -70,11 +70,20 @@ XPRtoRECT( RECT* rt, const XP_Rect* xprect )
|
||||||
static HGDIOBJ
|
static HGDIOBJ
|
||||||
ceGetPen( CEDrawCtx* dctx, XP_U16 colorIndx, XP_U16 width )
|
ceGetPen( CEDrawCtx* dctx, XP_U16 colorIndx, XP_U16 width )
|
||||||
{
|
{
|
||||||
HGDIOBJ pen = dctx->pens[colorIndx];
|
PenColorPair* pair = &dctx->pens[colorIndx];
|
||||||
|
HGDIOBJ pen = pair->pen;
|
||||||
|
COLORREF ref = dctx->globals->appPrefs.colors[colorIndx];
|
||||||
|
|
||||||
|
/* Make sure cached value is still good */
|
||||||
|
if ( !!pen && (ref != pair->ref) ) {
|
||||||
|
DeleteObject( pen );
|
||||||
|
pen = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !pen ) {
|
if ( !pen ) {
|
||||||
COLORREF ref = dctx->globals->appPrefs.colors[colorIndx];
|
|
||||||
pen = CreatePen( PS_SOLID, width, ref );
|
pen = CreatePen( PS_SOLID, width, ref );
|
||||||
dctx->pens[colorIndx] = pen;
|
pair->pen = pen;
|
||||||
|
pair->ref = ref;
|
||||||
}
|
}
|
||||||
return pen;
|
return pen;
|
||||||
}
|
}
|
||||||
|
@ -1119,8 +1128,8 @@ DRAW_FUNC_NAME(destroyCtxt)( DrawCtx* p_dctx )
|
||||||
|
|
||||||
for ( i = 0; i < CE_NUM_COLORS; ++i ) {
|
for ( i = 0; i < CE_NUM_COLORS; ++i ) {
|
||||||
DeleteObject( dctx->brushes[i] );
|
DeleteObject( dctx->brushes[i] );
|
||||||
if ( !!dctx->pens[i] ) {
|
if ( !!dctx->pens[i].pen ) {
|
||||||
DeleteObject( dctx->pens[i] );
|
DeleteObject( dctx->pens[i].pen );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,11 @@ typedef enum {
|
||||||
,N_RESIZE_FONTS
|
,N_RESIZE_FONTS
|
||||||
} RFIndex;
|
} RFIndex;
|
||||||
|
|
||||||
|
typedef struct _PenColorPair {
|
||||||
|
COLORREF ref;
|
||||||
|
HGDIOBJ pen;
|
||||||
|
} PenColorPair;
|
||||||
|
|
||||||
typedef struct CEDrawCtx {
|
typedef struct CEDrawCtx {
|
||||||
DrawCtxVTable* vtable;
|
DrawCtxVTable* vtable;
|
||||||
|
|
||||||
|
@ -183,7 +188,7 @@ typedef struct CEDrawCtx {
|
||||||
COLORREF prevBkColor;
|
COLORREF prevBkColor;
|
||||||
|
|
||||||
HBRUSH brushes[CE_NUM_COLORS];
|
HBRUSH brushes[CE_NUM_COLORS];
|
||||||
HGDIOBJ pens[CE_NUM_COLORS];
|
PenColorPair pens[CE_NUM_COLORS];
|
||||||
|
|
||||||
HFONT selPlayerFont;
|
HFONT selPlayerFont;
|
||||||
HFONT playerFont;
|
HFONT playerFont;
|
||||||
|
|
Loading…
Reference in a new issue