[commit] r1290 - trunk/SDK/DecoratorLib

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Apr 27 11:18:28 CDT 2011


Author: ksmyth
Date: Wed Apr 27 11:18:28 2011
New Revision: 1290

Log:
Gdiplus::Bitmap expects HINSTANCE to dll, not to bitmap. ASSERT(false) not true

Modified:
   trunk/SDK/DecoratorLib/BitmapUtil.cpp
   trunk/SDK/DecoratorLib/DecoratorUtil.cpp

Modified: trunk/SDK/DecoratorLib/BitmapUtil.cpp
==============================================================================
--- trunk/SDK/DecoratorLib/BitmapUtil.cpp	Tue Apr 26 13:30:20 2011	(r1289)
+++ trunk/SDK/DecoratorLib/BitmapUtil.cpp	Wed Apr 27 11:18:28 2011	(r1290)
@@ -622,7 +622,7 @@
 	case 8:
 		return 256;
 	default:
-		ASSERT(true);
+		ASSERT(false);
 	case 24:
 	case 32:
 		return 0;
@@ -1127,18 +1127,16 @@
 					 Gdiplus::UnitPixel, &imgAttribs);
 }
 
+// Accessing the current module's HINSTANCE from a static library http://blogs.msdn.com/b/oldnewthing/archive/2004/10/25/247180.aspx
+EXTERN_C IMAGE_DOS_HEADER __ImageBase;
+#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
+
 void BitmapRES::load( UINT uiID )
 {
 	// create a GDI+ Bitmap from the resource
-	HINSTANCE hInst = AfxFindResourceHandle(MAKEINTRESOURCE(uiID), RT_BITMAP);
-	ASSERT(hInst != NULL);
-	m_pBitmap = new Gdiplus::Bitmap(hInst, (WCHAR*) MAKEINTRESOURCE( uiID));
-	if (!m_pBitmap) {
-		m_pBitmap = NULL;
-		return;
-	}
+	m_pBitmap = new Gdiplus::Bitmap(HINST_THISCOMPONENT, (WCHAR*) MAKEINTRESOURCE( uiID));
 	if (m_pBitmap->GetLastStatus() != Gdiplus::Ok) {
-		ASSERT(true);
+		ASSERT(false);
 	}
 
 	setSize(m_pBitmap->GetWidth(), m_pBitmap->GetHeight());

Modified: trunk/SDK/DecoratorLib/DecoratorUtil.cpp
==============================================================================
--- trunk/SDK/DecoratorLib/DecoratorUtil.cpp	Tue Apr 26 13:30:20 2011	(r1289)
+++ trunk/SDK/DecoratorLib/DecoratorUtil.cpp	Wed Apr 27 11:18:28 2011	(r1290)
@@ -374,7 +374,7 @@
 		else if (spMetaFCO)
 			COMTHROW( spMetaFCO->get_RegistryValue( bstrPath, &bstrValue ) );
 		else
-			ASSERT(true);
+			ASSERT(false);
 	}
 	catch (hresult_exception &) {
 		bstrValue.Empty();


More information about the gme-commit mailing list