From 8526c5e62c56d26420972411c89aae5903752aa7 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 8 Mar 2009 21:47:49 +0100 Subject: [PATCH] Remove CBitmapSurface. --- src/main/symbian/SDL_main.cpp | 2 +- src/video/symbian/dsa.cpp | 134 ++++++++++++----------------------------- symbian/include/internal/dsa.h | 2 - 3 files changed, 40 insertions(+), 98 deletions(-) diff --git a/src/main/symbian/SDL_main.cpp b/src/main/symbian/SDL_main.cpp index 1ccdc76..f33dbda 100644 --- a/src/main/symbian/SDL_main.cpp +++ b/src/main/symbian/SDL_main.cpp @@ -159,7 +159,7 @@ void EpocSdlEnv::UnlockHwSurface() TUint8* EpocSdlEnv::LockHwSurface() { - return gEpocEnv->iDsa->LockHwSurface(); + return gEpocEnv->iDsa->LockSurface(); } void EpocSdlEnv::UpdateSwSurface() diff --git a/src/video/symbian/dsa.cpp b/src/video/symbian/dsa.cpp index 27907d9..387cd65 100644 --- a/src/video/symbian/dsa.cpp +++ b/src/video/symbian/dsa.cpp @@ -8,77 +8,6 @@ static int BytesPerPixel(TDisplayMode aMode) return ((TDisplayModeUtils::NumDisplayModeBitsPerPixel(aMode) - 1) >> 3) + 1; } -template -class CBitmapSurface : public T -{ - public: - CBitmapSurface(RWsSession& aSession); - - private: - void ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice); - ~CBitmapSurface(); - TUint8* LockSurface(); - void UnlockHwSurface(); - void CreateSurfaceL(const TSize& aSize); - void Free(); - void Update(CFbsBitmap& aBmp); - CFbsBitmap* iBmp; -}; - -template -void CBitmapSurface::ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice) -{ - T::ConstructL(aWindow, aDevice); -} - -template -CBitmapSurface::CBitmapSurface(RWsSession& aSession) : T(aSession) -{ -} - -template -void CBitmapSurface::Free() -{ - delete iBmp; - iBmp = NULL; - T::Free(); -} - -template -CBitmapSurface::~CBitmapSurface() -{ - __ASSERT_DEBUG(iBmp == NULL, PANIC(KErrNotReady)); -} - -template -TUint8* CBitmapSurface::LockSurface() -{ - iBmp->LockHeap(); - return reinterpret_cast(iBmp->DataAddress()); -} - -template -void CBitmapSurface::UnlockHwSurface() -{ - iBmp->UnlockHeap(); - Update(*iBmp); -} - -template -void CBitmapSurface::Update(CFbsBitmap& aBmp) -{ - T::DoBlt(aBmp); - T::CompleteUpdate(); -} - -template -void CBitmapSurface::CreateSurfaceL(const TSize& aSize) -{ - Free(); - iBmp = new CFbsBitmap(); - User::LeaveIfError(iBmp->Create(aSize, T::DisplayMode())); -} - ////////////////////////////////////////////////////////////////////// class CDsaGles : public CDsa @@ -96,13 +25,13 @@ class CDsaGles : public CDsa class CDsaBase : public CDsa, public MDirectScreenAccess { - protected: + public: CDsaBase(RWsSession& aSession) : CDsa(aSession) { m_updateWholeScreen = false; } ~CDsaBase(); + + protected: void ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice); void Stop(); - void CompleteUpdate(); - void DoBlt(CFbsBitmap& aBmp); CDirectScreenAccess* iDsa; @@ -110,6 +39,14 @@ class CDsaBase : public CDsa, public MDirectScreenAccess void AbortNow(RDirectScreenAccess::TTerminationReasons aReason); void Restart(RDirectScreenAccess::TTerminationReasons aReason); void RestartL(); + + void Free(); + + TUint8* LockSurface(); + void UnlockHwSurface(); + void CreateSurfaceL(const TSize& aSize); + + CFbsBitmap* iBmp; }; void CDsaBase::ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice) @@ -126,16 +63,6 @@ void CDsaBase::ConstructL(RWindow& aWindow, CWsScreenDevice& aDevice) RestartL(); } -void CDsaBase::CompleteUpdate() -{ - iDsa->ScreenDevice()->Update(); -} - -void CDsaBase::DoBlt(CFbsBitmap& aBmp) -{ - iDsa->Gc()->BitBlt(TPoint(0, 0), &aBmp); -} - CDsaBase::~CDsaBase() { if(iDsa != NULL) @@ -153,6 +80,32 @@ void CDsaBase::RestartL() Start(); } +void CDsaBase::Free() +{ + delete iBmp; + iBmp = NULL; +} + +TUint8* CDsaBase::LockSurface() +{ + iBmp->LockHeap(); + return reinterpret_cast(iBmp->DataAddress()); +} + +void CDsaBase::UnlockHwSurface() +{ + iBmp->UnlockHeap(); + iDsa->Gc()->BitBlt(TPoint(0, 0), iBmp); + iDsa->ScreenDevice()->Update(); +} + +void CDsaBase::CreateSurfaceL(const TSize& aSize) +{ + Free(); + iBmp = new CFbsBitmap(); + User::LeaveIfError(iBmp->Create(aSize, DisplayMode())); +} + void CDsaBase::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) { Stop(); @@ -232,7 +185,7 @@ void ClipCopy(const TDsa& iDsa, TUint8* aTarget, CDsa* CDsa::CreateL(RWsSession& aSession) { - return new CBitmapSurface(aSession); + return new CDsaBase(aSession); } void CDsa::Free() @@ -253,10 +206,6 @@ void CDsa::ConstructL(RWindow& aWindow, CWsScreenDevice& /*aDevice*/) iWindow = &aWindow; } -void CDsa::DoBlt(CFbsBitmap& /*aBmp*/) -{ -} - int CDsa::SetPalette(int aFirst, int aCount, TUint32* aPalette) { if(iLut256 == NULL) @@ -283,11 +232,6 @@ RWsSession& CDsa::Session() return iSession; } -TUint8* CDsa::LockHwSurface() -{ - return LockSurface(); -} - int CDsa::AllocSurface(const TSize& aSize, TDisplayMode aMode) { iSourceMode = aMode; @@ -336,7 +280,7 @@ bool CDsa::AddUpdateRect(const TUint8* aBits, const TRect& aUpdateRect, const TR { if(iTargetAddr == NULL) { - iTargetAddr = LockHwSurface(); + iTargetAddr = LockSurface(); } TUint8* target = iTargetAddr; diff --git a/symbian/include/internal/dsa.h b/symbian/include/internal/dsa.h index e4247f1..c39a0b6 100644 --- a/symbian/include/internal/dsa.h +++ b/symbian/include/internal/dsa.h @@ -19,7 +19,6 @@ class CDsa : public CBase ~CDsa(); - TUint8* LockHwSurface(); TInt AllocSurface(const TSize& aSize, TDisplayMode aMode); inline TDisplayMode DisplayMode() const; @@ -38,7 +37,6 @@ class CDsa : public CBase virtual TUint8* LockSurface() = 0; virtual void UnlockHwSurface() = 0; virtual void Stop(); - virtual void DoBlt(CFbsBitmap& aBmp); bool m_updateWholeScreen; -- 2.11.4.GIT