summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2010-01-15 14:29:48 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2010-01-15 14:29:48 +0000
commit21235502c3f43db99a51aafc08de5a84639de39a (patch)
tree7d820c032e7467f2c1cb9586c05440fe6720fba5
parent3f2a7c829d5c17a67fedde1f420d9d6c0d476876 (diff)
Fixed a Windows GDI leak when testing alpha blending capabilities,
simplified code by removing an obsolete if clause. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7009 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES1
-rw-r--r--src/Fl_Double_Window.cxx9
2 files changed, 5 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index 2f3f6da6d..9b7b16fad 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,6 @@
CHANGES IN FLTK 1.3.0
+ - Fixed a Windows GDI leak when testing alpha blending capabilities
- Fixed a name conflict with new (VC 2008 Express) winsock2.h
versions and another conflict that produced compile errors
with VC 2008 (STR #2301).
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx
index 1e18b1ebf..19d03fca0 100644
--- a/src/Fl_Double_Window.cxx
+++ b/src/Fl_Double_Window.cxx
@@ -100,10 +100,9 @@ char fl_can_do_alpha_blending() {
fl_alpha_blend = (fl_alpha_blend_func)GetProcAddress(hMod, "AlphaBlend");
// give up if we can't find it (Win95)
if (!fl_alpha_blend) return 0;
- // we have the call, but does our display support alpha blending?
- HDC dc = 0L;//fl_gc;
- // get the current or the desktop's device context
- if (!dc) dc = GetDC(0L);
+ // we have the call, but does our display support alpha blending?
+ // get the desktop's device context
+ HDC dc = GetDC(0L);
if (!dc) return 0;
// check the device capabilities flags. However GetDeviceCaps
// does not return anything useful, so we have to do it manually:
@@ -117,8 +116,8 @@ char fl_can_do_alpha_blending() {
RestoreDC(new_gc, save);
DeleteDC(new_gc);
DeleteObject(bm);
+ ReleaseDC(0L, dc);
- if (!fl_gc) ReleaseDC(0L, dc);
if (alpha_ok) can_do = 1;
return can_do;
}