本文整理汇总了C++中FreeResources函数的典型用法代码示例。如果您正苦于以下问题:C++ FreeResources函数的具体用法?C++ FreeResources怎么用?C++ FreeResources使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FreeResources函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FreeResources
DWORD CControlSK::SetBitmap(HBITMAP hBitmap)
{
int nRetValue;
BITMAP csBitmapSize;
// Free any loaded resource
FreeResources();
if (hBitmap)
{
m_hBitmap = hBitmap;
// Get bitmap size
nRetValue = ::GetObject(hBitmap, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return 0;
}
m_dwWidth = (DWORD)csBitmapSize.bmWidth;
m_dwHeight = (DWORD)csBitmapSize.bmHeight;
}
// if (IsWindow(this->GetSafeHwnd()))
// Invalidate();
return 1;
}
示例2: FreeResources
DWORD CMySliderCtrl::SetBitmaps(HBITMAP hChannel, COLORREF crTransCh,
HBITMAP hThumb, COLORREF crTransThumb)
{
int nRetValue = 0;
BITMAP csBitmapSize;
m_BgSet = FALSE;
// Free any loaded resource
FreeResources();
if (hChannel)
{
m_csBitmaps[0].hBitmap = hChannel;
m_csBitmaps[0].crTransparent = crTransCh;
// Get bitmap size
nRetValue = ::GetObject(hChannel, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csBitmaps[0].dwWidth = (DWORD)csBitmapSize.bmWidth;
m_csBitmaps[0].dwHeight = (DWORD)csBitmapSize.bmHeight;
// Create mask for bitmap In
m_csBitmaps[0].hMask = CreateBitmapMask(hChannel, m_csBitmaps[0].dwWidth, m_csBitmaps[0].dwHeight, crTransCh);
if (m_csBitmaps[0].hMask == NULL)
{
FreeResources();
return BTNST_FAILEDMASK;
} // if
}
if (hThumb)
{
m_csBitmaps[3].hBitmap = hThumb;
m_csBitmaps[3].crTransparent = crTransThumb;
// Get bitmap size
nRetValue = ::GetObject(hThumb, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csBitmaps[3].dwWidth = (DWORD)csBitmapSize.bmWidth;
m_csBitmaps[3].dwHeight = (DWORD)csBitmapSize.bmHeight;
// Create mask for bitmap Out
m_csBitmaps[3].hMask = CreateBitmapMask(hThumb, m_csBitmaps[3].dwWidth, m_csBitmaps[3].dwHeight, crTransThumb);
if (m_csBitmaps[3].hMask == NULL)
{
FreeResources();
return BTNST_FAILEDMASK;
} // if
} // if
SizeToContent();
Invalidate();
return BTNST_OK;
} // End of SetBitmaps
示例3: FreeResources
DWORD CButtonST::SetIcon(HICON hIconIn, HICON hIconOut, HICON hIconDisable)
{
bool bRetValue;
ICONINFO ii;
// Free any loaded resource
FreeResources();
if (hIconIn != 0)
{
m_csIcons[0].hIcon = hIconIn;
// Get icon dimension
ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = (::GetIconInfo(hIconIn, &ii) != 0);
if (!bRetValue)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
}
m_csIcons[0].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[0].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
if (hIconOut != 0)
{
m_csIcons[1].hIcon = hIconOut;
// Get icon dimension
ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = (::GetIconInfo(hIconOut, &ii) != 0);
if (!bRetValue)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
}
m_csIcons[1].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[1].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
}
if (hIconDisable != 0)
{
m_csIcons[2].hIcon = hIconDisable;
// Get icon dimension
ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = (::GetIconInfo(hIconDisable, &ii) != 0);
if (!bRetValue)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
}
m_csIcons[2].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[2].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
}
}
if (IsWindow()) { RedrawWindow(); }
return BTNST_OK;
}
示例4: FreeResources
DWORD SkinBmp::SetBitmaps(CWnd * cwnd, CDC * dc, HBITMAP hBitmap, COLORREF crTransBitmap)
{
int nRetValue = 0;
BITMAP csBitmapSize;
// Free any loaded resource
FreeResources();
cwnd->GetClientRect(m_ClientRect);
if (hBitmap)
{
// Get bitmap size
nRetValue = ::GetObject(hBitmap, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return FALSE;
} // if
// resize bitmap into client area
HDC hdcSrc = CreateCompatibleDC(NULL);
HBITMAP hbmOldSrc = (HBITMAP)::SelectObject(hdcSrc, hBitmap);
HBITMAP hbmResized = ::CreateCompatibleBitmap(dc->m_hDC,m_ClientRect.Width(),m_ClientRect.Height());
HDC hdcTmp = CreateCompatibleDC(NULL);
HBITMAP hbmTmp = (HBITMAP)::SelectObject(hdcTmp, hbmResized);
::StretchBlt(hdcTmp,0,0,m_ClientRect.Width(),m_ClientRect.Height(),
hdcSrc,0,0,csBitmapSize.bmWidth,csBitmapSize.bmHeight,SRCCOPY);
::SelectObject(hdcSrc, hbmOldSrc);
::DeleteDC(hdcSrc);
::DeleteObject(hBitmap);
::SelectObject(hdcTmp, hbmTmp);
::DeleteDC(hdcTmp);
hBitmap = hbmResized;
m_Bitmaps.hBitmap = hBitmap;
m_Bitmaps.crTransparent = crTransBitmap;
m_Bitmaps.dwWidth = m_ClientRect.Width();
m_Bitmaps.dwHeight = m_ClientRect.Height();
// Create mask for bitmap In
m_Bitmaps.hMask = CreateBitmapMask(hBitmap, m_Bitmaps.dwWidth, m_Bitmaps.dwHeight, crTransBitmap);
if (m_Bitmaps.hMask == NULL)
{
FreeResources();
return FALSE;
} // if
}
m_UseSkin = TRUE;
// Invalidate();
return TRUE;
} // End of SetBitmaps
示例5: FreeResources
// This function assigns bitmaps to the button.
// Any previous icon or bitmap will be removed.
//
// Parameters:
// [IN] hBitmapIn
// Handle fo the bitmap to show when the mouse is over the button.
// Pass NULL to remove any bitmap from the button.
// [IN] crTransColorIn
// Color (inside hBitmapIn) to be used as transparent color.
// [IN] hBitmapOut
// Handle to the bitmap to show when the mouse is outside the button.
// Can be NULL.
// [IN] crTransColorOut
// Color (inside hBitmapOut) to be used as transparent color.
//
// Return value:
// BTNST_OK
// Function executed successfully.
// BTNST_INVALIDRESOURCE
// Failed loading the specified resource.
// BTNST_FAILEDMASK
// Failed creating mask bitmap.
//
DWORD CButtonST::SetBitmaps(HBITMAP hBitmapIn, COLORREF crTransColorIn, HBITMAP hBitmapOut, COLORREF crTransColorOut)
{
int nRetValue;
BITMAP csBitmapSize;
// Free any loaded resource
FreeResources();
if (hBitmapIn)
{
m_csBitmaps[0].hBitmap = hBitmapIn;
m_csBitmaps[0].crTransparent = crTransColorIn;
// Get bitmap size
nRetValue = ::GetObject(hBitmapIn, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csBitmaps[0].dwWidth = (DWORD)csBitmapSize.bmWidth;
m_csBitmaps[0].dwHeight = (DWORD)csBitmapSize.bmHeight;
// Create mask for bitmap In
m_csBitmaps[0].hMask = CreateBitmapMask(hBitmapIn, m_csBitmaps[0].dwWidth, m_csBitmaps[0].dwHeight, crTransColorIn);
if (m_csBitmaps[0].hMask == NULL)
{
FreeResources();
return BTNST_FAILEDMASK;
} // if
if (hBitmapOut)
{
m_csBitmaps[1].hBitmap = hBitmapOut;
m_csBitmaps[1].crTransparent = crTransColorOut;
// Get bitmap size
nRetValue = ::GetObject(hBitmapOut, sizeof(csBitmapSize), &csBitmapSize);
if (nRetValue == 0)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csBitmaps[1].dwWidth = (DWORD)csBitmapSize.bmWidth;
m_csBitmaps[1].dwHeight = (DWORD)csBitmapSize.bmHeight;
// Create mask for bitmap Out
m_csBitmaps[1].hMask = CreateBitmapMask(hBitmapOut, m_csBitmaps[1].dwWidth, m_csBitmaps[1].dwHeight, crTransColorOut);
if (m_csBitmaps[1].hMask == NULL)
{
FreeResources();
return BTNST_FAILEDMASK;
} // if
} // if
} // if
Invalidate();
return BTNST_OK;
} // End of SetBitmaps
示例6: FreeResources
// This function assigns icons to the button.
// Any previous icon or bitmap will be removed.
//
// Parameters:
// [IN] hIconIn
// Handle fo the icon to show when the mouse is over the button.
// Pass NULL to remove any icon from the button.
// [IN] hIconOut
// Handle to the icon to show when the mouse is outside the button.
// Can be NULL.
//
// Return value:
// BTNST_OK
// Function executed successfully.
// BTNST_INVALIDRESOURCE
// Failed loading the specified resource.
//
DWORD CButtonST::SetIcon(HICON hIconIn, HICON hIconOut)
{
BOOL bRetValue;
ICONINFO ii;
// Free any loaded resource
FreeResources();
if (hIconIn)
{
// Icon when mouse over button?
m_csIcons[0].hIcon = hIconIn;
// Get icon dimension
::ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = ::GetIconInfo(hIconIn, &ii);
if (bRetValue == FALSE)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csIcons[0].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[0].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
// Icon when mouse outside button?
if (hIconOut)
{
if (hIconOut == BTNST_AUTO_GRAY)
{
hIconOut = CreateGrayscaleIcon(hIconIn);
} // if
m_csIcons[1].hIcon = hIconOut;
// Get icon dimension
::ZeroMemory(&ii, sizeof(ICONINFO));
bRetValue = ::GetIconInfo(hIconOut, &ii);
if (bRetValue == FALSE)
{
FreeResources();
return BTNST_INVALIDRESOURCE;
} // if
m_csIcons[1].dwWidth = (DWORD)(ii.xHotspot * 2);
m_csIcons[1].dwHeight = (DWORD)(ii.yHotspot * 2);
::DeleteObject(ii.hbmMask);
::DeleteObject(ii.hbmColor);
} // if
} // if
Invalidate();
return BTNST_OK;
} // End of SetIcon
示例7: ZeroedMembers
void H264Slice::Reset()
{
m_pSource.Release();
if (m_bInited && m_pSeqParamSet)
{
if (m_pSeqParamSet)
((H264SeqParamSet*)m_pSeqParamSet)->DecrementReference();
if (m_pPicParamSet)
((H264PicParamSet*)m_pPicParamSet)->DecrementReference();
m_pSeqParamSet = 0;
m_pPicParamSet = 0;
if (m_pSeqParamSetEx)
{
((H264SeqParamSetExtension*)m_pSeqParamSetEx)->DecrementReference();
m_pSeqParamSetEx = 0;
}
if (m_pSeqParamSetMvcEx)
{
((H264SeqParamSetMVCExtension*)m_pSeqParamSetMvcEx)->DecrementReference();
m_pSeqParamSetMvcEx = 0;
}
if (m_pSeqParamSetSvcEx)
{
((H264SeqParamSetSVCExtension*)m_pSeqParamSetSvcEx)->DecrementReference();
m_pSeqParamSetSvcEx = 0;
}
}
ZeroedMembers();
FreeResources();
}
示例8: SDL_COMPAT_SetVideoMode
SDL_Surface* SDL_COMPAT_SetVideoMode(int width, int height, int bitsperpixel, Uint32 flags)
{
g_width = width;
g_height = height;
g_bpp = bitsperpixel;
FreeResources();
g_window = SDL_CreateWindow("oricutron", g_lastx, g_lasty,
g_width, g_height, flags);
if(g_icon)
SDL_SetWindowIcon(g_window, g_icon);
if(flags & SDL_WINDOW_OPENGL)
{
g_screen = SDL_GetWindowSurface(g_window);
g_glcontext = SDL_GL_CreateContext(g_window);
}
else
{
g_screen = SDL_CreateRGBSurface(0, g_width, g_height, g_bpp,
RMASK, GMASK, BMASK, AMASK);
g_renderer = SDL_CreateRenderer(g_window, -1, 0);
g_texture = SDL_CreateTexture(g_renderer,
SDL_PIXELFORMAT_ABGR8888,
SDL_TEXTUREACCESS_STREAMING,
g_width, g_height);
}
return g_screen;
}
示例9: FreeResources
bool ScaleSpace::AllocateResources(int lines, int cols, int levels, double *scales)
{
int i;
if(lines < 10) //image too small
return false;
if(cols < 10) //image too small
return false;
if(levels < 1) //
return false;
if(_allocated)
FreeResources();
_width = cols;
_height = lines;
_levels = levels;
_scales = (double*)malloc(_levels*sizeof(double));
if(scales == 0) return false;
_scalespace = (float**)malloc(_levels*sizeof(float*));
if(_scalespace == 0) return false;
_filters = new FastGauss[levels];
if(_filters == 0) return false;
for(i=0; i < levels; i++)
{
_scales[i] = scales[i];
_filters[i].AllocateResources(lines, cols, _scales[i]);
_scalespace[i] = (float*)malloc(_width*_height*sizeof(float));
if(_scalespace[i] == 0) return false;
}
_allocated = true;
return true;
}
示例10: INFO_PRINTF1
/**
Old testcaseID AFSS-CMDMWT-0008
New testcaseID DEVSRVS-SSMA-CMD-0010
*/
void CCmdTestMultipleWait::doTestCommandTypeL()
{
TInt32 timeout = 10000;
TArray<MSsmCommand*> testDeferredList = iDeferredList.Array();
INFO_PRINTF1(_L("Test:doTestCommandTypeL - Command construction with valid data"));
INFO_PRINTF1(_L("doTestCommandTypeL:01 Test: Construct from NewL(RReadStream& aReadStream, TArray<MSsmCommand*>& aDeferredCommands) and check type"));
iTestCmd = CreateCmdFromStreamL(testDeferredList, timeout);
CompareCommandsDataL(iTestCmd, timeout);
TEST(iTestCmd->Type() == ESsmCmdMultipleWait);
Reset();
INFO_PRINTF1(_L("doTestCommandTypeL:02 Test: Construct from NewL(TInt32 aTimeout) and check type"));
iTestCmd = CCmdMultipleWait::NewL(timeout);
CompareCommandsDataL(iTestCmd, timeout);
TEST(iTestCmd->Type() == ESsmCmdMultipleWait);
Reset();
INFO_PRINTF1(_L("doTestCommandTypeL:03 Test: Construct from NewL(TSsmCommandParameters& aCommandParameters) and check type"));
timeout = 1000;
// open reader
RResourceReader& reader = LoadResourcesL(KTestRscFileName, R_COMMAND_VALID_DATA);
TSsmCommandParameters params(reader, NULL, 0);
iTestCmd = CCmdMultipleWait::NewL(params);
CompareCommandsDataL(iTestCmd, timeout);
TEST(iTestCmd->Type() == ESsmCmdMultipleWait);
Reset();
FreeResources();
}
示例11: INFO_PRINTF1
void CCmdTestWaitForApparcInit::doTestCommandTypeL()
{
TCmdErrorSeverity severity = ECmdIgnoreFailure;
INFO_PRINTF1(_L("Test:doTestCommandTypeL - Command construction with valid data"));
INFO_PRINTF1(_L("doTestCommandTypeL:01 Construct from NewL(RReadStream& aReadStream) and check type"));
iTestCmd = CreateCmdFromStreamL(severity);
CompareCommandsDataL(iTestCmd, severity);
TEST(iTestCmd->Type() == ESsmCmdWaitForApparcInit);
delete iTestCmd;
iTestCmd = NULL;
INFO_PRINTF1(_L("doTestCommandTypeL:02 Construct from NewL(TCmdErrorSeverity aSeverity) and check type"));
severity = ECmdCriticalSeverity;
iTestCmd = CCmdWaitForApparcInit::NewL(severity);
CompareCommandsDataL(iTestCmd, severity);
TEST(iTestCmd->Type() == ESsmCmdWaitForApparcInit);
delete iTestCmd;
iTestCmd = NULL;
INFO_PRINTF1(_L("doTestCommandTypeL:03 Construct from NewL(TSsmCommandParameters& aCommandParameters) and check type"));
severity = ECmdMediumSeverity;
// open reader
RResourceReader& reader = LoadResourcesL(KTestRscFileName, R_COMMAND_VALID_DATA);
TSsmCommandParameters params(reader, NULL, 0);
iTestCmd = CCmdWaitForApparcInit::NewL(params);
CompareCommandsDataL(iTestCmd, severity); //validate the value
TEST(iTestCmd->Type() == ESsmCmdWaitForApparcInit);
delete iTestCmd;
iTestCmd = NULL;
FreeResources();
}
示例12: ImproveCommunities
uint32_t ImproveCommunities(const CGraph* graph, CommunityPartition* partition, uint32_t numThreads, uint32_t lookahead, const double64_t alfa ) {
num_threads = numThreads;
omp_set_num_threads(num_threads);
printf("Maximum number of threads: %d\n", omp_get_max_threads());
printf("Starting improvement from a partition with WCC: %f\n", partition->m_WCC / graph->GetNumNodes());
CommunityPartition bestPartition;
CopyPartition(&bestPartition, partition);
uint32_t remainingTries = lookahead;
bool improve = true;
while(improve) {
while (improve) {
printf("\n");
uint64_t initTime = StartClock();
improve = false;
printf("Starting improvement iteration ...\n");
if (PerformImprovementStep(graph, partition, alfa)) {
printf("Error while performing an improvement step.\n");
return 1;
}
printf("New WCC: %f\n", partition->m_WCC / graph->GetNumNodes());
printf("Best WCC: %f\n", bestPartition.m_WCC / graph->GetNumNodes());
printf("Memory required by this iteration: %lu bytes \n", MeasureMemoryConsumption(partition) + MeasureMemoryConsumption(&bestPartition));
if (partition->m_WCC - bestPartition.m_WCC > 0.0f) {
// if (((partition->m_WCC - bestPartition.m_WCC) / bestPartition.m_WCC) > 0.01f) {
remainingTries = lookahead;
// }
FreeResources(&bestPartition);
CopyPartition(&bestPartition, partition);
}
printf("Iteration time: %lu ms\n", StopClock(initTime));
if(remainingTries > 0) {
remainingTries--;
improve = true;
}
}
}
FreeResources(partition);
CopyPartition(partition, &bestPartition);
FreeResources(&bestPartition);
return 0;
}
示例13: LoadResourcesL
void CCmdTestMultipleWait::AddDeferredCommandsInListL(TDeferredCmdConfiguration aDeferredCmd)
{
// open reader
RResourceReader& reader = LoadResourcesL(KTestRscFileName, aDeferredCmd.iCmdResourceId);
TSsmCommandParameters params(reader, NULL, 0);
iTestList->AddCommandFromResourceL(aDeferredCmd.iCmdType, params);
FreeResources();
}
示例14: FreeResources
RenderSystem::~RenderSystem() {
if (_initOk) {
if (_context) {
_context->ClearState();
}
FreeResources();
}
}
示例15: FreeResources
void CGUIRenderingControl::UpdateVisibility(const CGUIListItem *item)
{
// if made invisible, start timer, only free addonptr after
// some period, configurable by window class
CGUIControl::UpdateVisibility(item);
if (!IsVisible() && m_callback)
FreeResources();
}