1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/nga/SERVER/WSANIMGC.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,647 @@
1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Interface code for animated DLL's GC
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32std.h>
1.22 +#include "server.h"
1.23 +#include "playbackgc.h"
1.24 +#include "ANIM.H"
1.25 +#include "wsfont.h"
1.26 +#include "bitgditomwsgraphicscontextmappings.h"
1.27 +#include "devicemap.h"
1.28 +
1.29 +CWsAnimGc::CWsAnimGc(CWsAnim& aWsAnim) : iOwningWsAnim(aWsAnim), iUserActive(EFalse), iUseDrawingRegion(EFalse)
1.30 + {
1.31 + __DECLARE_NAME(_S("CWsAnimGc"));
1.32 + }
1.33 +
1.34 +CWsAnimGc::~CWsAnimGc()
1.35 + {
1.36 + iDrawingRegion.Close();
1.37 + }
1.38 +
1.39 +void CWsAnimGc::Activate(const TRegion* aRegion, MWsGraphicsContext* aGc)
1.40 + {
1.41 + iBaseRegion = aRegion ? aRegion : iOwningWsAnim.ClientWindow()->DrawingRegion();
1.42 + iGc = aGc;
1.43 + iUserActive = ETrue;
1.44 + Reset();
1.45 + }
1.46 +
1.47 +void CWsAnimGc::Deactivate()
1.48 + {
1.49 + CloseCurrentFont();
1.50 + iGc = NULL;
1.51 + iUserActive = EFalse;
1.52 + iUseDrawingRegion = EFalse;
1.53 + iDrawingRegion.Close();
1.54 + }
1.55 +
1.56 +TBool CWsAnimGc::IsActive() const
1.57 + {
1.58 + return (iUserActive || (iGc != NULL));
1.59 + }
1.60 +
1.61 +void CWsAnimGc::UserActivate()
1.62 + {
1.63 + if (iUserActive)
1.64 + {
1.65 + // Already active
1.66 + UserDeactivate();
1.67 + iOwningWsAnim.SessionPanic();
1.68 + }
1.69 + iUserActive = ETrue;
1.70 + }
1.71 +
1.72 +void CWsAnimGc::UserDeactivate()
1.73 + {
1.74 + CloseCurrentFont();
1.75 +
1.76 + if (iUserActive)
1.77 + {
1.78 + iUserActive = EFalse;
1.79 + }
1.80 + }
1.81 +
1.82 +CGraphicsDevice* CWsAnimGc::Device() const
1.83 + {
1.84 + if (!iUserActive)
1.85 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.86 +
1.87 + return NULL; //deprecated
1.88 + }
1.89 +
1.90 +void CWsAnimGc::SetClippingRect(const TRect& aRect)
1.91 + {
1.92 + if (!iUserActive)
1.93 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.94 +
1.95 + if (iGc)
1.96 + {
1.97 + iClippingRect = aRect;
1.98 + iClippingRect.Move(iOwningWsAnim.ClientWindow()->Origin());
1.99 + iClippingRect.Intersection(iOwningWsAnim.ClientWindow()->AbsRect());
1.100 +
1.101 + STACK_REGION region;
1.102 + region.Copy(*iBaseRegion);
1.103 + if (iUseDrawingRegion)
1.104 + region.Intersect(iDrawingRegion);
1.105 + region.ClipRect(iClippingRect);
1.106 + region.Tidy();
1.107 +
1.108 + iGc->SetClippingRegion(region);
1.109 + region.Close();
1.110 +
1.111 + if (iGc->GetError())
1.112 + iClippingRect = iOwningWsAnim.ClientWindow()->AbsRect(); // On error revert to the default clipping rect
1.113 + }
1.114 + }
1.115 +
1.116 +TInt CWsAnimGc::SetClippingRegion(const TRegion &aRegion)
1.117 + {
1.118 + if (!iUserActive)
1.119 + return KErrGeneral;
1.120 +
1.121 + TInt error = KErrNone;
1.122 + if (iGc)
1.123 + {
1.124 + STACK_REGION region;
1.125 + region.Copy(aRegion);
1.126 + region.Offset(iOwningWsAnim.ClientWindow()->Origin());
1.127 + region.Intersect(*iBaseRegion);
1.128 + region.ClipRect(iClippingRect);
1.129 + region.Tidy();
1.130 +
1.131 + iGc->SetClippingRegion(region);
1.132 + region.Close();
1.133 +
1.134 + error = iGc->GetError();
1.135 + if (!error)
1.136 + { // Need to keep a copy of the region in screen coordinates
1.137 + iDrawingRegion.Copy(aRegion);
1.138 + iDrawingRegion.Offset(iOwningWsAnim.ClientWindow()->Origin());
1.139 + iUseDrawingRegion = ETrue;
1.140 + }
1.141 + }
1.142 + return error;
1.143 + }
1.144 +
1.145 +void CWsAnimGc::CancelClippingRegion()
1.146 + {
1.147 + if (!iUserActive)
1.148 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.149 +
1.150 + if (iGc)
1.151 + {
1.152 + iDrawingRegion.Close();
1.153 + iUseDrawingRegion = EFalse;
1.154 +
1.155 + STACK_REGION region;
1.156 + region.Copy(*iBaseRegion);
1.157 + region.ClipRect(iClippingRect);
1.158 + region.Tidy();
1.159 + iGc->SetClippingRegion(region);
1.160 + region.Close();
1.161 + }
1.162 + }
1.163 +
1.164 +void CWsAnimGc::CancelClippingRect()
1.165 + {
1.166 + if (!iUserActive)
1.167 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.168 +
1.169 + if (iGc)
1.170 + {
1.171 + iClippingRect = iOwningWsAnim.ClientWindow()->AbsRect(); // Revert to the default clipping rect
1.172 +
1.173 + STACK_REGION region;
1.174 + region.Copy(*iBaseRegion);
1.175 + if (iUseDrawingRegion)
1.176 + region.Intersect(iDrawingRegion);
1.177 + region.ClipRect(iClippingRect);
1.178 + region.Tidy();
1.179 + iGc->SetClippingRegion(region);
1.180 + region.Close();
1.181 + }
1.182 + }
1.183 +
1.184 +void CWsAnimGc::SetDrawMode(TDrawMode aDrawingMode)
1.185 + {
1.186 + if (!iUserActive)
1.187 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.188 +
1.189 + if (iGc)
1.190 + iGc->SetDrawMode(BitGdiToMWsGraphicsContextMappings::LossyConvert(aDrawingMode));
1.191 + }
1.192 +
1.193 +void CWsAnimGc::UseFont(const CFont *aFont)
1.194 + {
1.195 + CloseCurrentFont();
1.196 + iFont=(CAnimFbsFont *)aFont;
1.197 + iFont->Open();
1.198 + if (!iUserActive)
1.199 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.200 + if (iGc)
1.201 + iGc->SetFontNoDuplicate(iFont);
1.202 + }
1.203 +
1.204 +void CWsAnimGc::DiscardFont()
1.205 + {
1.206 + CloseCurrentFont();
1.207 + if (!iUserActive)
1.208 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.209 + if (iGc)
1.210 + iGc->ResetFont();
1.211 + }
1.212 +
1.213 +void CWsAnimGc::SetUnderlineStyle(TFontUnderline aUnderlineStyle)
1.214 + {
1.215 + if (!iUserActive)
1.216 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.217 + if (iGc)
1.218 + iGc->SetUnderlineStyle(BitGdiToMWsGraphicsContextMappings::Convert(aUnderlineStyle));
1.219 + }
1.220 +
1.221 +void CWsAnimGc::SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle)
1.222 + {
1.223 + if (!iUserActive)
1.224 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.225 + if (iGc)
1.226 + iGc->SetStrikethroughStyle(BitGdiToMWsGraphicsContextMappings::Convert(aStrikethroughStyle));
1.227 + }
1.228 +
1.229 +void CWsAnimGc::SetWordJustification(TInt aExcessWidth,TInt aNumGaps)
1.230 + {
1.231 + if (!iUserActive)
1.232 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.233 + if (iGc)
1.234 + iGc->SetWordJustification(aExcessWidth,aNumGaps);
1.235 + }
1.236 +
1.237 +void CWsAnimGc::SetCharJustification(TInt aExcessWidth,TInt aNumChars)
1.238 + {
1.239 + if (!iUserActive)
1.240 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.241 + if (iGc)
1.242 + iGc->SetCharJustification(aExcessWidth,aNumChars);
1.243 + }
1.244 +
1.245 +void CWsAnimGc::SetPenColor(const TRgb &aColor)
1.246 + {
1.247 + if (!iUserActive)
1.248 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.249 + if (iGc)
1.250 + iGc->SetPenColor(aColor);
1.251 + }
1.252 +
1.253 +void CWsAnimGc::SetPenStyle(TPenStyle aPenStyle)
1.254 + {
1.255 + if (!iUserActive)
1.256 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.257 + if (iGc)
1.258 + iGc->SetPenStyle(BitGdiToMWsGraphicsContextMappings::Convert(aPenStyle));
1.259 + }
1.260 +
1.261 +void CWsAnimGc::SetPenSize(const TSize& aSize)
1.262 + {
1.263 + if (!iUserActive)
1.264 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.265 + if (iGc)
1.266 + iGc->SetPenSize(aSize);
1.267 + }
1.268 +
1.269 +void CWsAnimGc::SetBrushColor(const TRgb &aColor)
1.270 + {
1.271 + if (!iUserActive)
1.272 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.273 + if (iGc)
1.274 + iGc->SetBrushColor(aColor);
1.275 + }
1.276 +
1.277 +void CWsAnimGc::SetBrushStyle(TBrushStyle aBrushStyle)
1.278 + {
1.279 + if (!iUserActive)
1.280 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.281 + if (iGc)
1.282 + iGc->SetBrushStyle(BitGdiToMWsGraphicsContextMappings::Convert(aBrushStyle));
1.283 + }
1.284 +
1.285 +void CWsAnimGc::SetBrushOrigin(const TPoint &aOrigin)
1.286 + {
1.287 + if (!iUserActive)
1.288 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.289 + if (iGc)
1.290 + iGc->SetBrushOrigin(aOrigin);
1.291 + }
1.292 +
1.293 +void CWsAnimGc::UseBrushPattern(const CFbsBitmap *aBitmap)
1.294 + {
1.295 + if (!iUserActive)
1.296 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.297 + if (iGc)
1.298 + iGc->SetBrushPattern(*aBitmap);
1.299 + }
1.300 +
1.301 +void CWsAnimGc::DiscardBrushPattern()
1.302 + {
1.303 + if (!iUserActive)
1.304 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.305 + if (iGc)
1.306 + iGc->ResetBrushPattern();
1.307 + }
1.308 +
1.309 +void CWsAnimGc::SetFaded(TBool /*aFaded*/) // Deprecated
1.310 + {
1.311 + if (!iUserActive)
1.312 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.313 + // Do nothing
1.314 + }
1.315 +
1.316 +void CWsAnimGc::SetFadingParameters(TUint8 /*aBlackMap*/,TUint8 /*aWhiteMap*/) // Deprecated
1.317 + {
1.318 + if (!iUserActive)
1.319 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.320 + // Do nothing
1.321 + }
1.322 +
1.323 +//
1.324 +// Drawing commands //
1.325 +//
1.326 +
1.327 +void CWsAnimGc::DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd)
1.328 + {
1.329 + if (!iUserActive)
1.330 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.331 + if (iGc)
1.332 + iGc->DrawArc(aRect,aStart,aEnd);
1.333 + }
1.334 +
1.335 +void CWsAnimGc::DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd)
1.336 + {
1.337 + if (!iUserActive)
1.338 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.339 + if (iGc)
1.340 + iGc->DrawPie(aRect,aStart,aEnd);
1.341 + }
1.342 +
1.343 +void CWsAnimGc::DrawLine(const TPoint &aPoint1,const TPoint &aPoint2)
1.344 + {
1.345 + if (!iUserActive)
1.346 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.347 + if (iGc)
1.348 + iGc->DrawLine(aPoint1, aPoint2);
1.349 + }
1.350 +
1.351 +void CWsAnimGc::DrawLineTo(const TPoint &aPoint)
1.352 + {
1.353 + if (!iUserActive)
1.354 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.355 + if (iGc)
1.356 + iGc->DrawLineTo(aPoint);
1.357 + }
1.358 +
1.359 +void CWsAnimGc::DrawLineBy(const TPoint &aPoint)
1.360 + {
1.361 + if (!iUserActive)
1.362 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.363 + if (iGc)
1.364 + iGc->DrawLineBy(aPoint);
1.365 + }
1.366 +
1.367 +void CWsAnimGc::DrawEllipse(const TRect &aRect)
1.368 + {
1.369 + if (!iUserActive)
1.370 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.371 + if (iGc)
1.372 + iGc->DrawEllipse(aRect);
1.373 + }
1.374 +
1.375 +void CWsAnimGc::DrawRect(const TRect &aRect)
1.376 + {
1.377 + if (!iUserActive)
1.378 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.379 + if (iGc)
1.380 + iGc->DrawRect(aRect);
1.381 + }
1.382 +
1.383 +void CWsAnimGc::DrawRoundRect(const TRect &aRect,const TSize &aCornerSize)
1.384 + {
1.385 + if (!iUserActive)
1.386 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.387 + if (iGc)
1.388 + iGc->DrawRoundRect(aRect, aCornerSize);
1.389 + }
1.390 +
1.391 +void CWsAnimGc::Clear(const TRect &aRect)
1.392 + {
1.393 + if (!iUserActive)
1.394 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.395 + if (iGc)
1.396 + iGc->Clear(aRect);
1.397 + }
1.398 +
1.399 +void CWsAnimGc::Clear()
1.400 + {
1.401 + if (!iUserActive)
1.402 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.403 + if (iGc)
1.404 + iGc->Clear();
1.405 + }
1.406 +
1.407 +void CWsAnimGc::BitBlt(const TPoint &aPoint,const CFbsBitmap *aBitmap)
1.408 + {
1.409 + if (!iUserActive)
1.410 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.411 + if (iGc)
1.412 + iGc->BitBlt(aPoint, *aBitmap);
1.413 + }
1.414 +
1.415 +void CWsAnimGc::BitBlt(const TPoint &aDestination,const CFbsBitmap *aBitmap,const TRect &aSource)
1.416 + {
1.417 + if (!iUserActive)
1.418 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.419 + if (iGc)
1.420 + iGc->BitBlt(aDestination, *aBitmap, aSource);
1.421 + }
1.422 +
1.423 +void CWsAnimGc::BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask)
1.424 + {
1.425 + if (!iUserActive)
1.426 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.427 + if (iGc)
1.428 + iGc->BitBltMasked(aPoint, *aBitmap, aSourceRect, *aMaskBitmap, aInvertMask);
1.429 + }
1.430 +
1.431 +void CWsAnimGc::DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aSource)
1.432 + {
1.433 + if (!iUserActive)
1.434 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.435 + if (iGc)
1.436 + {
1.437 + // DrawBitmap(TPoint&, ) uses the size of the bitmap in twips, but
1.438 + // MWsGraphicsContext::DrawBitmap() takes a TRect in pixels, so we need to convert
1.439 + TRect destRect(iOwningWsAnim.ClientWindow()->Screen()->DeviceMap().TwipsToPixels(aSource->SizeInTwips()));
1.440 + destRect.Move(aTopLeft); //aTopLeft is defined in pixels, that's why we're not converting it
1.441 + iGc->DrawBitmap(destRect, *aSource);
1.442 + }
1.443 + }
1.444 +
1.445 +void CWsAnimGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aSource)
1.446 + {
1.447 + if (!iUserActive)
1.448 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.449 + if (iGc)
1.450 + iGc->DrawBitmap(aDestRect, *aSource);
1.451 + }
1.452 +
1.453 +void CWsAnimGc::DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aSource, const TRect &aSrcRect)
1.454 + {
1.455 + if (!iUserActive)
1.456 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.457 + if (iGc)
1.458 + iGc->DrawBitmap(aDestRect, *aSource, aSrcRect);
1.459 + }
1.460 +
1.461 +void CWsAnimGc::DrawBitmapMasked(const TRect &aDestRect, const CFbsBitmap *aBitmap, const TRect &aSrcRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask)
1.462 + {
1.463 + if (!iUserActive)
1.464 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.465 + if (iGc)
1.466 + iGc->DrawBitmapMasked(aDestRect, *aBitmap, aSrcRect, *aMaskBitmap, aInvertMask);
1.467 + }
1.468 +
1.469 +void CWsAnimGc::DrawBitmapMasked(const TRect& aDestRect,const CWsBitmap* aBitmap,const TRect& aSrcRect,const CWsBitmap* aMaskBitmap, TBool aInvertMask)
1.470 + {
1.471 + if (!iUserActive)
1.472 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.473 + if (iGc)
1.474 + iGc->DrawBitmapMasked(aDestRect, *aBitmap, aSrcRect, *aMaskBitmap, aInvertMask);
1.475 + }
1.476 +
1.477 +void CWsAnimGc::DrawPolyLine(const TPoint* aPointList,TInt aNumPoints)
1.478 + {
1.479 + if (!iUserActive)
1.480 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.481 + if (iGc)
1.482 + {
1.483 + TArrayWrapper<TPoint> points(aPointList, aNumPoints);
1.484 + iGc->DrawPolyLine(points);
1.485 + }
1.486 + }
1.487 +
1.488 +void CWsAnimGc::DrawPolyLine(const CArrayFix<TPoint> *aPointList)
1.489 + {
1.490 + if (!iUserActive)
1.491 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.492 + if (iGc)
1.493 + iGc->DrawPolyLine(aPointList->Array());
1.494 + }
1.495 +
1.496 +TInt CWsAnimGc::DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule)
1.497 + {
1.498 + TInt result = KErrGeneral;
1.499 + if (!iUserActive)
1.500 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.501 + if (iGc)
1.502 + {
1.503 + TArrayWrapper<TPoint> pointsArray(aPointList, aNumPoints);
1.504 + iGc->DrawPolygon(pointsArray, BitGdiToMWsGraphicsContextMappings::Convert(aFillRule));
1.505 + result = iGc->GetError();
1.506 + }
1.507 + return result;
1.508 + }
1.509 +
1.510 +TInt CWsAnimGc::DrawPolygon(const CArrayFix<TPoint> *aPointList,TFillRule aFillRule)
1.511 + {
1.512 + if (!iUserActive)
1.513 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.514 + if(!aPointList)
1.515 + return KErrArgument;
1.516 + TInt result = KErrGeneral;
1.517 + if (iGc)
1.518 + {
1.519 + iGc->DrawPolygon(aPointList->Array(), BitGdiToMWsGraphicsContextMappings::Convert(aFillRule));
1.520 + result = iGc->GetError();
1.521 + }
1.522 + return result;
1.523 + }
1.524 +
1.525 +void CWsAnimGc::DrawText(const TDesC &aString,const TPoint &aPosition)
1.526 + {
1.527 + if (!iFont)
1.528 + iOwningWsAnim.Panic(EWservPanicNoFont);
1.529 + if (iGc)
1.530 + iGc->DrawText(aString, NULL, aPosition);
1.531 + }
1.532 +
1.533 +void CWsAnimGc::DrawText(const TDesC &aString,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz,TInt aLeftMrg)
1.534 + {
1.535 + if (!iFont)
1.536 + iOwningWsAnim.Panic(EWservPanicNoFont);
1.537 + if (iGc)
1.538 + iGc->DrawText(aString, NULL, aBox, aBaselineOffset, BitGdiToMWsGraphicsContextMappings::Convert(aHoriz), aLeftMrg);
1.539 + }
1.540 +
1.541 +void CWsAnimGc::MoveTo(const TPoint &aPoint)
1.542 + {
1.543 + if (!iUserActive)
1.544 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.545 + if (iGc)
1.546 + iGc->MoveTo(aPoint);
1.547 + }
1.548 +
1.549 +void CWsAnimGc::MoveBy(const TPoint &aPoint)
1.550 + {
1.551 + if (!iUserActive)
1.552 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.553 + if (iGc)
1.554 + iGc->MoveBy(aPoint);
1.555 + }
1.556 +
1.557 +void CWsAnimGc::Plot(const TPoint &aPoint)
1.558 + {
1.559 + if (!iUserActive)
1.560 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.561 + if (iGc)
1.562 + iGc->Plot(aPoint);
1.563 + }
1.564 +
1.565 +void CWsAnimGc::SetOrigin(const TPoint &aPoint)
1.566 + {
1.567 + if (!iUserActive)
1.568 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.569 + if (iGc)
1.570 + iGc->SetOrigin(iOwningWsAnim.ClientWindow()->Origin() + aPoint);
1.571 + }
1.572 +
1.573 +void CWsAnimGc::CopyRect(const TPoint& aOffset,const TRect& aRect)
1.574 + {
1.575 + if (!iUserActive)
1.576 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.577 + if (iGc)
1.578 + iGc->CopyRect(aOffset, aRect);
1.579 + }
1.580 +
1.581 +void CWsAnimGc::Reset()
1.582 + {
1.583 + CloseCurrentFont();
1.584 + if (!iUserActive)
1.585 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.586 + if (iGc)
1.587 + iGc->Reset();
1.588 + SetOrigin(TPoint(0,0));
1.589 + CancelClippingRect();
1.590 + CancelClippingRegion();
1.591 + }
1.592 +
1.593 +void CWsAnimGc::CloseCurrentFont()
1.594 + {
1.595 + if (iFont)
1.596 + {
1.597 + iFont->Close();
1.598 + iFont=NULL;
1.599 + }
1.600 + }
1.601 +
1.602 +/**
1.603 +@see CBitmapContext::AlphaBlendBitmaps()*/
1.604 +TInt CWsAnimGc::AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt)
1.605 + {
1.606 + TInt result = KErrGeneral;
1.607 + if (!iUserActive)
1.608 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.609 + if (iGc)
1.610 + {
1.611 + iGc->BitBltMasked(aDestPt, *aSrcBmp, aSrcRect, *aAlphaBmp, aAlphaPt);
1.612 + result = iGc->GetError();
1.613 + }
1.614 + return result;
1.615 + }
1.616 +
1.617 +/*Body stub implementation. The alternate AlphaBlendBitmap function using CFbsBitmaps should instead be used*/
1.618 +TInt CWsAnimGc::AlphaBlendBitmaps(const TPoint& /*aDestPt*/, const CWsBitmap* /*aSrcBmp*/, const TRect& /*aSrcRect*/, const CWsBitmap* /*aAlphaBmp*/, const TPoint& /*aAlphaPt*/)
1.619 + {
1.620 + return KErrNone;
1.621 + };
1.622 +
1.623 +/**
1.624 +@see CGraphicsContext::MapColors()*/
1.625 +void CWsAnimGc::MapColors(const TRect& /*aRect*/,const TRgb* /*aColors*/,TInt /*aNumPairs*/,TBool /*aMapForwards*/)
1.626 + {
1.627 + if (!iUserActive)
1.628 + iOwningWsAnim.Panic(EWservPanicAnimLeave);
1.629 + }
1.630 +
1.631 +/**
1.632 +@see CGraphicsContext::DrawTextVertical()*/
1.633 +void CWsAnimGc::DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp)
1.634 + {
1.635 + if (!iFont)
1.636 + iOwningWsAnim.Panic(EWservPanicNoFont);
1.637 + if (iGc)
1.638 + iGc->DrawTextVertical(aText, NULL, aPos, aUp);
1.639 + }
1.640 +
1.641 +/**
1.642 +@see CGraphicsContext::DrawTextVertical()*/
1.643 +void CWsAnimGc::DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert,TInt aMargin)
1.644 + {
1.645 + if (!iFont)
1.646 + iOwningWsAnim.Panic(EWservPanicNoFont);
1.647 + if (iGc)
1.648 + iGc->DrawTextVertical(aText, NULL, aBox, aBaselineOffset, aUp, BitGdiToMWsGraphicsContextMappings::Convert(aVert), aMargin);
1.649 + }
1.650 +