一个函数,比较两幅大小相同的图像中的每个点,然后返回一个比较后的图像
CImage CmpImage(CImage image1,CImage image2)
{
int nWidth=image1.GetWidth();
int nHeight=image1.GetHeight();
CImage image;
image.Create(nWidth,nHeight,image1.GetBPP());
for(int h=0;h!=nHeight;++h)
{
for(int w=0;w!=nWidth;++w)
image.SetPixel(w,h,image1.GetPixel(w,h)==image2.GetPixel(w,h)?RGB(0,0,0):RGB(255,255,255));
}
return image;
}就在设置点颜色那句断言失败,跳到这个函数中inline void CImage::ReleaseDC() const throw()
{
HBITMAP hBitmap; ATLASSUME( m_hDC != NULL ); m_nDCRefCount--;
if( m_nDCRefCount == 0 )
{
hBitmap = HBITMAP( ::SelectObject( m_hDC, m_hOldBitmap ) );
ATLASSERT( hBitmap == m_hBitmap );//失败
s_cache.ReleaseDC( m_hDC );
m_hDC = NULL;
}
}为什么