void CFHDragWnd::OnPaint() 
{
	CPaintDC dc(this);
	
    if(m_pFlatHeaderCtrl->m_bDoubleBuffer)
    {
        CMemDC MemDC(&dc);
        OnDraw(&MemDC);
    }
    else
        OnDraw(&dc);
}
void CCWidget::Draw(CCDrawContext* pDC){
	if(m_bVisible==false) return;

	unsigned char nLastOpacity;
	nLastOpacity = pDC->GetOpacity();

	sRect sr = GetScreenRect();
	pDC->SetOrigin(sPoint(sr.x, sr.y));

	if(m_pFont!=NULL) pDC->SetFont(m_pFont);
	else pDC->SetFont(CCFontManager::Get(NULL));

	pDC->SetOpacity((unsigned char)(nLastOpacity * (float)(m_iOpacity / 255.0f)));
	if(!IsEnable())
		pDC->SetOpacity((unsigned char)(pDC->GetOpacity()*0.70));	

	bool bIntersect = true;
	sRect rectScreen(0, 0, CCGetWorkspaceWidth()-1, CCGetWorkspaceHeight()-1);
	sRect PrevClipRect;
	if(GetParent()!=NULL) {
		sRect parentClipRect = CCClientToScreen(GetParent(), GetParent()->GetClientRect());
		bIntersect = rectScreen.Intersect(&PrevClipRect,parentClipRect);
	}else
		PrevClipRect = rectScreen;

	sRect CurrClipRect = GetScreenRect();
	sRect IntersectClipRect;

	if(m_bClipByParent==true){
		if(PrevClipRect.Intersect(&IntersectClipRect, CurrClipRect)==true){
			sRect test = IntersectClipRect;
			if(IntersectClipRect.w>0 && IntersectClipRect.h>0) {
				pDC->SetClipRect(IntersectClipRect);
				OnDraw(pDC);
			}
		}
	}
	else{
		pDC->SetClipRect(CurrClipRect);
		OnDraw(pDC);
	}

	for(int i=0; i<m_Children.GetCount(); i++){
		CCWidget* pCurWnd = m_Children.Get(i);
		if(pCurWnd==GetLatestExclusive()) continue;
		if(pCurWnd != NULL ) pCurWnd->Draw(pDC);
	}
	if(GetLatestExclusive()!=NULL) 
		GetLatestExclusive()->Draw(pDC);

	pDC->SetOpacity(nLastOpacity);
}
Example #3
0
	void EditorApplication::ProcessFrame()
	{
		if (!mReady)
			return;

		if (mCursorInfiniteModeEnabled)
			CheckCursorInfiniteMode();

		float maxFPS = 60.0f;
		float maxFPSDeltaTime = 1.0f/maxFPS;

		float realdDt = mTimer->GetDeltaTime();

		if (realdDt < maxFPSDeltaTime)
		{
			Sleep((int)((maxFPSDeltaTime - realdDt)*1000.0f));
			realdDt = maxFPSDeltaTime;
		}

		float dt = Math::Clamp(realdDt, 0.001f, 0.05f);

		mInput->PreUpdate();
		mTime->Update(realdDt);
		o2Debug.Update(dt);
		mTaskManager->Update(dt);
		mEventSystem->Update(dt);

		mRender->Begin();

		OnDraw();
		OnUpdate(dt);

		mUIRoot->Update(dt);
		mEventSystem->PostUpdate();
		mScene->Update(dt);


		OnDraw();
		mUIRoot->Draw();
		mUIManager->Draw();
		o2Debug.Draw();

		mRender->End();

		mInput->Update(dt);

		mDrawCalls = mRender->GetDrawCallsCount();
	}
Example #4
0
void CGreedySnakeView::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	// TODO: 在此处添加消息处理程序代码
	// 不为绘图消息调用 CView::OnPaint()
	OnDraw(&dc);
}
Example #5
0
	void iWidget::Draw(float a_fTimeStep, cGuiClipRegion *a_pClipRegion)
	{
		if (m_bVisible==false) return;

		OnDraw(a_fTimeStep, a_pClipRegion);

		cGuiClipRegion *pChildRegion = a_pClipRegion;
		if (m_bClipsGraphics)
		{
			pChildRegion = pChildRegion->CreateChild(GetGlobalPosition(), m_vSize);
			m_pSet->SetCurrentClipRegion(pChildRegion);
		}

		OnDrawAfterClip(a_fTimeStep, a_pClipRegion);

		cGuiMessageData data;
		data.m_fVal = a_fTimeStep;
		data.m_pData = a_pClipRegion;
		ProcessMessage(eGuiMessage_OnDraw, data);

		tWidgetListIt it = m_lstChildren.begin();
		for (; it != m_lstChildren.end(); ++it)
		{
			iWidget *pChild = *it;

			pChild->Draw(a_fTimeStep, a_pClipRegion);
		}

		if (m_bClipsGraphics) m_pSet->SetCurrentClipRegion(a_pClipRegion);
	}
Example #6
0
int CApp::OnExecute(int argc, char **argv) {
	if(OnInit(argc, argv) == false) {
		return -1;
	}

	SDL_Event Event;
	bool calculatedFrame;
    while(Running) {
		//BulletManager::Step();

		while(SDL_PollEvent(&Event)) 
		{
			OnEvent(&Event);
		}
		calculatedFrame= false;
		while ((SDL_GetTicks() - GameBaseTime) > GameTickLength)
		{
			gameTime = SDL_GetTicks() / 1000.0f;
			GameBaseTime += GameTickLength;
			OnUpdate();
			calculatedFrame = true;
		}

		BulletManager::Step();

		OnDraw();

    }
 
    OnCleanup();
 
    return 0;
}
Example #7
0
void CSceneRender::OnSceneLight() 
{
	m_Light = !m_Light;
	AfxGetApp()->WriteProfileInt( "CSceneRender", "m_Light", m_Light );

	OnDraw(NULL);
}
void ScheduleViewEx::OnPrintAll()
{
	CPrintDialog dlg(FALSE);
	if (IDOK == dlg.DoModal())
	{
		HDC dc = dlg.GetPrinterDC();
		
		CDC DC;
		DC.Attach(dc);

		DEVMODE *myMode = dlg.GetDevMode();//fills myMode with printer defaults 
		myMode->dmOrientation = DMORIENT_LANDSCAPE;//change default to landscape
		myMode->dmPrintQuality = DMRES_DRAFT;
		myMode->dmColor = DMCOLOR_MONOCHROME;
		DC.ResetDC(myMode);

		DC.m_bPrinting = TRUE;
		OnPrepareDC(&DC);
		DC.StartDoc(_T("myDoc"));
		
		int tmpOffset = m_offset;
		for (int i = 0;
			i< TotalPages();
			i++)
		{
			m_offset = i;
			DC.StartPage();
			OnDraw(&DC);
			DC.EndPage();
		}
		DC.EndDoc();
		m_offset = tmpOffset;
	}
}
Example #9
0
void CSceneRender::OnNodeResetposition() 
{
	BaseNodePort * pNode = ((ScenePort *)GetDocument())->m_pSelectedNode;
	pNode->resetPosition( m_TargetPosition );

	OnDraw( NULL );
}
Example #10
0
void CSceneRender::OnNodeResetframe() 
{
	BaseNodePort * pNode = ((ScenePort *)GetDocument())->m_pSelectedNode;
	pNode->resetFrame();

	OnDraw( NULL );
}
Example #11
0
void CSceneRender::OnTimer(UINT nIDEvent) 
{
	if ( nIDEvent == 0x1 )
		OnDraw(NULL);

	CView::OnTimer(nIDEvent);
}
Example #12
0
void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr,
                            int32_t iLength,
                            const CFX_RectF& rect,
                            const CFX_RectF& rtClip) {
  ASSERT(m_pFont && m_fFontSize >= 1.0f);
  if (!pwsStr || iLength < 1)
    return;

  if (rect.width < m_fFontSize || rect.height < m_fFontSize) {
    return;
  }
  FX_FLOAT fLineWidth = rect.width;
  if (m_dwStyles & FDE_TTOSTYLE_VerticalLayout) {
    fLineWidth = rect.height;
  }
  m_pTxtBreak->SetLineWidth(fLineWidth);
  m_ttoLines.RemoveAll(TRUE);
  m_wsText.clear();
  LoadText(pwsStr, iLength, rect);
  if (m_dwStyles & FDE_TTOSTYLE_Ellipsis) {
    ReplaceWidthEllipsis();
  }
  Reload(rect);
  DoAlignment(rect);
  OnDraw(rtClip);
}
Example #13
0
void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView,
                                 CPDFSDK_Annot* pAnnot,
                                 CFX_RenderDevice* pDevice,
                                 CPDF_Matrix* pUser2Device,
                                 FX_DWORD dwFlags) {
  OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
}
Example #14
0
void WLTreeItemAL::_CustomInternalDraw(HDC hDC, RECT const &rcUpdate, RECT const &rcViewInThis) 
{
	CRect rcInHost ;
	GetRectInHost(rcInHost) ;
	RECT rcInsterset ;
	if (!IsWndLessVisible() || !::IntersectRect(&rcInsterset, &rcInHost, &rcUpdate))
		return ;

#ifdef _TRACEDRAW
	TRACE(_T("--> %S::_InternalOnDraw [%p]\n"), typeid(*this).name(), this) ;
	CString s ;
	s.Format(_T("<-- %S::_InternalOnDraw [%p]"), typeid(*this).name(), this) ;
	hdutils::CPUPerformance cp(s) ;
#endif

	CRect rc ;
	GetRectInParent(rc) ;

	if (m_nItemHeight > rcViewInThis.top)
	{
		OnDraw(hDC, rcUpdate) ;
	}

	CustomOnDrawChild(hDC, rcUpdate, rcViewInThis) ;
}
void CXTPReportHeaderDragWnd::OnPaint()
{
	CPaintDC dc(this);
	CXTPClientRect rc(this);
	CXTPBufferDC memDC(dc, rc);
	OnDraw(&memDC, rc);
}
void CBCGPSpinButtonCtrl::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	CBCGPMemDC memDC (dc, this);

	OnDraw (&memDC.GetDC ());
}
Example #17
0
void CView::OnPrint(CDC* pDC, CPrintInfo*)
{
	ASSERT_VALID(pDC);

	// Override and set printing variables based on page number
	OnDraw(pDC);                    // Call Draw
}
Example #18
0
void CScrollWnd::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	CDC	MemDC;
	MemDC.CreateCompatibleDC(&dc);
	CBitmap	MemBMP;
	
	CRect	rc;
	GetClientRect(rc);
	
	MemBMP.CreateCompatibleBitmap(&dc, rc.Width(), rc.Height());
	CBitmap* pOldBmp = MemDC.SelectObject(&MemBMP);
	MemDC.PatBlt(0, 0, rc.Width(), rc.Height(), WHITENESS);
	int nSavedDC = MemDC.SaveDC();

	OnPrepareDC(&MemDC);
	OnDraw(&MemDC);

	MemDC.RestoreDC(nSavedDC);

	dc.BitBlt(0, 0, rc.Width(), rc.Height(), &MemDC, 0, 0, SRCCOPY); 
	MemDC.SelectObject(pOldBmp);

//	OnDraw(&dc);
}
Example #19
0
BOOL CMovableObj::Draw(HDC hDC, LPRECT pRect)
{_STT();
	RECT rect, intersection;
	CopyRect( &rect, &m_rect );
	OffsetRect( &rect, -m_lXOff, -m_lYOff );

	// Punt if off the canvas
	if ( !IntersectRect( &intersection, pRect, &rect ) )
		return FALSE;	

	// Draw the object
	OnDraw( hDC, &rect );

	if ( m_bSelected )
	{
		// Draw the rect frame
		HBRUSH hBrush = CreateHatchBrush( HS_BDIAGONAL, RGB( 0, 0, 0 ) );
		FrameRect( hDC, &rect, hBrush );
		DeleteObject( hBrush );

		// Draw a focus rect
		DrawFocusRect( hDC, &rect );

	} // end if

	return TRUE;
}
Example #20
0
void CView::OnPaint()
{
	// standard paint routine
	CPaintDC dc(this);
	OnPrepareDC(&dc);
	OnDraw(&dc);
}
Example #21
0
void CBoxProxyView::OnMouseMove(UINT nFlags, CPoint point)
{
	// TODO: 在此添加消息处理程序代码和/或调用默认值
	if(MouseDown){
		if (lastPoint!=CPoint(0,0))
		{
			angle1+=(point.x-lastPoint.x)*up;
			angle2+=(point.y-lastPoint.y)*up;
			if (angle2>90)
			{
				angle1+=180;
				angle2=180-angle2;
				up=-up;
			}
			if(angle2<-90)
			{
				angle1+=180;
				angle2=-180-angle2;
				up=-up;
			}
			updateCam();
			CPaintDC dc(this);
			OnDraw(&dc);
		} 
		if(lastPoint!=point)
			lastPoint=point;		
	}

	CView::OnMouseMove(nFlags, point);
}
Example #22
0
// This calls OnDraw, having adjusted the origin according to the current
// scroll position
void wxScrolledWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
{
    wxPaintDC dc(this);
    PrepareDC(dc);

    OnDraw(dc);
}
Example #23
0
// CBoxProxyView 绘制
void CBoxProxyView::GetDepthMapFromView()
{
	glEnable(GL_DEPTH_TEST);
	//glDepthFunc(GL_LEQUAL);
	gettingDepth=true;
	sd.setShaders();
	ColorPos=sd.getAttrLocation("vColor");
	VertexPos=sd.getAttrLocation("vVertex");
	KRpos=sd.getUniformLocation("m_KR");
	KTpos=sd.getUniformLocation("m_KT");
	Matrix3d m_KR=cam.getKR();
	Vector3d m_KT=cam.getKT();
	float kr[9];
	double kt[3];
	for (int i = 0; i < 9; i++)
	{
		kr[i]=m_KR(i);
	}
	for (int i = 0; i < 3; i++)
	{
		kt[i]=m_KT(i);
	}
	glUniformMatrix3fvARB(KRpos,1,GL_FALSE,&kr[0]);
	glUniform3d(KTpos,kt[0],kt[1],kt[2]);
	setUpDepthCam();	

	CPaintDC dc(this);
	OnDraw(&dc);
	
}
Example #24
0
void CBoxProxyView::OpenXmlFile(CString fileName)
{
	if (myDepthMap!=NULL)
		reset();
	defaultFileName=fileName;

	BoxCreator BoxCreator;

	Para para;
	BoxCreator.loadBoxFromFile(fileName,boxes,para);
	downDir=boxes.at(0).GetWmBox().Axis[para.downDirIndex];
	type=para.type;


	myDepthMap=new MyDepthMap(para.depthFileName,para.imgFileName);

	myDepthMap->LoadDepthFromFile();
	Vector3d offset=myDepthMap->GetUnProjectedPoints(points,pColors);
	cX=offset(0);
	cY=offset(1);
	cZ=offset(2);

	updateCam();
	CPaintDC dc(this);
	OnDraw(&dc);
}
Example #25
0
	LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
	{
		switch( uMsg )
		{
			case WM_CREATE:
				m_hWnd = hWnd;
				if ( FAILED(SetupDirectDraw(GetParent(hWnd), hWnd, false)) ) // initialize DirectDraw
				{
					MessageBox(NULL, _T("Unable to Initialize DirectDraw"), _T("KDDWin"), MB_OK);
					CloseWindow(hWnd);
				}
				return 0;

			case WM_PAINT:
				OnDraw();
				ValidateRect(hWnd, NULL);
				return 0;

			case WM_NCPAINT:
				DefWindowProc(hWnd, uMsg, wParam, lParam);
				OnNCPaint();
				return 0;

			case WM_DESTROY:
				PostQuitMessage(0);
				return 0;

			default:
				return DefWindowProc(hWnd, uMsg, wParam, lParam);
		}
	}
Example #26
0
void CPrint::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
	ASSERT_VALID(pDC);
	// Override and set printing variables based on page number
	CurrentPage = pInfo->m_nCurPage -1 ;
	OnDraw(pDC);                    // Call Draw
}
Example #27
0
	void iWidget::Draw(float afTimeStep, cGuiClipRegion *apClipRegion)
	{
		if(mbVisible==false) return;
		
		OnDraw(afTimeStep, apClipRegion);

		cGuiClipRegion *pChildRegion = apClipRegion;
		if(mbClipsGraphics)
		{
			pChildRegion = apClipRegion->CreateChild(GetGlobalPosition(), mvSize);
			mpSet->SetCurrentClipRegion(pChildRegion);
		}

		OnDrawAfterClip(afTimeStep,apClipRegion);

		/////////////////////////////////
		//Draw callbacks
		cGuiMessageData data;
		data.mfVal = afTimeStep;
		data.mpData = apClipRegion;
		ProcessMessage(eGuiMessage_OnDraw, data);
		
		/////////////////////////////////
		//Draw children
		tWidgetListIt it = mlstChildren.begin();
		for(; it != mlstChildren.end(); ++it)
		{
			iWidget *pChild = *it;

			pChild->Draw(afTimeStep, pChildRegion);
		}

		if(mbClipsGraphics) mpSet->SetCurrentClipRegion(apClipRegion);
	}
Example #28
0
void CKingimageView::OnAdjustmentsLessbrightness()
{
	// TODO: Add your command handler code here
	CKingimageDoc* pDoc = GetDocument();

	int iBitPerPixel = pDoc->_bmp->bitsperpixel;
    int iWidth = pDoc->_bmp->width;
	int iHeight = pDoc->_bmp->height;
    BYTE *pImg = pDoc->_bmp->point;

	if(iBitPerPixel == 8)  ////Grey scale 8 bits image
	{

		for(int i=0; i<iHeight; i++)
		{
			for(int j=0; j<iWidth; j++)
			{
				if ((pImg[i*iWidth+j]-10) > 255) pImg[i*iWidth+j] = 255;
				else if ((pImg[i*iWidth+j] - 10) < 0) pImg[i*iWidth+j] = 0;
				else {
					pImg[i*iWidth+j] = pImg[i*iWidth+j] - 10; 
				}
			}
		}
		
	}
	////redraw the screen
	OnDraw(GetDC());
}
Example #29
0
void Application::OnDisplay()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    OnDraw();

    glutSwapBuffers();
}
Example #30
0
void
MFCSequenceEditor::OnPaint()
{
	// standard paint routine
	CPaintDC dc(this);
	OnPrepareDC(&dc);
	OnDraw(&dc);
}