--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javauis/lcdui_akn/lcdgr/src/LcdBitmapSurface.cpp Wed Sep 01 12:33:18 2010 +0100
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+#include "LcdBitmapSurface.h"
+
+CLcdBitmapSurface* CLcdBitmapSurface::NewL(const CFbsBitmap* aTarget)
+{
+ CLcdBitmapSurface* surface = new(ELeave) CLcdBitmapSurface;
+ CleanupStack::PushL(surface);
+ surface->ConstructL(*aTarget);
+ CleanupStack::Pop(surface);
+ return surface;
+}
+
+void CLcdBitmapSurface::ConstructL(const CFbsBitmap& aTarget)
+{
+ iBitmap = new(ELeave) CFbsBitmap;
+ User::LeaveIfError(iBitmap->Duplicate(aTarget.Handle()));
+ iDevice = CFbsBitmapDevice::NewL(iBitmap);
+ User::LeaveIfError(iDevice->CreateContext(iContext));
+ iSpec = TAcceleratedBitmapSpec(iBitmap);
+ iImageType.iColorMode = aTarget.DisplayMode();
+ iImageType.iAlphaMode = ENone;
+ iImageType.iTransparency = ETransparencyNone;
+ iBounds = TRect(aTarget.SizeInPixels());
+ iRegion.AddRect(iBounds);
+}
+
+CLcdBitmapSurface::~CLcdBitmapSurface()
+{
+ delete iContext;
+ delete iDevice;
+ delete iBitmap;
+ iRegion.Close();
+}
+
+CFbsBitmap* CLcdBitmapSurface::Bitmap() const
+{
+ return iBitmap;
+}
+
+CLcdSurface::TSurfaceType CLcdBitmapSurface::Type() const
+{
+ return CLcdSurface::EBitmapSurface;
+}
+
+void CLcdBitmapSurface::Update(const TRect& /*aRect*/)
+{
+ // NOP. but could copy up from pbuffer here
+}
+
+void CLcdBitmapSurface::Begin(TAcceleratedBitmapInfo& aInfo, TBitmapLockCount& aCount)
+{
+ iSpec.Lock(aCount);
+ iSpec.GetInfo(aInfo);
+}
+
+void CLcdBitmapSurface::End(TBitmapLockCount& aCount)
+{
+ iSpec.Unlock(aCount);
+}
+
+TRect CLcdBitmapSurface::Bounds() const
+{
+ return iBounds;
+}
+
+RRegion* CLcdBitmapSurface::VisibleRegion() const
+{
+ return const_cast<RRegion*>(&iRegion);
+}
+
+CBitmapContext* CLcdBitmapSurface::Context() const
+{
+ return iContext;
+}
+
+TImageType CLcdBitmapSurface::ImageType() const
+{
+ return iImageType;
+}