/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CMySplashScreen::DrawImages(CWindowGc& aGc,const TRect& aRect,CGulIcon* aIcon) const { if(aIcon) { if(aIcon->Bitmap() && aIcon->Mask()) { if(aIcon->Bitmap()->Handle() && aIcon->Mask()->Handle()) { TSize ImgSiz(aIcon->Bitmap()->SizeInPixels()); TInt LFtMargin = aRect.iTl.iX + ((aRect.Width() - ImgSiz.iWidth) / 2); TInt RghMargin = aRect.iTl.iY + ((aRect.Height() - ImgSiz.iHeight) / 2); TRect DrwRect(LFtMargin,RghMargin,(ImgSiz.iWidth + LFtMargin),(ImgSiz.iHeight + RghMargin)); aGc.DrawBitmapMasked(DrwRect,aIcon->Bitmap(),TRect(0,0,ImgSiz.iWidth,ImgSiz.iHeight),aIcon->Mask(),EFalse); } } } }
/* ----------------------------------------------------------------------- ----------------------------------------------------------------------- */ void CTraceContainer::DrawMemory(const TRect& aRect, CWindowGc& gc) const { if(iMaskImg) { if(iMaskImg->Bitmap() && iMaskImg->Mask()) { if(iMaskImg->Bitmap()->Handle() && iMaskImg->Mask()->Handle()) { TSize ButtonSiz(iMaskImg->Bitmap()->SizeInPixels()); gc.DrawBitmapMasked(aRect,iMaskImg->Bitmap(),TRect(0,0,ButtonSiz.iWidth,ButtonSiz.iHeight),iMaskImg->Mask(),EFalse); } } } gc.SetPenColor(KRgbBlack); gc.DrawLine(aRect.iTl,TPoint(aRect.iTl.iX,aRect.iBr.iY)); gc.DrawLine(aRect.iTl,TPoint(aRect.iBr.iX,aRect.iTl.iY)); gc.DrawLine(aRect.iBr,TPoint(aRect.iTl.iX,aRect.iBr.iY)); gc.DrawLine(aRect.iBr,TPoint(aRect.iBr.iX,aRect.iTl.iY)); gc.SetPenColor(KRgbRed); TInt Prosentages(0); TBuf<100> FreeBuffer(_L("Free: ")); TBuf<100> TotalBuffer(_L("Total: ")); if(iArray.Count()) { if(iArray[iArray.Count() - 1]) { FreeBuffer.AppendNum(iArray[iArray.Count() - 1]->iMemory,EDecimal); TotalBuffer.AppendNum(iTotalRamInBytes,EDecimal); Prosentages = ((iArray[iArray.Count() - 1]->iMemory * 100) / iTotalRamInBytes); } } TInt SizPie = (aRect.Height() / 3); PieDrawer(gc,aRect.iTl,SizPie,Prosentages,EFalse); const CFont* MuFonr = AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont); TInt TextHeight= MuFonr->HeightInPixels(); TInt StartX = (aRect.iTl.iX + SizPie); TInt StartY = (aRect.iTl.iY + 2); gc.SetPenColor(KRgbBlack); gc.UseFont(MuFonr); gc.DrawText(FreeBuffer,TRect(StartX,StartY,aRect.iBr.iX,StartY + TextHeight),MuFonr->AscentInPixels(), CGraphicsContext::ELeft, 0); gc.DrawText(TotalBuffer,TRect(StartX,(StartY + TextHeight),aRect.iBr.iX,(StartY + (TextHeight * 2))),MuFonr->AscentInPixels(), CGraphicsContext::ELeft, 0); gc.SetPenColor(KRgbRed); StartX = 0; if(iArray.Count() > aRect.Width()) { StartX = (iArray.Count() - aRect.Width()); } TPoint MePoint1(aRect.iTl.iX,aRect.iBr.iY); TPoint MePoint2(aRect.iTl); TInt Valll(0); for(TInt i = StartX; i < iArray.Count(); i++) { if(iArray[i] && iTotalRamInBytes > 0) { Valll = ((aRect.Height() * iArray[i]->iMemory) / iTotalRamInBytes); } MePoint2.iY = (aRect.iBr.iY - Valll); if(StartX != 1) { gc.DrawLine(MePoint1,MePoint2); } MePoint1 = MePoint2; MePoint2.iX = MePoint2.iX + 1; } }
/* ----------------------------------------------------------------------- ----------------------------------------------------------------------- */ void CTraceContainer::DrawCPU(const TRect& aRect, CWindowGc& gc) const { if(iMaskImg) { if(iMaskImg->Bitmap() && iMaskImg->Mask()) { if(iMaskImg->Bitmap()->Handle() && iMaskImg->Mask()->Handle()) { TSize ButtonSiz(iMaskImg->Bitmap()->SizeInPixels()); gc.DrawBitmapMasked(aRect,iMaskImg->Bitmap(),TRect(0,0,ButtonSiz.iWidth,ButtonSiz.iHeight),iMaskImg->Mask(),EFalse); } } } gc.SetPenColor(KRgbBlack); gc.DrawLine(aRect.iTl,TPoint(aRect.iTl.iX,aRect.iBr.iY)); gc.DrawLine(aRect.iTl,TPoint(aRect.iBr.iX,aRect.iTl.iY)); gc.DrawLine(aRect.iBr,TPoint(aRect.iTl.iX,aRect.iBr.iY)); gc.DrawLine(aRect.iBr,TPoint(aRect.iBr.iX,aRect.iTl.iY)); TInt Prosentages(0); if(iArray.Count() && iMaxCpuCount) { if(iArray[iArray.Count() - 1]) { Prosentages = ((iArray[iArray.Count() - 1]->iCpuLoad * 100) / iMaxCpuCount); Prosentages = (100 - Prosentages); } } TInt SizPie = (aRect.Height() / 3); //TPoint(aRect.iTl.iX, (aRect.iBr.iY - SizPie)) PieDrawer(gc,aRect.iTl,SizPie,Prosentages,ETrue); gc.SetPenColor(KRgbRed); TInt StartX(0); if(iArray.Count() > aRect.Width()) { StartX = (iArray.Count() - aRect.Width()); } TPoint MePoint1(aRect.iTl.iX,aRect.iBr.iY); TPoint MePoint2(aRect.iTl); TInt Valll(0); if(iMaxCpuCount > 0) { for(TInt i = StartX; i < iArray.Count(); i++) { if(iArray[i]) { TUint32 Curr = (iMaxCpuCount - iArray[i]->iCpuLoad); if(Curr < 0) { Curr = 0; } else if(iMaxCpuCount < Curr) { Curr = iMaxCpuCount; } Valll = ((aRect.Height() * Curr) / iMaxCpuCount); } MePoint2.iY = (aRect.iBr.iY - Valll); if(StartX != 1) { gc.DrawLine(MePoint1,MePoint2); } MePoint1 = MePoint2; MePoint2.iX = MePoint2.iX + 1; } } }