From e54d972afb7306d84e194bb2b29f41c6c3a74572 Mon Sep 17 00:00:00 2001 From: dmex Date: Sun, 29 Dec 2024 05:33:54 +1100 Subject: [PATCH] Update graph.c --- phlib/graph.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/phlib/graph.c b/phlib/graph.c index af30c324b578..e5cb44e8d77c 100644 --- a/phlib/graph.c +++ b/phlib/graph.c @@ -682,21 +682,25 @@ static VOID PhpDeleteBufferedContext( _In_ PPHP_GRAPH_CONTEXT Context ) { - if (Context->BufferedContext) + if (Context->BufferedContext && Context->BufferedOldBitmap) { - // The original bitmap must be selected back into the context, otherwise the bitmap can't be - // deleted. SelectBitmap(Context->BufferedContext, Context->BufferedOldBitmap); Context->BufferedOldBitmap = NULL; + } + if (Context->BufferedBitmap) + { DeleteBitmap(Context->BufferedBitmap); Context->BufferedBitmap = NULL; + } + if (Context->BufferedContext) + { DeleteDC(Context->BufferedContext); Context->BufferedContext = NULL; - - Context->BufferedBits = NULL; } + + Context->BufferedBits = NULL; } static VOID PhpCreateBufferedContext( @@ -727,19 +731,25 @@ static VOID PhpDeleteFadeOutContext( _In_ PPHP_GRAPH_CONTEXT Context ) { - if (Context->FadeOutContext) + if (Context->FadeOutContext && Context->FadeOutOldBitmap) { SelectBitmap(Context->FadeOutContext, Context->FadeOutOldBitmap); Context->FadeOutOldBitmap = NULL; + } + if (Context->FadeOutBitmap) + { DeleteBitmap(Context->FadeOutBitmap); Context->FadeOutBitmap = NULL; + } + if (Context->FadeOutContext) + { DeleteDC(Context->FadeOutContext); Context->FadeOutContext = NULL; - - Context->FadeOutBits = NULL; } + + Context->FadeOutBits = NULL; } static VOID PhpCreateFadeOutContext(