Ejemplo n.º 1
0
/**
@SYMTestCaseID		GRAPHICS-WSERV-GCE-0700

@SYMDEF  			DEF123129

@SYMTestCaseDesc    Test activating a sprite twice does not cause the system to hang

@SYMTestPriority    High

@SYMTestStatus      Implemented

@SYMTestActions     Construct a sprite and add a member to it. Activate twice.

@SYMTestExpectedResults The test should terminate smoothly and it should not hang the system.
*/
void CTTSprite::DoubleActivateL()
	{
	RWsSession ws;
	User::LeaveIfError(ws.Connect());
	CleanupClosePushL(ws);
	
	RWindowGroup group(ws);
	User::LeaveIfError(group.Construct(890, EFalse));
	CleanupClosePushL(group);
	
	RWsSprite sprite = RWsSprite(ws);
	User::LeaveIfError(sprite.Construct(group,TPoint(),0));
	CleanupClosePushL(sprite);
	CFbsBitmap* bitmap=new(ELeave) CFbsBitmap;
	CleanupStack::PushL(bitmap);
	User::LeaveIfError(bitmap->Create(TSize(10,12),EColor256));
	TSpriteMember member;
	member.iMaskBitmap=NULL;
	member.iInvertMask=EFalse;
	member.iDrawMode=CGraphicsContext::EDrawModePEN;
	member.iOffset=TPoint();
	member.iInterval=TTimeIntervalMicroSeconds32(0);
	member.iBitmap=bitmap;
	User::LeaveIfError(sprite.AppendMember(member));
	User::LeaveIfError(sprite.Activate());
	User::LeaveIfError(sprite.Activate());
	
	sprite.Close();
	CleanupStack::PopAndDestroy(4, &ws);
	
	group.Close();
	ws.Close();
	}
// ----------------------------------------------------------------------------
// RImageCommander::CreateSpriteL(TSize aSize, RWindowGroup& aGroup)
// ----------------------------------------------------------------------------
//
void RImageCommander::CreateSpriteL(TSize aSize, RWindowGroup& aGroup)
    {
    DBG(RDebug::Print(_L("RImageCommander::CreateSpriteL START")));
    TSpriteMember member;
    

    DBG(RDebug::Print(_L("RImageCommander::CreateSpriteL size %d,%d"), aSize.iWidth, aSize.iHeight));
    (void)aSize;

    iSprite=RWsSprite(iSession);
    TInt error = iSprite.Construct(aGroup, TPoint(),ESpriteNoChildClip|ESpriteNoShadows);
    User::LeaveIfError(error);
    iBaseBitmap = new (ELeave) CFbsBitmap;
    // Drive Letter:
    TFileName file(CEikonEnv::Static()->EikAppUi()->Application()->AppFullName().Left(2));
    // Path and file name:
    file.Append( KBTMOUSEMBMFileName ); // always safe

    User::LeaveIfError(iBaseBitmap->Load(file, EMbmBtmousebitmapsCursor));
    iBaseMaskBitmap = new (ELeave) CFbsBitmap;
    User::LeaveIfError(iBaseMaskBitmap->Load(file, EMbmBtmousebitmapsCursormask));
    FillInSpriteMember(member, iBaseBitmap, iBaseMaskBitmap);
    User::LeaveIfError(iSprite.AppendMember(member));
    
    DBG(RDebug::Print(_L("RImageCommander::CreateSpriteL END")));

    }
Ejemplo n.º 3
0
void CSpriteSet::ConstructL(RWindowTreeNode& aWindow, RWsSession& aWs, CWsScreenDevice& aDevice)
	{
    TInt grayscaleCapabilities;
	TInt colorCapabilities;
	const TDisplayMode mode=aWs.GetDefModeMaxNumColors(colorCapabilities,grayscaleCapabilities);
	iTargetBitmap = new (ELeave) CWsBitmap(aWs);
	const TSize zeroSize(0,0);
	User::LeaveIfError(iTargetBitmap->Create(zeroSize,mode));
	iTargetMaskBitmap = new (ELeave) CWsBitmap(aWs);
	User::LeaveIfError(iTargetMaskBitmap->Create(zeroSize,mode));

	iSprite=RWsSprite(aWs);
	User::LeaveIfError(iSprite.Construct(aWindow, TPoint(KOffScreenValue,KOffScreenValue), ESpriteNoChildClip));
	CreateSpriteMember();
	iSprite.AppendMember(iSpriteMember);
	iSprite.Activate();
	iMainFbsBitGc=CFbsBitGc::NewL();	// for the main bitmap

	iWindowToBitmapMappingGc = CWindowToBitmapMappingGc::NewL(aDevice,*iMainFbsBitGc);	// takes place of iMainFbsBitGc (not passing ownership of context here !)
	iMaskFbsBitGc=CFbsBitGc::NewL();	// for the mask bitmap

	iMainBmpDevice=CFbsBitmapDevice::NewL(iTargetBitmap);
	iMaskBmpDevice=CFbsBitmapDevice::NewL(iTargetMaskBitmap);

	iMainFbsBitGc->Activate(iMainBmpDevice);
	iMaskFbsBitGc->Activate(iMaskBmpDevice);
	}
Ejemplo n.º 4
0
void CTTSprite::SetUpSpriteL(RWsSprite &aSprite, RWsSession &aSession, RWindowTreeNode &aWindow,TInt aFlags/*=0*/)
	{
	aSprite=RWsSprite(aSession);
	User::LeaveIfError(aSprite.Construct(aWindow,TPoint(),aFlags));
	TSpriteMember member;
	SetUpMember(member);
	User::LeaveIfError(aSprite.AppendMember(member));
	User::LeaveIfError(aSprite.Activate());
	}
Ejemplo n.º 5
0
/*
 * shows the pointer sprite by constructing a native handle, and registering
 * it with the window server.
 * Only used when the sprite workaround is in use.
 */
void qt_symbian_show_pointer_sprite()
{
    if (cursorSprite.d) {
        if (cursorSprite.d->scurs.WsHandle())
            cursorSprite.d->scurs.Close();
    } else {
        cursorSprite = QCursor(Qt::ArrowCursor);
    }

    cursorSprite.d->scurs = RWsSprite(S60->wsSession());
    QPoint pos = QCursor::pos();
    cursorSprite.d->scurs.Construct(S60->windowGroup(), TPoint(pos.x(), pos.y()), ESpriteNoChildClip | ESpriteNoShadows);

    cursorSprite.d->constructCursorSprite(cursorSprite.d->scurs);
    cursorSprite.d->scurs.Activate();
}
Ejemplo n.º 6
0
/** Creates a sprite.
*/
TInt COomSprite::Fail()
	{
	iSprite=RWsSprite(iWs);
	TInt err=iSprite.Construct(iWin,TPoint(10,10),0);
	if (err==KErrNone)
		{
		TSpriteMember sprite;
		sprite.iBitmap=iBitmap;
		sprite.iMaskBitmap=iMask;
		sprite.iInvertMask=EFalse;
		sprite.iDrawMode=CGraphicsContext::EDrawModePEN;
		sprite.iOffset=TPoint(0,0);
		sprite.iInterval=TTimeIntervalMicroSeconds32(100000);
		if ((err=iSprite.AppendMember(sprite))==KErrNone)
			if ((err=iSprite.Activate())==KErrNone)
				{
				sprite.iBitmap=iBitmap2;		// Bigger bitmap to force resize of bitmap
				sprite.iMaskBitmap=iMask2;
				if ((err=iSprite.AppendMember(sprite))==KErrNone)
					err=iSprite.UpdateMember(1,sprite);
				}
		}
	return(err);
	}