os/graphics/windowing/windowserver/nga/SERVER/WSANIMGC.CPP
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Interface code for animated DLL's GC
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <e32std.h>
sl@0
    19
#include "server.h"
sl@0
    20
#include "playbackgc.h"
sl@0
    21
#include "ANIM.H"
sl@0
    22
#include "wsfont.h"
sl@0
    23
#include "bitgditomwsgraphicscontextmappings.h"
sl@0
    24
#include "devicemap.h"
sl@0
    25
sl@0
    26
CWsAnimGc::CWsAnimGc(CWsAnim& aWsAnim) : iOwningWsAnim(aWsAnim), iUserActive(EFalse), iUseDrawingRegion(EFalse)
sl@0
    27
	{
sl@0
    28
	__DECLARE_NAME(_S("CWsAnimGc"));
sl@0
    29
	}
sl@0
    30
sl@0
    31
CWsAnimGc::~CWsAnimGc()
sl@0
    32
	{
sl@0
    33
	iDrawingRegion.Close();
sl@0
    34
	}
sl@0
    35
sl@0
    36
void CWsAnimGc::Activate(const TRegion* aRegion, MWsGraphicsContext* aGc)
sl@0
    37
	{
sl@0
    38
	iBaseRegion = aRegion ? aRegion : iOwningWsAnim.ClientWindow()->DrawingRegion();
sl@0
    39
	iGc = aGc;
sl@0
    40
	iUserActive = ETrue;
sl@0
    41
	Reset();
sl@0
    42
	}
sl@0
    43
sl@0
    44
void CWsAnimGc::Deactivate()
sl@0
    45
	{
sl@0
    46
	CloseCurrentFont();
sl@0
    47
	iGc = NULL;
sl@0
    48
	iUserActive = EFalse;
sl@0
    49
	iUseDrawingRegion = EFalse;
sl@0
    50
	iDrawingRegion.Close();
sl@0
    51
	}
sl@0
    52
sl@0
    53
TBool CWsAnimGc::IsActive() const
sl@0
    54
	{
sl@0
    55
	return (iUserActive || (iGc != NULL));
sl@0
    56
	}
sl@0
    57
sl@0
    58
void CWsAnimGc::UserActivate()
sl@0
    59
	{
sl@0
    60
	if (iUserActive)
sl@0
    61
		{
sl@0
    62
		// Already active
sl@0
    63
		UserDeactivate();
sl@0
    64
		iOwningWsAnim.SessionPanic();
sl@0
    65
		}
sl@0
    66
	iUserActive = ETrue;
sl@0
    67
	}
sl@0
    68
sl@0
    69
void CWsAnimGc::UserDeactivate()
sl@0
    70
	{
sl@0
    71
	CloseCurrentFont();
sl@0
    72
sl@0
    73
	if (iUserActive)
sl@0
    74
		{
sl@0
    75
		iUserActive = EFalse;
sl@0
    76
		}
sl@0
    77
	}
sl@0
    78
sl@0
    79
CGraphicsDevice* CWsAnimGc::Device() const
sl@0
    80
	{
sl@0
    81
	if (!iUserActive)
sl@0
    82
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
    83
sl@0
    84
	return NULL; //deprecated
sl@0
    85
	}
sl@0
    86
sl@0
    87
void CWsAnimGc::SetClippingRect(const TRect& aRect)
sl@0
    88
	{
sl@0
    89
	if (!iUserActive)
sl@0
    90
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
    91
sl@0
    92
	if (iGc)
sl@0
    93
		{
sl@0
    94
		iClippingRect = aRect;
sl@0
    95
		iClippingRect.Move(iOwningWsAnim.ClientWindow()->Origin());
sl@0
    96
		iClippingRect.Intersection(iOwningWsAnim.ClientWindow()->AbsRect());
sl@0
    97
sl@0
    98
		STACK_REGION region;
sl@0
    99
		region.Copy(*iBaseRegion);
sl@0
   100
		if (iUseDrawingRegion)
sl@0
   101
			region.Intersect(iDrawingRegion);
sl@0
   102
		region.ClipRect(iClippingRect);
sl@0
   103
		region.Tidy();
sl@0
   104
sl@0
   105
		iGc->SetClippingRegion(region);
sl@0
   106
		region.Close();
sl@0
   107
sl@0
   108
		if (iGc->GetError())
sl@0
   109
			iClippingRect = iOwningWsAnim.ClientWindow()->AbsRect(); // On error revert to the default clipping rect
sl@0
   110
		}
sl@0
   111
	}
sl@0
   112
sl@0
   113
TInt CWsAnimGc::SetClippingRegion(const TRegion &aRegion)
sl@0
   114
	{
sl@0
   115
	if (!iUserActive)
sl@0
   116
		return KErrGeneral;
sl@0
   117
sl@0
   118
	TInt error = KErrNone;
sl@0
   119
	if (iGc)
sl@0
   120
		{
sl@0
   121
		STACK_REGION region;
sl@0
   122
		region.Copy(aRegion);
sl@0
   123
		region.Offset(iOwningWsAnim.ClientWindow()->Origin());
sl@0
   124
		region.Intersect(*iBaseRegion);
sl@0
   125
		region.ClipRect(iClippingRect);
sl@0
   126
		region.Tidy();
sl@0
   127
sl@0
   128
		iGc->SetClippingRegion(region);
sl@0
   129
		region.Close();
sl@0
   130
sl@0
   131
		error = iGc->GetError();
sl@0
   132
		if (!error)
sl@0
   133
			{ // Need to keep a copy of the region in screen coordinates
sl@0
   134
			iDrawingRegion.Copy(aRegion);
sl@0
   135
			iDrawingRegion.Offset(iOwningWsAnim.ClientWindow()->Origin());
sl@0
   136
			iUseDrawingRegion = ETrue;
sl@0
   137
			}
sl@0
   138
		}
sl@0
   139
	return error;
sl@0
   140
	}
sl@0
   141
sl@0
   142
void CWsAnimGc::CancelClippingRegion()
sl@0
   143
	{
sl@0
   144
	if (!iUserActive)
sl@0
   145
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   146
sl@0
   147
	if (iGc)
sl@0
   148
		{
sl@0
   149
		iDrawingRegion.Close();
sl@0
   150
		iUseDrawingRegion = EFalse;
sl@0
   151
sl@0
   152
		STACK_REGION region;
sl@0
   153
		region.Copy(*iBaseRegion);
sl@0
   154
		region.ClipRect(iClippingRect);
sl@0
   155
		region.Tidy();
sl@0
   156
		iGc->SetClippingRegion(region);
sl@0
   157
		region.Close();
sl@0
   158
		}
sl@0
   159
	}
sl@0
   160
sl@0
   161
void CWsAnimGc::CancelClippingRect()
sl@0
   162
	{
sl@0
   163
	if (!iUserActive)
sl@0
   164
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   165
sl@0
   166
	if (iGc)
sl@0
   167
		{
sl@0
   168
		iClippingRect = iOwningWsAnim.ClientWindow()->AbsRect(); // Revert to the default clipping rect
sl@0
   169
sl@0
   170
		STACK_REGION region;
sl@0
   171
		region.Copy(*iBaseRegion);
sl@0
   172
		if (iUseDrawingRegion)
sl@0
   173
			region.Intersect(iDrawingRegion);
sl@0
   174
		region.ClipRect(iClippingRect);
sl@0
   175
		region.Tidy();
sl@0
   176
		iGc->SetClippingRegion(region);
sl@0
   177
		region.Close();
sl@0
   178
		}
sl@0
   179
	}
sl@0
   180
sl@0
   181
void CWsAnimGc::SetDrawMode(TDrawMode aDrawingMode)
sl@0
   182
	{
sl@0
   183
	if (!iUserActive)
sl@0
   184
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   185
sl@0
   186
	if (iGc)
sl@0
   187
		iGc->SetDrawMode(BitGdiToMWsGraphicsContextMappings::LossyConvert(aDrawingMode));
sl@0
   188
	}
sl@0
   189
sl@0
   190
void CWsAnimGc::UseFont(const CFont *aFont)
sl@0
   191
	{
sl@0
   192
	CloseCurrentFont();
sl@0
   193
	iFont=(CAnimFbsFont *)aFont;
sl@0
   194
	iFont->Open();
sl@0
   195
	if (!iUserActive)
sl@0
   196
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   197
	if (iGc)
sl@0
   198
		iGc->SetFontNoDuplicate(iFont);
sl@0
   199
	}
sl@0
   200
sl@0
   201
void CWsAnimGc::DiscardFont()
sl@0
   202
	{
sl@0
   203
	CloseCurrentFont();
sl@0
   204
	if (!iUserActive)
sl@0
   205
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   206
	if (iGc)
sl@0
   207
		iGc->ResetFont();
sl@0
   208
	}
sl@0
   209
sl@0
   210
void CWsAnimGc::SetUnderlineStyle(TFontUnderline aUnderlineStyle)
sl@0
   211
	{
sl@0
   212
	if (!iUserActive)
sl@0
   213
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   214
	if (iGc)
sl@0
   215
		iGc->SetUnderlineStyle(BitGdiToMWsGraphicsContextMappings::Convert(aUnderlineStyle));
sl@0
   216
	}
sl@0
   217
sl@0
   218
void CWsAnimGc::SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle)
sl@0
   219
	{
sl@0
   220
	if (!iUserActive)
sl@0
   221
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   222
	if (iGc)
sl@0
   223
		iGc->SetStrikethroughStyle(BitGdiToMWsGraphicsContextMappings::Convert(aStrikethroughStyle));
sl@0
   224
	}
sl@0
   225
sl@0
   226
void CWsAnimGc::SetWordJustification(TInt aExcessWidth,TInt aNumGaps)
sl@0
   227
	{
sl@0
   228
	if (!iUserActive)
sl@0
   229
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   230
	if (iGc)
sl@0
   231
		iGc->SetWordJustification(aExcessWidth,aNumGaps);
sl@0
   232
	}
sl@0
   233
sl@0
   234
void CWsAnimGc::SetCharJustification(TInt aExcessWidth,TInt aNumChars)
sl@0
   235
	{
sl@0
   236
	if (!iUserActive)
sl@0
   237
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   238
	if (iGc)
sl@0
   239
		iGc->SetCharJustification(aExcessWidth,aNumChars);
sl@0
   240
	}
sl@0
   241
sl@0
   242
void CWsAnimGc::SetPenColor(const TRgb &aColor)
sl@0
   243
	{
sl@0
   244
	if (!iUserActive)
sl@0
   245
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   246
	if (iGc)
sl@0
   247
		iGc->SetPenColor(aColor);
sl@0
   248
	}
sl@0
   249
sl@0
   250
void CWsAnimGc::SetPenStyle(TPenStyle aPenStyle)
sl@0
   251
	{
sl@0
   252
	if (!iUserActive)
sl@0
   253
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   254
	if (iGc)
sl@0
   255
		iGc->SetPenStyle(BitGdiToMWsGraphicsContextMappings::Convert(aPenStyle));
sl@0
   256
	}
sl@0
   257
sl@0
   258
void CWsAnimGc::SetPenSize(const TSize& aSize)
sl@0
   259
	{
sl@0
   260
	if (!iUserActive)
sl@0
   261
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   262
	if (iGc)
sl@0
   263
		iGc->SetPenSize(aSize);
sl@0
   264
	}
sl@0
   265
sl@0
   266
void CWsAnimGc::SetBrushColor(const TRgb &aColor)
sl@0
   267
	{
sl@0
   268
	if (!iUserActive)
sl@0
   269
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   270
	if (iGc)
sl@0
   271
		iGc->SetBrushColor(aColor);
sl@0
   272
	}
sl@0
   273
sl@0
   274
void CWsAnimGc::SetBrushStyle(TBrushStyle aBrushStyle)
sl@0
   275
	{
sl@0
   276
	if (!iUserActive)
sl@0
   277
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   278
	if (iGc)
sl@0
   279
		iGc->SetBrushStyle(BitGdiToMWsGraphicsContextMappings::Convert(aBrushStyle));
sl@0
   280
	}
sl@0
   281
sl@0
   282
void CWsAnimGc::SetBrushOrigin(const TPoint &aOrigin)
sl@0
   283
	{
sl@0
   284
	if (!iUserActive)
sl@0
   285
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   286
	if (iGc)
sl@0
   287
		iGc->SetBrushOrigin(aOrigin);
sl@0
   288
	}
sl@0
   289
sl@0
   290
void CWsAnimGc::UseBrushPattern(const CFbsBitmap *aBitmap)
sl@0
   291
	{
sl@0
   292
	if (!iUserActive)
sl@0
   293
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   294
	if (iGc)
sl@0
   295
		iGc->SetBrushPattern(*aBitmap);
sl@0
   296
	}
sl@0
   297
sl@0
   298
void CWsAnimGc::DiscardBrushPattern()
sl@0
   299
	{
sl@0
   300
	if (!iUserActive)
sl@0
   301
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   302
	if (iGc)
sl@0
   303
		iGc->ResetBrushPattern();
sl@0
   304
	}
sl@0
   305
sl@0
   306
void CWsAnimGc::SetFaded(TBool /*aFaded*/) // Deprecated
sl@0
   307
	{
sl@0
   308
	if (!iUserActive)
sl@0
   309
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   310
	// Do nothing
sl@0
   311
	}
sl@0
   312
sl@0
   313
void CWsAnimGc::SetFadingParameters(TUint8 /*aBlackMap*/,TUint8 /*aWhiteMap*/) // Deprecated
sl@0
   314
	{
sl@0
   315
	if (!iUserActive)
sl@0
   316
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   317
	// Do nothing 
sl@0
   318
	}
sl@0
   319
sl@0
   320
//
sl@0
   321
// Drawing commands 								//
sl@0
   322
//
sl@0
   323
sl@0
   324
void CWsAnimGc::DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd)
sl@0
   325
	{
sl@0
   326
	if (!iUserActive)
sl@0
   327
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   328
	if (iGc)
sl@0
   329
		iGc->DrawArc(aRect,aStart,aEnd);
sl@0
   330
	}
sl@0
   331
sl@0
   332
void CWsAnimGc::DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd)
sl@0
   333
	{
sl@0
   334
	if (!iUserActive)
sl@0
   335
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   336
	if (iGc)
sl@0
   337
		iGc->DrawPie(aRect,aStart,aEnd);
sl@0
   338
	}
sl@0
   339
sl@0
   340
void CWsAnimGc::DrawLine(const TPoint &aPoint1,const TPoint &aPoint2)
sl@0
   341
	{
sl@0
   342
	if (!iUserActive)
sl@0
   343
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   344
	if (iGc)
sl@0
   345
		iGc->DrawLine(aPoint1, aPoint2);
sl@0
   346
	}
sl@0
   347
sl@0
   348
void CWsAnimGc::DrawLineTo(const TPoint &aPoint)
sl@0
   349
	{
sl@0
   350
	if (!iUserActive)
sl@0
   351
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   352
	if (iGc)
sl@0
   353
		iGc->DrawLineTo(aPoint);
sl@0
   354
	}
sl@0
   355
sl@0
   356
void CWsAnimGc::DrawLineBy(const TPoint &aPoint)
sl@0
   357
	{
sl@0
   358
	if (!iUserActive)
sl@0
   359
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   360
	if (iGc)
sl@0
   361
		iGc->DrawLineBy(aPoint);
sl@0
   362
	}
sl@0
   363
sl@0
   364
void CWsAnimGc::DrawEllipse(const TRect &aRect)
sl@0
   365
	{
sl@0
   366
	if (!iUserActive)
sl@0
   367
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   368
	if (iGc)
sl@0
   369
		iGc->DrawEllipse(aRect);
sl@0
   370
	}
sl@0
   371
sl@0
   372
void CWsAnimGc::DrawRect(const TRect &aRect)
sl@0
   373
	{
sl@0
   374
	if (!iUserActive)
sl@0
   375
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   376
	if (iGc)
sl@0
   377
		iGc->DrawRect(aRect);
sl@0
   378
	}
sl@0
   379
sl@0
   380
void CWsAnimGc::DrawRoundRect(const TRect &aRect,const TSize &aCornerSize)
sl@0
   381
	{
sl@0
   382
	if (!iUserActive)
sl@0
   383
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   384
	if (iGc)
sl@0
   385
		iGc->DrawRoundRect(aRect, aCornerSize);
sl@0
   386
	}
sl@0
   387
sl@0
   388
void CWsAnimGc::Clear(const TRect &aRect)
sl@0
   389
	{
sl@0
   390
	if (!iUserActive)
sl@0
   391
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   392
	if (iGc)
sl@0
   393
		iGc->Clear(aRect);
sl@0
   394
	}
sl@0
   395
sl@0
   396
void CWsAnimGc::Clear()
sl@0
   397
	{
sl@0
   398
	if (!iUserActive)
sl@0
   399
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   400
	if (iGc)
sl@0
   401
		iGc->Clear();
sl@0
   402
	}
sl@0
   403
sl@0
   404
void CWsAnimGc::BitBlt(const TPoint &aPoint,const CFbsBitmap *aBitmap)
sl@0
   405
	{
sl@0
   406
	if (!iUserActive)
sl@0
   407
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   408
	if (iGc)
sl@0
   409
		iGc->BitBlt(aPoint, *aBitmap);
sl@0
   410
	}
sl@0
   411
sl@0
   412
void CWsAnimGc::BitBlt(const TPoint &aDestination,const CFbsBitmap *aBitmap,const TRect &aSource)
sl@0
   413
	{
sl@0
   414
	if (!iUserActive)
sl@0
   415
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   416
	if (iGc)
sl@0
   417
		iGc->BitBlt(aDestination, *aBitmap, aSource);
sl@0
   418
	}
sl@0
   419
sl@0
   420
void CWsAnimGc::BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask)
sl@0
   421
	{
sl@0
   422
	if (!iUserActive)
sl@0
   423
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   424
	if (iGc)
sl@0
   425
		iGc->BitBltMasked(aPoint, *aBitmap, aSourceRect, *aMaskBitmap, aInvertMask);
sl@0
   426
	}
sl@0
   427
sl@0
   428
void CWsAnimGc::DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aSource)
sl@0
   429
	{
sl@0
   430
	if (!iUserActive)
sl@0
   431
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   432
	if (iGc)
sl@0
   433
		{
sl@0
   434
		// DrawBitmap(TPoint&, ) uses the size of the bitmap in twips, but 
sl@0
   435
		// MWsGraphicsContext::DrawBitmap() takes a TRect in pixels, so we need to convert
sl@0
   436
		TRect destRect(iOwningWsAnim.ClientWindow()->Screen()->DeviceMap().TwipsToPixels(aSource->SizeInTwips()));
sl@0
   437
		destRect.Move(aTopLeft); //aTopLeft is defined in pixels, that's why we're not converting it
sl@0
   438
		iGc->DrawBitmap(destRect, *aSource);
sl@0
   439
		}
sl@0
   440
	}
sl@0
   441
sl@0
   442
void CWsAnimGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aSource)
sl@0
   443
	{
sl@0
   444
	if (!iUserActive)
sl@0
   445
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   446
	if (iGc)
sl@0
   447
		iGc->DrawBitmap(aDestRect, *aSource);
sl@0
   448
	}
sl@0
   449
sl@0
   450
void CWsAnimGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aSource, const TRect &aSrcRect)
sl@0
   451
	{
sl@0
   452
	if (!iUserActive)
sl@0
   453
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   454
	if (iGc)
sl@0
   455
		iGc->DrawBitmap(aDestRect, *aSource, aSrcRect);
sl@0
   456
	}
sl@0
   457
sl@0
   458
void CWsAnimGc::DrawBitmapMasked(const TRect &aDestRect, const CFbsBitmap *aBitmap, const TRect &aSrcRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask)
sl@0
   459
	{
sl@0
   460
	if (!iUserActive)
sl@0
   461
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   462
	if (iGc)
sl@0
   463
		iGc->DrawBitmapMasked(aDestRect, *aBitmap, aSrcRect, *aMaskBitmap, aInvertMask);
sl@0
   464
	}
sl@0
   465
sl@0
   466
void CWsAnimGc::DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSrcRect,const CWsBitmap* aMaskBitmap, TBool aInvertMask)
sl@0
   467
	{
sl@0
   468
	if (!iUserActive)
sl@0
   469
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   470
	if (iGc)
sl@0
   471
		iGc->DrawBitmapMasked(aDestRect, *aBitmap, aSrcRect, *aMaskBitmap, aInvertMask);
sl@0
   472
	}
sl@0
   473
sl@0
   474
void CWsAnimGc::DrawPolyLine(const TPoint* aPointList,TInt aNumPoints)
sl@0
   475
	{
sl@0
   476
	if (!iUserActive)
sl@0
   477
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   478
	if (iGc)
sl@0
   479
		{
sl@0
   480
		TArrayWrapper<TPoint> points(aPointList, aNumPoints);
sl@0
   481
		iGc->DrawPolyLine(points);
sl@0
   482
		}
sl@0
   483
	}
sl@0
   484
sl@0
   485
void CWsAnimGc::DrawPolyLine(const CArrayFix<TPoint> *aPointList)
sl@0
   486
	{
sl@0
   487
	if (!iUserActive)
sl@0
   488
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   489
	if (iGc)
sl@0
   490
		iGc->DrawPolyLine(aPointList->Array());
sl@0
   491
	}
sl@0
   492
sl@0
   493
TInt CWsAnimGc::DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule)
sl@0
   494
	{
sl@0
   495
	TInt result = KErrGeneral;
sl@0
   496
	if (!iUserActive)
sl@0
   497
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   498
	if (iGc)
sl@0
   499
		{
sl@0
   500
		TArrayWrapper<TPoint> pointsArray(aPointList, aNumPoints);
sl@0
   501
		iGc->DrawPolygon(pointsArray, BitGdiToMWsGraphicsContextMappings::Convert(aFillRule));
sl@0
   502
		result = iGc->GetError();
sl@0
   503
		}
sl@0
   504
	return result;
sl@0
   505
	}
sl@0
   506
sl@0
   507
TInt CWsAnimGc::DrawPolygon(const CArrayFix<TPoint> *aPointList,TFillRule aFillRule)
sl@0
   508
	{
sl@0
   509
	if (!iUserActive)
sl@0
   510
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   511
	if(!aPointList)
sl@0
   512
		return KErrArgument;
sl@0
   513
	TInt result = KErrGeneral;
sl@0
   514
	if (iGc)
sl@0
   515
		{
sl@0
   516
		iGc->DrawPolygon(aPointList->Array(), BitGdiToMWsGraphicsContextMappings::Convert(aFillRule));
sl@0
   517
		result = iGc->GetError(); 
sl@0
   518
		}
sl@0
   519
	return result;
sl@0
   520
	}
sl@0
   521
sl@0
   522
void CWsAnimGc::DrawText(const TDesC &aString,const TPoint &aPosition)
sl@0
   523
	{
sl@0
   524
	if (!iFont)
sl@0
   525
		iOwningWsAnim.Panic(EWservPanicNoFont);
sl@0
   526
	if (iGc)
sl@0
   527
		iGc->DrawText(aString, NULL, aPosition);
sl@0
   528
	}
sl@0
   529
sl@0
   530
void CWsAnimGc::DrawText(const TDesC &aString,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz,TInt aLeftMrg)
sl@0
   531
	{
sl@0
   532
	if (!iFont)
sl@0
   533
		iOwningWsAnim.Panic(EWservPanicNoFont);
sl@0
   534
	if (iGc)
sl@0
   535
		iGc->DrawText(aString, NULL, aBox, aBaselineOffset, BitGdiToMWsGraphicsContextMappings::Convert(aHoriz), aLeftMrg);	
sl@0
   536
	}
sl@0
   537
sl@0
   538
void CWsAnimGc::MoveTo(const TPoint &aPoint)
sl@0
   539
	{
sl@0
   540
	if (!iUserActive)
sl@0
   541
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   542
	if (iGc)
sl@0
   543
		iGc->MoveTo(aPoint);
sl@0
   544
	}
sl@0
   545
sl@0
   546
void CWsAnimGc::MoveBy(const TPoint &aPoint)
sl@0
   547
	{
sl@0
   548
	if (!iUserActive)
sl@0
   549
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   550
	if (iGc)
sl@0
   551
		iGc->MoveBy(aPoint);
sl@0
   552
	}
sl@0
   553
sl@0
   554
void CWsAnimGc::Plot(const TPoint &aPoint)
sl@0
   555
	{
sl@0
   556
	if (!iUserActive)
sl@0
   557
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   558
	if (iGc)
sl@0
   559
		iGc->Plot(aPoint);
sl@0
   560
	}
sl@0
   561
sl@0
   562
void CWsAnimGc::SetOrigin(const TPoint &aPoint)
sl@0
   563
	{
sl@0
   564
	if (!iUserActive)
sl@0
   565
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   566
	if (iGc)
sl@0
   567
		iGc->SetOrigin(iOwningWsAnim.ClientWindow()->Origin() + aPoint);
sl@0
   568
	}
sl@0
   569
sl@0
   570
void CWsAnimGc::CopyRect(const TPoint& aOffset,const TRect& aRect)
sl@0
   571
	{
sl@0
   572
	if (!iUserActive)
sl@0
   573
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   574
	if (iGc)
sl@0
   575
		iGc->CopyRect(aOffset, aRect);
sl@0
   576
	}
sl@0
   577
sl@0
   578
void CWsAnimGc::Reset()
sl@0
   579
	{
sl@0
   580
	CloseCurrentFont();
sl@0
   581
	if (!iUserActive)
sl@0
   582
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   583
	if (iGc)
sl@0
   584
		iGc->Reset();
sl@0
   585
	SetOrigin(TPoint(0,0));
sl@0
   586
	CancelClippingRect();
sl@0
   587
	CancelClippingRegion();
sl@0
   588
	}
sl@0
   589
sl@0
   590
void CWsAnimGc::CloseCurrentFont()
sl@0
   591
	{
sl@0
   592
	if (iFont)
sl@0
   593
		{
sl@0
   594
		iFont->Close();
sl@0
   595
		iFont=NULL;
sl@0
   596
		}
sl@0
   597
	}
sl@0
   598
sl@0
   599
/**
sl@0
   600
@see CBitmapContext::AlphaBlendBitmaps()*/
sl@0
   601
TInt CWsAnimGc::AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp,	const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp,	const TPoint& aAlphaPt)	
sl@0
   602
	{
sl@0
   603
	TInt result = KErrGeneral;
sl@0
   604
	if (!iUserActive)
sl@0
   605
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   606
	if (iGc)
sl@0
   607
		{
sl@0
   608
		iGc->BitBltMasked(aDestPt, *aSrcBmp, aSrcRect, *aAlphaBmp, aAlphaPt);
sl@0
   609
		result = iGc->GetError();
sl@0
   610
		}
sl@0
   611
	return result;
sl@0
   612
	}
sl@0
   613
sl@0
   614
/*Body stub implementation. The alternate AlphaBlendBitmap function using CFbsBitmaps should instead be used*/
sl@0
   615
TInt CWsAnimGc::AlphaBlendBitmaps(const TPoint& /*aDestPt*/, const CWsBitmap* /*aSrcBmp*/,	const TRect& /*aSrcRect*/, const CWsBitmap* /*aAlphaBmp*/,	const TPoint& /*aAlphaPt*/)
sl@0
   616
	{
sl@0
   617
	return KErrNone;		
sl@0
   618
	};
sl@0
   619
sl@0
   620
/**
sl@0
   621
@see CGraphicsContext::MapColors()*/
sl@0
   622
void CWsAnimGc::MapColors(const TRect& /*aRect*/,const TRgb* /*aColors*/,TInt /*aNumPairs*/,TBool /*aMapForwards*/)
sl@0
   623
	{
sl@0
   624
	if (!iUserActive)
sl@0
   625
		iOwningWsAnim.Panic(EWservPanicAnimLeave);
sl@0
   626
	}
sl@0
   627
sl@0
   628
/**
sl@0
   629
@see CGraphicsContext::DrawTextVertical()*/
sl@0
   630
void CWsAnimGc::DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp)
sl@0
   631
	{
sl@0
   632
	if (!iFont) 
sl@0
   633
		iOwningWsAnim.Panic(EWservPanicNoFont);
sl@0
   634
	if (iGc)
sl@0
   635
		iGc->DrawTextVertical(aText, NULL, aPos, aUp);
sl@0
   636
	}
sl@0
   637
sl@0
   638
/**
sl@0
   639
@see CGraphicsContext::DrawTextVertical()*/
sl@0
   640
void CWsAnimGc::DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert,TInt aMargin)
sl@0
   641
	{
sl@0
   642
	if (!iFont) 
sl@0
   643
		iOwningWsAnim.Panic(EWservPanicNoFont);
sl@0
   644
	if (iGc)
sl@0
   645
		iGc->DrawTextVertical(aText, NULL, aBox, aBaselineOffset, aUp, BitGdiToMWsGraphicsContextMappings::Convert(aVert), aMargin);
sl@0
   646
	}
sl@0
   647