Exemple #1
0
void _store_ekran1(void) {
	int scr=Screen();
	Screen(1);
	if( 0 == ekran1_buffer ) ekran1_buffer = ReserveBuffer(0,0,320,160);
	if( 0 != ekran1_buffer ) StoreBuffer(ekran1_buffer,0,0,320,24);
	Screen(scr);
}
Exemple #2
0
void CWsSpriteBase::SetPos(const TPoint &aPos)
	{
	//Non-floating anim whose window is destroyed 
	if (!IsFloating() && iWin==NULL) 
		{ 
		OwnerPanic(EWservPanicWindowDestroyed); 
		} 

	//Floating anim whose group window is destroyed 
	if (IsFloating()  && iGroupWin==NULL && iWin->WinType() != EWinTypeRoot) 
		{ 
		OwnerPanic(EWservPanicWindowDestroyed); 
		}
	
	if(IsFloating())
		{		
		TRect rect(iPos,iSize);
		}

	iBasePos=aPos;
	TPoint newPos(iBasePos+(*iMembers)[iCurIndex]->iOffset);
	if (iPos!=newPos)
		{
		if (!Screen()->ChangeTracking())
			//Ensure the region covered by the sprite before as well as after the move gets scheduled for redraw
			Screen()->SpriteManager()->Schedule(this);
		iPos=newPos;
		if (!Screen()->ChangeTracking())
			Screen()->SpriteManager()->Schedule(this);
		NotifyExtentChanged();
		}
	}
void CWsBackedUpWindow::SetSizeInTwips()
	{
	TSize size=iBitmap->SizeInPixels();
	size.iWidth=Screen()->DeviceMap().HorizontalPixelsToTwips(size.iWidth);
	size.iHeight=Screen()->DeviceMap().VerticalPixelsToTwips(size.iHeight);
	iBitmap->SetSizeInTwips(size);
	}
Exemple #4
0
void CWsSpriteBase::Deactivate()
	{
	//Disconnect from the sprite list and hide the sprite
	if (iFlags & ESpriteActive)
		{
		iFlags&=~ESpriteActive;
		
		MWsWindowTreeObserver* const windowTreeObserver = Screen()->WindowTreeObserver();
		if (windowTreeObserver)
			{
			windowTreeObserver->NodeReleased(*this);
			}
		
		if (iMembers && iMembers->Count()>1)
			{
			iDeltaTimer->Remove(iDeltaTimerEntry);
			}
		
		if (IsFloating())
			{
			Screen()->SpriteManager()->RemoveFloatingSprite(this);
			if (!Screen()->ChangeTracking())
				{
				ForceRedraw();
				}
			}

		// Note: This could be a floating sprite attached to the root window (PDEF138379)
		if(iWin)
			{
			iWin->RemoveSprite(this);
			}
		}
	}
Exemple #5
0
/**
 @pre	CWsSpriteBase::CalcRedrawRegion(TRegion&,TRegion&) should have been called.
 @param aRegion Is the region that will definitely be redrawn if dirty. This param should
                be calculated by calling CalcRedrawRegion(TRegion&,TRegion&)
 */
void CWsSpriteBase::Redraw(MWsGraphicsContext * aGc, const TRegion& aRegion)
	{
	TFlashState currentState=EFlashOn;
	if(IsFlashingEnabled())
		{
		currentState=Screen()->SpriteManager()->CurrentSpriteFlashState(this);
		AnnotateSpriteFlash(*this, currentState==EFlashOn);
		}

	if(currentState==EFlashOn && (IsDirty() || HasAnimation()) )
		{
		const TRegion * pr = &aRegion;

		if (pr->CheckError())
			{
			if(iWin)
				{
				if (Screen()->ChangeTracking())
					pr = &iWin->WindowArea();
				else
					pr = &iWin->VisibleRegion();
				}
			else
				pr = &RootWindow()->WindowArea();
			}

		if (!pr->IsEmpty())
			{
			CWsSpriteMember *member=(*iMembers)[iCurIndex];
			if (member->iBitmap)
				{
				aGc->SetClippingRegion(*pr);

				// Calculate which piece (rect) of the bitmap needs to be drawn
				const TRect redrawRect = pr->BoundingRect();
				TRect bitmapRect(Pos(), iSize); // sprite rect relative to screen
				bitmapRect.Intersection(redrawRect);
				bitmapRect.Move(-Pos()); // adjust relative to bitmap origin

				if (member->iMaskBitmap)
					aGc->BitBltMasked(Pos() + bitmapRect.iTl, *member->iBitmap, bitmapRect, *member->iMaskBitmap, member->iInvertMask);
				else
					{
					aGc->SetDrawMode(BitGdiToMWsGraphicsContextMappings::LossyConvert(member->iDrawMode));
					aGc->BitBlt(Pos() + bitmapRect.iTl, *member->iBitmap, bitmapRect);
					aGc->SetDrawMode(MWsGraphicsContext::EDrawModePEN);
					}
				aGc->ResetClippingRegion();
				}
			}
		if (Screen()->ChangeTracking())
			SetDirty(EFalse);
		
		}
		
	//Flashing sprites need to reschedule themselves after drawing (unless they have
	//an animation, because for animating sprites the rescheduling is done in CWsAnim).
	if(IsFlashingEnabled() && !HasAnimation())
		Screen()->SpriteManager()->Schedule(this);
	}
Exemple #6
0
void _restore_ekran1(void) {
	if( 0 != ekran1_buffer ) {
		int scr=Screen();
		Screen(1);
		RestoreBuffer(ekran1_buffer);
		Screen(scr);
	}
}
Exemple #7
0
void CWsSpriteBase::TimerExpired()
	{
	if (!Screen()->ChangeTracking())
		Screen()->SpriteManager()->Schedule(this);
	SetMember((iCurIndex+1)==iMembers->Count() ? 0 : iCurIndex+1);
	SetDirty(ETrue);
	Screen()->SpriteManager()->Schedule(this);
	QueueDeltaTimer();
	}
TBool CWsBackedUpWindow::DrawCommand(CWsGc*,const TAny*)
	{
	if (Screen()->ChangeTracking())
		MarkDirtyAndSchedule(iCurrentRegion);
	else
		Screen()->AddRedrawRegion(iWsWin->VisibleRegion());
	
	return ETrue;
	}
Exemple #9
0
void CWsSpriteBase::NotifyExtentChanged() const
	{
	if (Screen())
		{
		MWsWindowTreeObserver* windowTreeObserver = Screen()->WindowTreeObserver();
		if (windowTreeObserver && iFlags&ESpriteActive)
			{
			windowTreeObserver->NodeExtentChanged(*this, Rect());
			}
		}
	}
/** 
This function updates the window's dirty region and schedules a redraw if needed.
Only used when the screen is run in CHANGETRACKING mode. 
@param aRegion in window coordinates
*/
void CWsBackedUpWindow::MarkDirtyAndSchedule(const TRegion& aRegion)
	{
	WS_ASSERT_DEBUG(Screen()->ChangeTracking(),EWsPanicNoChangetracking);
	
	if(!aRegion.IsEmpty())
		{
		iWsWin->AddDirtyWindowRegion(aRegion);
		if (iWsWin->IsActive() && iWsWin->IsVisible())
			{
			Screen()->ScheduleWindow(iWsWin);
			}
		}
	}
Exemple #11
0
CWsRootWindow::~CWsRootWindow()
	{
	if (Screen() && (iBaseWinFlags&EBaseWinNodeCreated))
		{
		MWsWindowTreeObserver* const windowTreeObserver = Screen()->WindowTreeObserver();
		if (windowTreeObserver)
			{
			windowTreeObserver->NodeReleased(*this);
			iBaseWinFlags &= ~EBaseWinNodeCreated;
			}
		}
	Shutdown();
	}
/**
This function selects the desired behaviour depending on whether the screen is
run in CHANGETRACKING mode or not. 
@param aRegion in screen coordinates
*/
void CWsBackedUpWindow::UpdateScreen(const TRegion& aRegion)
	{
	if (Screen()->ChangeTracking())
		{
		STACK_REGION region;
		region.Copy(aRegion);
		region.Offset(-WsWin()->Origin()); //convert to window coordinates 
		MarkDirtyAndSchedule(region);
		region.Close();		
		}
	else
		{
		Screen()->AddRedrawRegion(aRegion);
		}
	}
Exemple #13
0
// this is reimplemented from QAbstractItemView::startDrag()
void ScreenSetupView::startDrag(Qt::DropActions)
{
	QModelIndexList indexes = selectedIndexes();

	if (indexes.count() != 1)
		return;

	QMimeData* pData = model()->mimeData(indexes);
	if (pData == NULL)
		return;

	QPixmap pixmap = *model()->screen(indexes[0]).pixmap();
	QDrag* pDrag = new QDrag(this);
	pDrag->setPixmap(pixmap);
	pDrag->setMimeData(pData);
	pDrag->setHotSpot(QPoint(pixmap.width() / 2, pixmap.height() / 2));

	if (pDrag->exec(Qt::MoveAction, Qt::MoveAction) == Qt::MoveAction)
	{
		selectionModel()->clear();

		// make sure to only delete the drag source if screens weren't swapped
		// see ScreenSetupModel::dropMimeData
		if (!model()->screen(indexes[0]).swapped())
			model()->screen(indexes[0]) = Screen();
		else
			model()->screen(indexes[0]).setSwapped(false);
	}
}
/**
 * @brief applyOpenGLCameraFOV
 * @param fieldOfView
 * @param zNear
 * @param zFar
 */
void VolumetricHelicoidWidget::applyOpenGLCameraFOV()
{
#ifdef MONA
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    /*
    cam.setNearFarPlanes(this->zNear,this->zFar);
    cam.setOrthoGraphicProjection(true);
    cam.init(Screen(431.0,272.0,0.0,0.0,eyeZ));
    cam.setEye(Vector3d(0,0,0));
    */
    gluPerspective(this->FOV, (float)this->width() / (float)this->height(), this->zNear,this->zFar);
    //glOrtho(eyeZ,-eyeZ,eyeZ,-eyeZ,0.1,10000);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
#endif
    double ratio = (float)this->projectorPixelHeight/(float)this->projectorPixelWidth;
    cam.setOrthoGraphicProjection(true);
    this->cam.init(Screen(500.0,500.0*ratio,0,0,this->eyeZ));
    this->cam.setNearFarPlanes(this->zNear,this->zFar);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    cam.setEye(Vector3d(0,0,0));
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}
Exemple #15
0
/*--------------------------------------------------------------------------*/
void PegLinearBitmapScale::Draw()
{
    if(!mpCompBitmap)
    {
        mpCompBitmap = Screen()->CreateBitmap(mpBkgBitmap->wWidth,
                                              mpBkgBitmap->wHeight);
    }

    DrawToComposite();

    BeginDraw();

    PegPoint tPoint;
    tPoint.x = mReal.wLeft;
    tPoint.y = mReal.wTop;

    Bitmap(tPoint, mpCompBitmap);

    if(!mpNeedleBitmap)
    {
        DrawNeedle();
    }

    DrawChildren();

    EndDraw();
}
Exemple #16
0
/*--------------------------------------------------------------------------*/
PegLinearBitmapScale::~PegLinearBitmapScale()
{
	if(mpCompBitmap)
	{
		Screen()->DestroyBitmap(mpCompBitmap);
	}
}
Exemple #17
0
void Add()
{
	char s;

	p=fopen("tele.txt","a");

	printf("\nName:");
	fflush(stdin);
	gets(e.name);

	printf("\nNo:");
	gets(e.no);

	fwrite(&e,resize,1,p);

	fclose(p);
	back:

	printf("Want to add more?(y/n)");
	scanf("%c",&s);

	if(s=='y'|| s=='Y')
	{
		Add();
	}
	else if(s=='n' || s=='N')
	{
		clrscr();
		Screen();
		Menu();
	}
	else
	goto back;
}
Exemple #18
0
void
CanvasClientSharedSurface::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
{
  if (mFront) {
    mPrevFront = mFront;
    mFront = nullptr;
  }

  auto gl = aLayer->mGLContext;
  gl->MakeCurrent();

  if (aLayer->mGLFrontbuffer) {
    mFront = CloneSurface(aLayer->mGLFrontbuffer.get(), aLayer->mFactory.get());
    if (mFront)
      mFront->Surf()->Fence();
  } else {
    mFront = gl->Screen()->Front();
    if (!mFront)
      return;
  }
  MOZ_ASSERT(mFront);

  // Alright, now sort out the IPC goop.
  SharedSurface* surf = mFront->Surf();
  auto forwarder = GetForwarder();
  auto flags = GetTextureFlags() | TextureFlags::IMMUTABLE;

  // Get a TexClient from our surf.
  RefPtr<TextureClient> newTex = TexClientFromShSurf(surf, flags);
  if (!newTex) {
    auto manager = aLayer->ClientManager();
    auto shadowForwarder = manager->AsShadowForwarder();
    auto layersBackend = shadowForwarder->GetCompositorBackendType();

    newTex = TexClientFromReadback(surf, forwarder, flags, layersBackend);
  }
  MOZ_ASSERT(newTex);

  // Add the new TexClient.
  MOZ_ALWAYS_TRUE( AddTextureClient(newTex) );

  // Remove the old TexClient.
  if (mFrontTex) {
    // remove old buffer from CompositableHost
    RefPtr<AsyncTransactionTracker> tracker = new RemoveTextureFromCompositableTracker();
    // Hold TextureClient until transaction complete.
    tracker->SetTextureClient(mFrontTex);
    mFrontTex->SetRemoveFromCompositableTracker(tracker);
    // RemoveTextureFromCompositableAsync() expects CompositorChild's presence.
    GetForwarder()->RemoveTextureFromCompositableAsync(tracker, this, mFrontTex);

    mFrontTex = nullptr;
  }

  // Use the new TexClient.
  mFrontTex = newTex;

  forwarder->UpdatedTexture(this, mFrontTex, nullptr);
  forwarder->UseTexture(this, mFrontTex);
}
void CWsBackedUpWindow::Resize(const TSize &aSize, const TSize &aOldSize)
	{
	ActivateGc();
	iBitGc->SetClippingRegion(NULL);
	iBitGc->Clear(TRect(aOldSize.iWidth, 0, aSize.iWidth, aOldSize.iHeight));
	iBitGc->Clear(TRect(0, aOldSize.iHeight,aSize.iWidth, aSize.iHeight));
	
	static_cast<CWsClientWindow *>(iWsWin)->ReactivateGcs();
	
	if(Screen()->ChangeTracking())
		{
		//Keep track of the region we need to refresh when we recieve draw commands
		iCurrentRegion.Reset();
		iCurrentRegion.Copy(iWsWin->WindowArea());
		iCurrentRegion.Offset(-iWsWin->Origin());
		iCurrentRegion.Tidy();
		if(iCurrentRegion.CheckError())
			{
			iCurrentRegion.Reset();
			TRegionFix<1> fallback(iWsWin->AbsRect());
			iCurrentRegion.Copy(fallback); 
			iCurrentRegion.Offset(-iWsWin->Origin());
			}
		
		//If the window has nerver been drawn to screen, we now schedule the initial draw. This can't
		//be done in ConstructL because BackedUpWindows are created with size(0,0). And we can't check
		//iWsWin->IsActive() because the client might activate the window before giving it a size.
		if (!iHasBeenScheduled)
			{
			iHasBeenScheduled = ETrue;
			MarkDirtyAndSchedule(iCurrentRegion);
			}
		}
	}
Exemple #20
0
/*--------------------------------------------------------------------------*/
void PegWindow::Resize(PegRect NewSize)
{
    PegThing *Child;
    PegMessage NewMessage(PM_PARENTSIZED);
    PegThing::Resize(NewSize);

    if (muScrollMode & WSM_AUTOSCROLL)
    {
        if (CheckAutoScroll())
        {
            UpdateChildClipping();

            if (StatusIs(PSF_VISIBLE))
            {
               #ifdef PEG_FULL_CLIPPING
                Screen()->GenerateViewportList(this);
               #endif

                Invalidate(mReal);
            }
        }
    }

    Child = First();
    while(Child)
    {
        Child->Message(NewMessage);
        Child = Child->Next();
    }
}
Exemple #21
0
CWsSprite::~CWsSprite()
	{
	if (!IsFloating() && IsActivated() && iWin && iWin->IsVisible() && !Screen()->ChangeTracking())
	    ForceRedraw();
	if (iAnim)
		CWsAnim::CloseAnim(iAnim);
	}
Exemple #22
0
/*--------------------------------------------------------------------------*/
void PegBitmapWindow::Draw()
{
	PegPoint tPutBitmap;
	PegRect CaptureRect;

  if (!mbCaptured)
  {
      // Capture the four bitmaps on my corners
      CaptureRect.wLeft = mReal.wLeft;
      CaptureRect.wTop = mReal.wTop;
      CaptureRect.wRight = CaptureRect.wLeft + CORNER_RADIUS;
      CaptureRect.wBottom = CaptureRect.wTop + CORNER_RADIUS;
      Screen()->Capture(&mCaptures[TOP_LEFT], CaptureRect);

			CaptureRect.Shift(mReal.Width() - CORNER_RADIUS, 0);
      Screen()->Capture(&mCaptures[TOP_RIGHT], CaptureRect);

			CaptureRect.Shift(0, mReal.Height() - CORNER_RADIUS);
      Screen()->Capture(&mCaptures[BOTTOM_RIGHT], CaptureRect);

      CaptureRect.Shift(-(mReal.Width() - CORNER_RADIUS), 0);
      Screen()->Capture(&mCaptures[BOTTOM_LEFT], CaptureRect);
      mbCaptured = TRUE;
  }

	BeginDraw();

  muColors[PCI_NORMAL] = mFillColor; /* set default value with given color */

	if (mpBitmap == NULL)
	{ /* no bitmap given, so fill frame with given color */
		DrawFrame();
	}
	else
	{
		Screen()->Restore(this, &mCaptures[TOP_LEFT]);
    Screen()->Restore(this, &mCaptures[TOP_RIGHT]);
    Screen()->Restore(this, &mCaptures[BOTTOM_RIGHT]);
    Screen()->Restore(this, &mCaptures[BOTTOM_LEFT]);

		if (mBitmapStyle == kCenterBitmap)
		{ /* center bitmap in window */
			tPutBitmap.x = mReal.wLeft + ((mReal.wRight - mReal.wLeft) - mpBitmap->wWidth)/2;
			tPutBitmap.y = mReal.wTop + ((mReal.wBottom - mReal.wTop) - mpBitmap->wHeight)/2;
		}
		else
    {
      tPutBitmap.x = mReal.wLeft;
      tPutBitmap.y = mReal.wTop;
    }

		Bitmap(tPutBitmap, mpBitmap); /* set bitmap */
	}

	DrawChildren(); /* draw buttons */
	EndDraw();
}
Exemple #23
0
void CWsSpriteBase::CommandL(TInt aOpcode, const TAny *aCmdData)
	{
	TWsSpriteCmdUnion pData;

	pData.any=aCmdData;
	switch(aOpcode)
		{
		case EWsSpriteOpAppendMember:
			AppendMemberL(*pData.SpriteMember);
			break;
		case EWsSpriteOpActivate:
			if(!(iFlags&ESpriteActive))
				CompleteL();
			break;
		case EWsSpriteOpUpdateMember:
			if (pData.UpdateMember->index==iCurIndex)
				{
				SetDirty(ETrue);
				TRect rect(Pos(), iMaxSize);
				Screen()->SpriteManager()->Schedule(this,&rect);
				}
			break;
		case EWsSpriteOpUpdateMember2:
			{
			SetDirty(ETrue);
			Screen()->SpriteManager()->Schedule(this);
			if (pData.UpdateMember->index<0 || pData.UpdateMember->index>=iMembers->Count())
				User::Leave(KErrArgument);
			CWsSpriteMember *member=(*iMembers)[pData.UpdateMember->index];
			TBool ret=EFalse;
			TRAPD(err,ret=UpdateMemberL(member,pData.UpdateMember->data));
			if (err==KErrNone)
				{
				TRAP(err,CheckSizesL());
				SetMember(0);
				}
			Screen()->SpriteManager()->Schedule(this);
			User::LeaveIfError(err);
			if (ret)
				OwnerPanic(EWservPanicBitmap);
			}
			break;
		default:
			OwnerPanic(EWservPanicOpcode);
			break;
		}
	}
Exemple #24
0
void CWsRootWindow::SetSystemFaded(TBool aFaded, TUint8 aBlackMap, TUint8 aWhiteMap)
	{
	WS_ASSERT_DEBUG(Screen(),EWsPanicNoScreen);
	
	TBool stateChanged = EFalse; //will be set to true if one or more windows change fade state.
	for(CWsWindowGroup* win=Child();win!=NULL;win=win->NextSibling())
		{
		TWalkWindowTreeSetSystemFaded wwt(aFaded, win, aBlackMap, aWhiteMap, stateChanged);
		win->WalkWindowTree(wwt,EWalkChildren);
		}

	MWsWindowTreeObserver* windowTreeObserver = Screen()->WindowTreeObserver();
	if(windowTreeObserver && stateChanged)
		{
		windowTreeObserver->FadeAllChildren(*this, aFaded);
		}
	}
Exemple #25
0
void main()
{
clrscr();
Screen();
Menu();

getch();
}
Exemple #26
0
int main()
{
	sf::RenderWindow Screen (sf::VideoMode (800, 600, 32), "SFML Made Easy");
	Screen.Display(); 
	system("pause");
	
	return 0;
}
Exemple #27
0
/**
@see MAnimSpriteFunctions::UpdateMember
@param aFullUpdate	Not used. Wserv2 always do full back to front rendering, so there is no distinction between changes needing aFullUpdate or not 
 */
void CWsSprite::Update(TInt aMember,TRect aRect,TBool /*aFullUpdate*/) 
	{
	if (iCurIndex!=aMember)
		return;
	aRect.Move(Pos());
	aRect.Intersection(iScreen->CurrentScreenSize());
	SetDirty(ETrue);
	Screen()->SpriteManager()->Schedule(this, &aRect);
	}
Exemple #28
0
void CWsWindow::SetNonFading(TBool aNonFade)
	{
	const TUint oldFlags = iFlags;

	if (aNonFade)
		iFlags|=EFlagNonFadingWindow;
	else
		iFlags&=(~EFlagNonFadingWindow);
	
 	//Schedule window for quickfade if non-fading flag is changed	
	if (!Screen()->ChangeTracking() &&  CWsTop::IsFadeEnabled() && (oldFlags != iFlags) ) 
		{
		Screen()->AcceptFadeRequest(this, !aNonFade);
		}
	
	MWsWindowTreeObserver* const windowTreeObserver = Screen()->WindowTreeObserver();
	if (windowTreeObserver && oldFlags!=iFlags)
		windowTreeObserver->FlagChanged(*this, MWsWindowTreeObserver::ENonFading, aNonFade); 
	}
Exemple #29
0
/**
 * @brief ExperimentGLWidget::initMonitor
 * @param EXPERIMENT_WINDOW_RESOLUTION_X
 * @param EXPERIMENT_WINDOW_RESOLUTION_Y
 * @param EXPERIMENT_WINDOW_PHYSICAL_SIZE_MM_X
 * @param EXPERIMENT_WINDOW_PHYSICAL_SIZE_MM_Y
 */
void ExperimentGLWidget::initMonitor(int resX, int resY, int sizeX_mm, int sizeY_mm)
{
    this->experimentWindowResolutionX = resX;
    this->experimentWindowResolutionY = resY;

    this->resize(resX,resY);
    // Camera calibrations done on the flight
    this->cam.init(Screen(sizeX_mm,sizeY_mm,0,0,eyeZ));
    this->cam.setNearFarPlanes(0.01,1E5);
}
Exemple #30
0
void CWsTop::RedrawScreens()
	{
	// apply to all screens
	TInt screenNo;
	for(screenNo=0; screenNo<iNumberOfScreens; ++screenNo)
		{
		CScreen* screen = Screen(screenNo);
		TRegionFix<1> screenArea(TRect(screen->DrawableArea()));
		}
	}