예제 #1
0
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
0
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
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
0
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
0
파일: BtnST.cpp 프로젝트: darwinbeing/trade
// 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
0
// 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
0
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
0
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;
}
CButtonST::CButtonST()
{
	m_bMouseOnButton = false;
	FreeResources(false);
	// Default type is "flat" button
	m_bIsFlat = true; 
	// By default draw border in "flat" button 
	m_bDrawBorder = true; 
	// By default icon is aligned horizontally
	m_nAlign = ST_ALIGN_HORIZ; 
	// By default, for "flat" button, don't draw the focus rect
	m_bDrawFlatFocus = false;
	// By default the button is not the default button
	m_bIsDefault = false;
	// By default the button is not a checkbox
	m_bIsCheckBox = false;
	m_nCheck = false;
	// Set default colors
	SetDefaultColors(false);
	// No tooltip created
	m_ToolTip.m_hWnd = 0;
	// Do not draw as a transparent button
	m_bDrawTransparent = false;
	m_pbmpOldBk = 0;
	// No URL defined
	::ZeroMemory(&m_szURL, sizeof(m_szURL));
	// No cursor defined
	m_hCursor = 0;
	// No autorepeat
	m_bAutoRepeat = false;
	m_dwPeriodAutoRepeat = 100;
	m_bIsPressed = false;
	m_bIsFocused = false;
	m_bIsDisabled = false;
}
예제 #10
0
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;
}
/**
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();
	}
void CCmdTestMultipleWait::doTestNewLWithGoodDataL()
	{
	TInt err = KErrNone;
	TInt expectedErr = KErrNone;
	TInt32 timeout = 10000;
	TArray<MSsmCommand*> testDeferredList = iDeferredList.Array();
	INFO_PRINTF1(_L("Test:doTestNewLWithGoodDataL - Command construction with valid data"));

	INFO_PRINTF1(_L("doTestNewLWithGoodDataL:01 Test: NewL(RReadStream& aReadStream, TArray<MSsmCommand*>& aDeferredCommands)"));
	TRAP(err, iTestCmd = CreateCmdFromStreamL(testDeferredList, timeout));
	INFO_PRINTF3(_L("Test completed with err : %d. expected err : %d"), err, expectedErr);
	TEST(err == expectedErr);
	CompareCommandsDataL(iTestCmd, timeout);
	Reset();

	INFO_PRINTF1(_L("doTestNewLWithGoodDataL:02 Test: NewL(TInt32 aTimeout)"));

	TRAP(err, iTestCmd = CCmdMultipleWait::NewL(timeout));
	INFO_PRINTF3(_L("Test completed with err : %d. expected err : %d"), err, expectedErr);
	TEST(err == expectedErr);
	CompareCommandsDataL(iTestCmd, timeout);
	Reset();

	INFO_PRINTF1(_L("doTestNewLWithGoodDataL:03 Test: NewL(TSsmCommandParameters& aCommandParameters)"));
	// open reader
	timeout = 1000;
	RResourceReader& reader = LoadResourcesL(KTestRscFileName, R_COMMAND_VALID_DATA);
	TSsmCommandParameters params(reader, NULL, 0);
	TRAP(err, iTestCmd = CCmdMultipleWait::NewL(params));
	INFO_PRINTF3(_L("Test completed with err : %d. expected err : %d"), err, expectedErr);
	TEST(err == expectedErr);
	CompareCommandsDataL(iTestCmd, timeout);
	Reset();
	FreeResources();
	}
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();
	}
예제 #14
0
SkinBmp::~SkinBmp()
{
	m_dcBk.DeleteDC();
	m_bmpBk.DeleteObject();
	FreeResources();
	::DeleteDC(m_hdcTmp);
} // End of ~SkinBmp
예제 #15
0
    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;
    }
void CCmdTestMultipleWait::AddDeferredCommandsInListL(TDeferredCmdConfiguration aDeferredCmd)
	{
	// open reader
	RResourceReader& reader = LoadResourcesL(KTestRscFileName, aDeferredCmd.iCmdResourceId);
	TSsmCommandParameters params(reader, NULL, 0);
	iTestList->AddCommandFromResourceL(aDeferredCmd.iCmdType, params);
	FreeResources();
	}
예제 #17
0
RenderSystem::~RenderSystem() {
    if (_initOk) {
        if (_context) {
            _context->ClearState();
        }
        FreeResources();
    }
}
예제 #18
0
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();
}
예제 #19
0
파일: Confirmed.c 프로젝트: juddy/edcde
void    nosaveCB_QuestionDialog(Widget UxWidget,
                                   XtPointer UxClientData,
                                   XtPointer UxCallbackArg)
{
  XtDestroyWidget(XtParent(UxWidget));
  FreeResources();
  exit(0);
}
예제 #20
0
파일: rs_impl.cpp 프로젝트: swuecho/igblast
CResultSet::~CResultSet()
{
    try {
        Notify(CDbapiClosedEvent(this));
        FreeResources();
        Notify(CDbapiDeletedEvent(this));
        _TRACE(GetIdent() << " " << (void*)this << " deleted.");
    }
    NCBI_CATCH_ALL_X( 6, kEmptyStr )
}
예제 #21
0
bool CGUITextureBase::SetFileName(const std::string& filename)
{
  if (m_info.filename == filename) return false;
  // Don't completely free resources here - we may be just changing
  // filenames mid-animation
  FreeResources();
  m_info.filename = filename;
  // Don't allocate resources here as this is done at render time
  return true;
}
예제 #22
0
Error::E RenderSystem::Initialize(const Window &window) {
    Error::E err = Error::OK;
    err = CreateDeviceAndContext();

    if (err != Error::OK) {
        FreeResources();
        return err;
    }

    err = CreateSwapChain(window);

    if (err != Error::OK) {
        FreeResources();
        return err;        
    }

    ID3D11Texture2D *backBuffer;
    DEBUG_HR(_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), reinterpret_cast<void**>(&backBuffer)));
    DEBUG_HR(_device->CreateRenderTargetView(backBuffer, NULL, &_renderTargetView));
    ReleaseCom(backBuffer);

    err = CreateDepthStencilBuffer();

    if (err != Error::OK) {
        FreeResources();
        return err;
    }

    _context->OMSetRenderTargets(1, &_renderTargetView, _depthStencilView);

    D3D11_VIEWPORT vp;
    vp.TopLeftX = 0;
    vp.TopLeftY = 0;
    vp.Width = (float)window.GetWidth();
    vp.Height = (float)window.GetHeight();
    vp.MinDepth = 0.0f;
    vp.MaxDepth = 1.0f;

    _context->RSSetViewports(1, &vp);

    _initOk = true;
    return Error::OK;
}
예제 #23
0
CButtonST::CButtonST()
{
	m_bIsPressed		= FALSE;
	m_bIsFocused		= FALSE;
	m_bIsDisabled		= FALSE;
	m_bMouseOnButton	= FALSE;

	FreeResources(FALSE);

	// Default type is "flat" button
	m_bIsFlat = TRUE;
	// Button will be tracked also if when the window is inactive (like Internet Explorer)
	m_bAlwaysTrack = TRUE;
  
	// By default draw border in "flat" button 
	m_bDrawBorder = TRUE; 
  
	// By default icon is aligned horizontally
//	m_byAlign = ST_ALIGN_HORIZ; 
  
	// By default, for "flat" button, don't draw the focus rect
	m_bDrawFlatFocus = FALSE;

	// By default the button is not the default button
	m_bIsDefault = FALSE;
	// Invalid value, since type still unknown
	m_nTypeStyle = BS_TYPEMASK_01;

	// By default the button is not a checkbox
	m_bIsCheckBox = FALSE;
	m_nCheck = 0;

	// Set default colors
	SetDefaultColors(FALSE);

	// No tooltip created
	m_ToolTip.m_hWnd = NULL;

	// Do not draw as a transparent button
	m_bDrawTransparent = FALSE;
	m_pbmpOldBk = NULL;


	// No cursor defined
	m_hCursor = NULL;

	// No associated menu
#ifndef	BTNST_USE_BCMENU
	m_hMenu = NULL;
#endif
	m_hParentWndMenu = NULL;
	m_bMenuDisplayed = FALSE;

	m_bShowDisabledBitmap = TRUE;
} // End of CButtonST
예제 #24
0
//==============================================================
CInput::CInput(HWND window)
{
	DI = nullptr;
	if (FAILED(DirectInput8Create(GetModuleHandle(NULL),
		                          DIRECTINPUT_VERSION,
								  IID_IDirectInput8,
								  reinterpret_cast<void**>(&DI), NULL))) return;

	Keyboard = nullptr;
	if (FAILED(DI->CreateDevice(
			GUID_SysKeyboard, &Keyboard, NULL)) ||
		FAILED(Keyboard->SetDataFormat(
			&c_dfDIKeyboard)) ||
		FAILED(Keyboard->SetCooperativeLevel(
			window, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE))
	)
	{
		FreeResources();
		return;
	}

	if (FAILED(DI->EnumDevices(DI8DEVCLASS_GAMECTRL, 
			EnumJoysticksCallbackWrapper, 
			this, DIEDFL_ATTACHEDONLY))
	)
	{
		FreeResources(); return;
	}
	for (int i=0, n=JoySticks.size(); i<n; i++)
	{
		if (FAILED(JoySticks[i]->SetDataFormat(
				&c_dfDIJoystick2)) ||
			FAILED(JoySticks[i]->SetCooperativeLevel(
				window, DISCL_FOREGROUND | DISCL_EXCLUSIVE)) ||
			FAILED(JoySticks[i]->EnumObjects(
				EnumObjectsCallbackWrapper, 
				JoySticks[i], DIDFT_ALL)))
		{
			FreeResources(); return;
		}
	}
}
예제 #25
0
CButtonST::~CButtonST()
{
	// Restore old bitmap (if any)
	if (m_dcBk != 0 && m_pbmpOldBk != 0)
		{
		m_dcBk.SelectBitmap(m_pbmpOldBk);
		}
	FreeResources();
	// Destroy the cursor (if any)
	if (m_hCursor != 0) ::DestroyCursor(m_hCursor);
}
예제 #26
0
void USoundWave::FinishDestroy()
{
	FreeResources();

	Super::FinishDestroy();

	CleanupCachedRunningPlatformData();
	CleanupCachedCookedPlatformData();

	IStreamingManager::Get().GetAudioStreamingManager().RemoveStreamingSoundWave(this);
}
예제 #27
0
void OPL_Timer_StopThread(void)
{
    timer_thread_state = THREAD_STATE_STOPPING;

    while (timer_thread_state != THREAD_STATE_STOPPED)
    {
        SDL_Delay(1);
    }

    FreeResources();
}
예제 #28
0
void Quit(char *str)
{	
	FreeResources();
	
	if (str && *str) {
		fprintf(stderr, "%s\n", str);
		exit(EXIT_FAILURE);
	}
	
	exit(EXIT_SUCCESS);
}
예제 #29
0
CCeXDib::CCeXDib()
{
	m_hDib = NULL;
	m_dwLineWidth = 0;
	m_wColors = 0;

	m_hMemDC = NULL;
	m_hBitmap = NULL;
	m_lpBits = NULL;

	FreeResources();
}
예제 #30
0
void MatrSolver::Solve(){
    det = Det(matr, n);
    std::cout << "Определитель матрицы = " << det << std::endl;
    if (det) FindObrMatr();
    else std::cout << "Т.к. определитель матрицы = 0,\nто матрица вырожденная и обратной не имеет!!!" << std::endl;
    TransponMtx(obr_matr, tobr_matr, n);
    PrintMtx(tobr_matr, n);
    SolveEquation(tobr_matr, b_matr, res, n);
    std::cout << "Результат: " << std::endl;
    PrintVector(res, n);
    FreeResources();
}