diff options
Diffstat (limited to 'engines/sword25/gfx/dynamicbitmap.cpp')
-rw-r--r-- | engines/sword25/gfx/dynamicbitmap.cpp | 66 |
1 files changed, 25 insertions, 41 deletions
diff --git a/engines/sword25/gfx/dynamicbitmap.cpp b/engines/sword25/gfx/dynamicbitmap.cpp index 9e5f2bb2f9..22a0d3d1dd 100644 --- a/engines/sword25/gfx/dynamicbitmap.cpp +++ b/engines/sword25/gfx/dynamicbitmap.cpp @@ -23,7 +23,7 @@ * */ -/* +/* * This code is based on Broken Sword 2.5 engine * * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer @@ -56,8 +56,7 @@ namespace Sword25 { // ----------------------------------------------------------------------------- BS_DynamicBitmap::BS_DynamicBitmap(BS_RenderObjectPtr<BS_RenderObject> ParentPtr, unsigned int Width, unsigned int Height) : - BS_Bitmap(ParentPtr, TYPE_DYNAMICBITMAP) -{ + BS_Bitmap(ParentPtr, TYPE_DYNAMICBITMAP) { // Das BS_Bitmap konnte nicht erzeugt werden, daher muss an dieser Stelle abgebrochen werden. if (!m_InitSuccess) return; @@ -66,16 +65,14 @@ BS_DynamicBitmap::BS_DynamicBitmap(BS_RenderObjectPtr<BS_RenderObject> ParentPtr // ----------------------------------------------------------------------------- -BS_DynamicBitmap::BS_DynamicBitmap(BS_InputPersistenceBlock & Reader, BS_RenderObjectPtr<BS_RenderObject> ParentPtr, unsigned int Handle) : - BS_Bitmap(ParentPtr, TYPE_DYNAMICBITMAP, Handle) -{ +BS_DynamicBitmap::BS_DynamicBitmap(BS_InputPersistenceBlock &Reader, BS_RenderObjectPtr<BS_RenderObject> ParentPtr, unsigned int Handle) : + BS_Bitmap(ParentPtr, TYPE_DYNAMICBITMAP, Handle) { m_InitSuccess = Unpersist(Reader); } // ----------------------------------------------------------------------------- -bool BS_DynamicBitmap::CreateGLImage(unsigned int Width, unsigned int Height) -{ +bool BS_DynamicBitmap::CreateGLImage(unsigned int Width, unsigned int Height) { // GLImage mit den gewünschten Maßen erstellen bool Result; m_Image.reset(new BS_GLImage(Width, Height, Result)); @@ -88,14 +85,12 @@ bool BS_DynamicBitmap::CreateGLImage(unsigned int Width, unsigned int Height) // ----------------------------------------------------------------------------- -BS_DynamicBitmap::~BS_DynamicBitmap() -{ +BS_DynamicBitmap::~BS_DynamicBitmap() { } // ----------------------------------------------------------------------------- -unsigned int BS_DynamicBitmap::GetPixel(int X, int Y) const -{ +unsigned int BS_DynamicBitmap::GetPixel(int X, int Y) const { BS_ASSERT(X >= 0 && X < m_Width); BS_ASSERT(Y >= 0 && Y < m_Height); @@ -104,27 +99,23 @@ unsigned int BS_DynamicBitmap::GetPixel(int X, int Y) const // ----------------------------------------------------------------------------- -bool BS_DynamicBitmap::DoRender() -{ +bool BS_DynamicBitmap::DoRender() { // Framebufferobjekt holen - BS_GraphicEngine * pGfx = static_cast<BS_GraphicEngine *>(BS_Kernel::GetInstance()->GetService("gfx")); + BS_GraphicEngine *pGfx = static_cast<BS_GraphicEngine *>(BS_Kernel::GetInstance()->GetService("gfx")); BS_ASSERT(pGfx); // Bitmap zeichnen bool Result; - if (m_ScaleFactorX == 1.0f && m_ScaleFactorY == 1.0f) - { + if (m_ScaleFactorX == 1.0f && m_ScaleFactorY == 1.0f) { Result = m_Image->Blit(m_AbsoluteX, m_AbsoluteY, - (m_FlipV ? BS_BitmapResource::FLIP_V : 0) | - (m_FlipH ? BS_BitmapResource::FLIP_H : 0), - 0, m_ModulationColor, -1, -1); - } - else - { + (m_FlipV ? BS_BitmapResource::FLIP_V : 0) | + (m_FlipH ? BS_BitmapResource::FLIP_H : 0), + 0, m_ModulationColor, -1, -1); + } else { Result = m_Image->Blit(m_AbsoluteX, m_AbsoluteY, - (m_FlipV ? BS_BitmapResource::FLIP_V : 0) | - (m_FlipH ? BS_BitmapResource::FLIP_H : 0), - 0, m_ModulationColor, m_Width, m_Height); + (m_FlipV ? BS_BitmapResource::FLIP_V : 0) | + (m_FlipH ? BS_BitmapResource::FLIP_H : 0), + 0, m_ModulationColor, m_Width, m_Height); } return Result; @@ -132,8 +123,7 @@ bool BS_DynamicBitmap::DoRender() // ----------------------------------------------------------------------------- -bool BS_DynamicBitmap::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) -{ +bool BS_DynamicBitmap::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) { return m_Image->SetContent(Pixeldata, Offset, Stride); } @@ -141,29 +131,25 @@ bool BS_DynamicBitmap::SetContent(const byte *Pixeldata, unsigned int Offset, un // Auskunftsmethoden // ----------------------------------------------------------------------------- -bool BS_DynamicBitmap::IsScalingAllowed() const -{ +bool BS_DynamicBitmap::IsScalingAllowed() const { return m_Image->IsScalingAllowed(); } // ----------------------------------------------------------------------------- -bool BS_DynamicBitmap::IsAlphaAllowed() const -{ +bool BS_DynamicBitmap::IsAlphaAllowed() const { return m_Image->IsAlphaAllowed(); } // ----------------------------------------------------------------------------- -bool BS_DynamicBitmap::IsColorModulationAllowed() const -{ +bool BS_DynamicBitmap::IsColorModulationAllowed() const { return m_Image->IsColorModulationAllowed(); } // ----------------------------------------------------------------------------- -bool BS_DynamicBitmap::IsSetContentAllowed() const -{ +bool BS_DynamicBitmap::IsSetContentAllowed() const { return true; } @@ -171,12 +157,11 @@ bool BS_DynamicBitmap::IsSetContentAllowed() const // Persistenz // ----------------------------------------------------------------------------- -bool BS_DynamicBitmap::Persist(BS_OutputPersistenceBlock & Writer) -{ +bool BS_DynamicBitmap::Persist(BS_OutputPersistenceBlock &Writer) { bool Result = true; Result &= BS_Bitmap::Persist(Writer); - + // Bilddaten werden nicht gespeichert. Dies ist auch nicht weiter von bedeutung, da BS_DynamicBitmap nur vom Videoplayer benutzt wird. // Während ein Video abläuft kann niemals gespeichert werden. BS_DynamicBitmap kann nur der Vollständigkeit halber persistiert werden. BS_LOG_WARNINGLN("Persisting a BS_DynamicBitmap. Bitmap content is not persisted."); @@ -186,8 +171,7 @@ bool BS_DynamicBitmap::Persist(BS_OutputPersistenceBlock & Writer) return Result; } -bool BS_DynamicBitmap::Unpersist(BS_InputPersistenceBlock & Reader) -{ +bool BS_DynamicBitmap::Unpersist(BS_InputPersistenceBlock &Reader) { bool Result = true; Result &= BS_Bitmap::Unpersist(Reader); |