aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx/opengl
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-06 13:13:25 +0000
committerEugene Sandulenko2010-10-12 22:35:55 +0000
commit47904bc7b2992189bb554833f00a79ff0fea9fb8 (patch)
tree1cec51758c6741b970bd064fafee77607b9f884f /engines/sword25/gfx/opengl
parentca17def625154e5f758b797e4fc48c76b0566320 (diff)
downloadscummvm-rg350-47904bc7b2992189bb554833f00a79ff0fea9fb8.tar.gz
scummvm-rg350-47904bc7b2992189bb554833f00a79ff0fea9fb8.tar.bz2
scummvm-rg350-47904bc7b2992189bb554833f00a79ff0fea9fb8.zip
SWORD25: Mass-astyle.
svn-id: r53222
Diffstat (limited to 'engines/sword25/gfx/opengl')
-rw-r--r--engines/sword25/gfx/opengl/glimage.cpp85
-rw-r--r--engines/sword25/gfx/opengl/glimage.h81
-rw-r--r--engines/sword25/gfx/opengl/glvectorimageblit.cpp54
-rw-r--r--engines/sword25/gfx/opengl/openglgfx.cpp207
-rw-r--r--engines/sword25/gfx/opengl/openglgfx.h50
-rw-r--r--engines/sword25/gfx/opengl/swimage.cpp43
-rw-r--r--engines/sword25/gfx/opengl/swimage.h65
7 files changed, 271 insertions, 314 deletions
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp
index 54d660aa7f..1434a93e4e 100644
--- a/engines/sword25/gfx/opengl/glimage.cpp
+++ b/engines/sword25/gfx/opengl/glimage.cpp
@@ -23,7 +23,7 @@
*
*/
-/*
+/*
* This code is based on Broken Sword 2.5 engine
*
* Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
@@ -50,21 +50,19 @@ namespace Sword25 {
// CONSTRUCTION / DESTRUCTION
// -----------------------------------------------------------------------------
-BS_GLImage::BS_GLImage(const Common::String & Filename, bool & Result) :
+BS_GLImage::BS_GLImage(const Common::String &Filename, bool &Result) :
m_Sprite(0),
m_Width(0),
- m_Height(0)
-{
+ m_Height(0) {
Result = false;
- BS_PackageManager * pPackage = static_cast<BS_PackageManager*>(BS_Kernel::GetInstance()->GetService("package"));
+ BS_PackageManager *pPackage = static_cast<BS_PackageManager *>(BS_Kernel::GetInstance()->GetService("package"));
BS_ASSERT(pPackage);
// Datei laden
- char* pFileData;
+ char *pFileData;
unsigned int FileSize;
- if (!(pFileData = (char*) pPackage->GetFile(Filename, &FileSize)))
- {
+ if (!(pFileData = (char *) pPackage->GetFile(Filename, &FileSize))) {
BS_LOG_ERRORLN("File \"%s\" could not be loaded.", Filename.c_str());
return;
}
@@ -72,16 +70,14 @@ BS_GLImage::BS_GLImage(const Common::String & Filename, bool & Result) :
// Bildeigenschaften bestimmen
BS_GraphicEngine::COLOR_FORMATS ColorFormat;
int Pitch;
- if (!BS_ImageLoader::ExtractImageProperties(pFileData, FileSize, ColorFormat, m_Width, m_Height))
- {
+ if (!BS_ImageLoader::ExtractImageProperties(pFileData, FileSize, ColorFormat, m_Width, m_Height)) {
BS_LOG_ERRORLN("Could not read image properties.");
return;
}
// Das Bild dekomprimieren
- char * pUncompressedData;
- if (!BS_ImageLoader::LoadImage(pFileData, FileSize, BS_GraphicEngine::CF_ABGR32, pUncompressedData, m_Width, m_Height, Pitch))
- {
+ char *pUncompressedData;
+ if (!BS_ImageLoader::LoadImage(pFileData, FileSize, BS_GraphicEngine::CF_ABGR32, pUncompressedData, m_Width, m_Height, Pitch)) {
BS_LOG_ERRORLN("Could not decode image.");
return;
}
@@ -91,11 +87,10 @@ BS_GLImage::BS_GLImage(const Common::String & Filename, bool & Result) :
// GLS-Sprite mit den Bilddaten erstellen
GLS_Result GLSResult = GLS_NewSprite(m_Width, m_Height,
- (ColorFormat == BS_GraphicEngine::CF_ARGB32) ? GLS_True : GLS_False,
- pUncompressedData,
- &m_Sprite);
- if (Result != GLS_OK)
- {
+ (ColorFormat == BS_GraphicEngine::CF_ARGB32) ? GLS_True : GLS_False,
+ pUncompressedData,
+ &m_Sprite);
+ if (Result != GLS_OK) {
BS_LOG_ERRORLN("Could not create GLS_Sprite. Reason: %s", GLS_ResultString(GLSResult));
return;
}
@@ -109,20 +104,18 @@ BS_GLImage::BS_GLImage(const Common::String & Filename, bool & Result) :
// -----------------------------------------------------------------------------
-BS_GLImage::BS_GLImage(unsigned int Width, unsigned int Height, bool & Result) :
+BS_GLImage::BS_GLImage(unsigned int Width, unsigned int Height, bool &Result) :
m_Sprite(0),
m_Width(Width),
- m_Height(Height)
-{
+ m_Height(Height) {
Result = false;
// GLS-Sprite mit den Bilddaten erstellen
GLS_Result GLSResult = GLS_NewSprite(m_Width, m_Height,
- GLS_True,
- 0,
- &m_Sprite);
- if (GLSResult != GLS_OK)
- {
+ GLS_True,
+ 0,
+ &m_Sprite);
+ if (GLSResult != GLS_OK) {
BS_LOG_ERRORLN("Could not create GLS_Sprite. Reason: %s", GLS_ResultString(GLSResult));
return;
}
@@ -133,34 +126,29 @@ BS_GLImage::BS_GLImage(unsigned int Width, unsigned int Height, bool & Result) :
// -----------------------------------------------------------------------------
-BS_GLImage::~BS_GLImage()
-{
+BS_GLImage::~BS_GLImage() {
if (m_Sprite) GLS_DeleteSprite(m_Sprite);
}
// -----------------------------------------------------------------------------
-bool BS_GLImage::Fill(const BS_Rect* pFillRect, unsigned int Color)
-{
+bool BS_GLImage::Fill(const BS_Rect *pFillRect, unsigned int Color) {
BS_LOG_ERRORLN("Fill() is not supported.");
return false;
}
// -----------------------------------------------------------------------------
-bool BS_GLImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride)
-{
+bool BS_GLImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
// Überprüfen, ob PixelData ausreichend viele Pixel enthält um ein Bild der Größe Width * Height zu erzeugen
- if (Pixeldata.size() < static_cast<unsigned int>(m_Width * m_Height * 4))
- {
+ if (Pixeldata.size() < static_cast<unsigned int>(m_Width * m_Height * 4)) {
BS_LOG_ERRORLN("PixelData vector is too small to define a 32 bit %dx%d image.", m_Width, m_Height);
return false;
}
// GLS-Sprite mit den Bilddaten füllen
GLS_Result GLSResult = GLS_SetSpriteData(m_Sprite, m_Width, m_Height, &Pixeldata[Offset], Stride / 4);
- if (GLSResult != GLS_OK)
- {
+ if (GLSResult != GLS_OK) {
BS_LOG_ERRORLN("CGLS_SetSpriteData() failed. Reason: %s", GLS_ResultString(GLSResult));
return false;
}
@@ -170,8 +158,7 @@ bool BS_GLImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned
// -----------------------------------------------------------------------------
-unsigned int BS_GLImage::GetPixel(int X, int Y)
-{
+unsigned int BS_GLImage::GetPixel(int X, int Y) {
BS_LOG_ERRORLN("GetPixel() is not supported. Returning black.");
return 0;
}
@@ -179,15 +166,13 @@ unsigned int BS_GLImage::GetPixel(int X, int Y)
// -----------------------------------------------------------------------------
bool BS_GLImage::Blit(int PosX, int PosY,
- int Flipping,
- BS_Rect* pPartRect,
- unsigned int Color,
- int Width, int Height)
-{
+ int Flipping,
+ BS_Rect *pPartRect,
+ unsigned int Color,
+ int Width, int Height) {
// BS_Rect nach GLS_Rect konvertieren
GLS_Rect SubImage;
- if (pPartRect)
- {
+ if (pPartRect) {
SubImage.x1 = pPartRect->left;
SubImage.y1 = pPartRect->top;
SubImage.x2 = pPartRect->right;
@@ -214,11 +199,11 @@ bool BS_GLImage::Blit(int PosX, int PosY,
// Die Bedeutung von FLIP_V und FLIP_H ist vertauscht. Allerdings glaubt der Rest der Engine auch daran, daher war es einfacher diesen Fehler
// weiterzuführen. Bei Gelegenheit ist dieses aber zu ändern.
GLS_Result Result = GLS_Blit(m_Sprite,
- PosX, PosY,
- pPartRect ? &SubImage : 0, &GLSColor,
- (Flipping & BS_Image::FLIP_V) ? GLS_True : GLS_False,
- (Flipping & BS_Image::FLIP_H) ? GLS_True : GLS_False,
- ScaleX, ScaleY);
+ PosX, PosY,
+ pPartRect ? &SubImage : 0, &GLSColor,
+ (Flipping & BS_Image::FLIP_V) ? GLS_True : GLS_False,
+ (Flipping & BS_Image::FLIP_H) ? GLS_True : GLS_False,
+ ScaleX, ScaleY);
if (Result != GLS_OK) BS_LOG_ERRORLN("GLS_Blit() failed. Reason: %s", GLS_ResultString(Result));
return Result == GLS_OK;
diff --git a/engines/sword25/gfx/opengl/glimage.h b/engines/sword25/gfx/opengl/glimage.h
index ae94473778..c5a7480874 100644
--- a/engines/sword25/gfx/opengl/glimage.h
+++ b/engines/sword25/gfx/opengl/glimage.h
@@ -23,7 +23,7 @@
*
*/
-/*
+/*
* This code is based on Broken Sword 2.5 engine
*
* Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
@@ -51,52 +51,71 @@ namespace Sword25 {
// FORWARD DECLARATION
// -----------------------------------------------------------------------------
-typedef void * GLS_Sprite;
+typedef void *GLS_Sprite;
// -----------------------------------------------------------------------------
// CLASS DEFINITION
// -----------------------------------------------------------------------------
-class BS_GLImage : public BS_Image
-{
+class BS_GLImage : public BS_Image {
public:
- BS_GLImage(const Common::String & Filename, bool & Result);
+ BS_GLImage(const Common::String &Filename, bool &Result);
/**
- @brief Erzeugt ein leeres BS_GLImage
+ @brief Erzeugt ein leeres BS_GLImage
- @param Width die Breite des zu erzeugenden Bildes.
- @param Height die Höhe des zu erzeugenden Bildes
- @param Result gibt dem Aufrufer bekannt, ob der Konstruktor erfolgreich ausgeführt wurde. Wenn es nach dem Aufruf false enthalten sollte,
- dürfen keine Methoden am Objekt aufgerufen werden und das Objekt ist sofort zu zerstören.
+ @param Width die Breite des zu erzeugenden Bildes.
+ @param Height die Höhe des zu erzeugenden Bildes
+ @param Result gibt dem Aufrufer bekannt, ob der Konstruktor erfolgreich ausgeführt wurde. Wenn es nach dem Aufruf false enthalten sollte,
+ dürfen keine Methoden am Objekt aufgerufen werden und das Objekt ist sofort zu zerstören.
*/
- BS_GLImage(unsigned int Width, unsigned int Height, bool & Result);
+ BS_GLImage(unsigned int Width, unsigned int Height, bool &Result);
virtual ~BS_GLImage();
- virtual int GetWidth() const { return m_Width; }
- virtual int GetHeight() const { return m_Height; }
- virtual BS_GraphicEngine::COLOR_FORMATS GetColorFormat() const { return BS_GraphicEngine::CF_ARGB32; }
-
- virtual bool Blit(int PosX = 0, int PosY = 0,
- int Flipping = BS_Image::FLIP_NONE,
- BS_Rect* pPartRect = NULL,
- unsigned int Color = BS_ARGB(255, 255, 255, 255),
- int Width = -1, int Height = -1);
- virtual bool Fill(const BS_Rect* pFillRect, unsigned int Color);
+ virtual int GetWidth() const {
+ return m_Width;
+ }
+ virtual int GetHeight() const {
+ return m_Height;
+ }
+ virtual BS_GraphicEngine::COLOR_FORMATS GetColorFormat() const {
+ return BS_GraphicEngine::CF_ARGB32;
+ }
+
+ virtual bool Blit(int PosX = 0, int PosY = 0,
+ int Flipping = BS_Image::FLIP_NONE,
+ BS_Rect *pPartRect = NULL,
+ unsigned int Color = BS_ARGB(255, 255, 255, 255),
+ int Width = -1, int Height = -1);
+ virtual bool Fill(const BS_Rect *pFillRect, unsigned int Color);
virtual bool SetContent(const byte *Pixeldata, unsigned int Offset = 0, unsigned int Stride = 0);
virtual unsigned int GetPixel(int X, int Y);
- virtual bool IsBlitSource() const { return true; }
- virtual bool IsBlitTarget() const { return false; }
- virtual bool IsScalingAllowed() const { return true; }
- virtual bool IsFillingAllowed() const { return false; }
- virtual bool IsAlphaAllowed() const { return true; }
- virtual bool IsColorModulationAllowed() const { return true; }
- virtual bool IsSetContentAllowed() const { return true; }
+ virtual bool IsBlitSource() const {
+ return true;
+ }
+ virtual bool IsBlitTarget() const {
+ return false;
+ }
+ virtual bool IsScalingAllowed() const {
+ return true;
+ }
+ virtual bool IsFillingAllowed() const {
+ return false;
+ }
+ virtual bool IsAlphaAllowed() const {
+ return true;
+ }
+ virtual bool IsColorModulationAllowed() const {
+ return true;
+ }
+ virtual bool IsSetContentAllowed() const {
+ return true;
+ }
private:
- GLS_Sprite m_Sprite;
- int m_Width;
- int m_Height;
+ GLS_Sprite m_Sprite;
+ int m_Width;
+ int m_Height;
};
} // End of namespace Sword25
diff --git a/engines/sword25/gfx/opengl/glvectorimageblit.cpp b/engines/sword25/gfx/opengl/glvectorimageblit.cpp
index 262153f59e..9368e921e1 100644
--- a/engines/sword25/gfx/opengl/glvectorimageblit.cpp
+++ b/engines/sword25/gfx/opengl/glvectorimageblit.cpp
@@ -23,7 +23,7 @@
*
*/
-/*
+/*
* This code is based on Broken Sword 2.5 engine
*
* Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
@@ -50,64 +50,56 @@ using namespace std;
// -----------------------------------------------------------------------------
-namespace
-{
- const float LINE_SCALE_FACTOR = 1.0f;
+namespace {
+const float LINE_SCALE_FACTOR = 1.0f;
}
// -----------------------------------------------------------------------------
bool BS_VectorImage::Blit(int PosX, int PosY,
- int Flipping,
- BS_Rect* pPartRect,
- unsigned int Color,
- int Width, int Height)
-{
+ int Flipping,
+ BS_Rect *pPartRect,
+ unsigned int Color,
+ int Width, int Height) {
static BS_VectorImageRenderer VectorImageRenderer;
static vector<char> PixelData;
static GLS_Sprite Sprite = 0;
- static BS_VectorImage * OldThis = 0;
- static int OldWidth;
- static int OldHeight;
- static GLS_Rect OldSubImage;
+ static BS_VectorImage *OldThis = 0;
+ static int OldWidth;
+ static int OldHeight;
+ static GLS_Rect OldSubImage;
// Falls Breite oder Höhe 0 sind, muss nichts dargestellt werden.
if (Width == 0 || Height == 0) return true;
// Sprite erstellen, falls es noch nicht erstellt wurde
- if (Sprite == 0)
- {
+ if (Sprite == 0) {
GLS_Result Result = GLS_NewSprite(512, 512, GLS_True, 0, &Sprite);
- if (Result != GLS_OK)
- {
+ if (Result != GLS_OK) {
BS_LOG_ERRORLN("Could not create GLS_Sprite. Reason: %s", GLS_ResultString(Result));
return false;
}
}
// Feststellen, ob das alte Bild im Cache nicht wiederbenutzt werden kann und neu Berechnet werden muss
- if (!(OldThis == this && OldWidth == Width && OldHeight == Height && Sprite != 0))
- {
+ if (!(OldThis == this && OldWidth == Width && OldHeight == Height && Sprite != 0)) {
float ScaleFactorX = (Width == - 1) ? 1 : static_cast<float>(Width) / static_cast<float>(GetWidth());
- float ScaleFactorY = (Height == - 1) ? 1: static_cast<float>(Height) / static_cast<float>(GetHeight());
+ float ScaleFactorY = (Height == - 1) ? 1 : static_cast<float>(Height) / static_cast<float>(GetHeight());
unsigned int RenderedWidth;
unsigned int RenderedHeight;
- if (!VectorImageRenderer.Render(*this, ScaleFactorX, ScaleFactorY, RenderedWidth, RenderedHeight, PixelData, LINE_SCALE_FACTOR))
- {
+ if (!VectorImageRenderer.Render(*this, ScaleFactorX, ScaleFactorY, RenderedWidth, RenderedHeight, PixelData, LINE_SCALE_FACTOR)) {
BS_LOG_ERRORLN("Call to BS_VectorImageRenderer::Render() failed.");
return false;
}
- if (RenderedWidth > 512 || RenderedHeight > 512)
- {
+ if (RenderedWidth > 512 || RenderedHeight > 512) {
BS_LOG_WARNINGLN("Currently the maximum size for scaled vector images is 512x512.");
return true;
}
GLS_Result Result = GLS_SetSpriteData(Sprite, RenderedWidth, RenderedHeight, &PixelData[0], 0);
- if (Result != GLS_OK)
- {
+ if (Result != GLS_OK) {
BS_LOG_ERRORLN("Call to GLS_SetSpriteData() failed. Reason: %s", GLS_ResultString(Result));
return false;
}
@@ -140,11 +132,11 @@ bool BS_VectorImage::Blit(int PosX, int PosY,
// Die Bedeutung von FLIP_V und FLIP_H ist vertauscht. Allerdings glaubt der Rest der Engine auch daran, daher war es einfacher diesen Fehler
// weiterzuführen. Bei Gelegenheit ist dieses aber zu ändern.
GLS_Result Result = GLS_Blit(Sprite,
- PosX, PosY,
- &OldSubImage, &GLSColor,
- (Flipping & BS_Image::FLIP_V) ? GLS_True : GLS_False,
- (Flipping & BS_Image::FLIP_H) ? GLS_True : GLS_False,
- 1.0f, 1.0f);
+ PosX, PosY,
+ &OldSubImage, &GLSColor,
+ (Flipping & BS_Image::FLIP_V) ? GLS_True : GLS_False,
+ (Flipping & BS_Image::FLIP_H) ? GLS_True : GLS_False,
+ 1.0f, 1.0f);
if (Result != GLS_OK) BS_LOG_ERRORLN("GLS_Blit() failed. Reason: %s", GLS_ResultString(Result));
return Result == GLS_OK;
diff --git a/engines/sword25/gfx/opengl/openglgfx.cpp b/engines/sword25/gfx/opengl/openglgfx.cpp
index 7d97828213..612e1c209e 100644
--- a/engines/sword25/gfx/opengl/openglgfx.cpp
+++ b/engines/sword25/gfx/opengl/openglgfx.cpp
@@ -23,7 +23,7 @@
*
*/
-/*
+/*
* This code is based on Broken Sword 2.5 engine
*
* Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
@@ -68,16 +68,15 @@ using namespace std;
// CONSTANTS
// -----------------------------------------------------------------------------
-namespace
-{
- const unsigned int BIT_DEPTH = 32;
- const unsigned int BACKBUFFER_COUNT = 1;
- const Common::String PNG_EXTENSION(".png");
- const Common::String PNG_S_EXTENSION("_s.png");
- const Common::String ANI_EXTENSION("_ani.xml");
- const Common::String FNT_EXTENSION("_fnt.xml");
- const Common::String SWF_EXTENSION(".swf");
- const Common::String B25S_EXTENSION(".b25s");
+namespace {
+const unsigned int BIT_DEPTH = 32;
+const unsigned int BACKBUFFER_COUNT = 1;
+const Common::String PNG_EXTENSION(".png");
+const Common::String PNG_S_EXTENSION("_s.png");
+const Common::String ANI_EXTENSION("_ani.xml");
+const Common::String FNT_EXTENSION("_fnt.xml");
+const Common::String SWF_EXTENSION(".swf");
+const Common::String B25S_EXTENSION(".b25s");
}
@@ -85,23 +84,20 @@ namespace
// CONSTRUCTION / DESTRUCTION
// -----------------------------------------------------------------------------
-BS_OpenGLGfx::BS_OpenGLGfx(BS_Kernel * pKernel) :
+BS_OpenGLGfx::BS_OpenGLGfx(BS_Kernel *pKernel) :
BS_GraphicEngine(pKernel),
- m_GLspritesInitialized(false)
-{
+ m_GLspritesInitialized(false) {
}
// -----------------------------------------------------------------------------
-BS_OpenGLGfx::~BS_OpenGLGfx()
-{
+BS_OpenGLGfx::~BS_OpenGLGfx() {
if (m_GLspritesInitialized) GLS_Quit();
}
// -----------------------------------------------------------------------------
-BS_Service * BS_OpenGLGfx_CreateObject(BS_Kernel* pKernel)
-{
+BS_Service *BS_OpenGLGfx_CreateObject(BS_Kernel *pKernel) {
return new BS_OpenGLGfx(pKernel);
}
@@ -110,18 +106,15 @@ BS_Service * BS_OpenGLGfx_CreateObject(BS_Kernel* pKernel)
// INTERFACE
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::Init(int Width, int Height, int BitDepth, int BackbufferCount, bool Windowed)
-{
+bool BS_OpenGLGfx::Init(int Width, int Height, int BitDepth, int BackbufferCount, bool Windowed) {
// Warnung ausgeben, wenn eine nicht unterstützte Bittiefe gewählt wurde.
- if (BitDepth != BIT_DEPTH)
- {
+ if (BitDepth != BIT_DEPTH) {
BS_LOG_WARNINGLN("Can't use a bit depth of %d (not supported). Falling back to %d.", BitDepth, BIT_DEPTH);
m_BitDepth = BIT_DEPTH;
}
// Warnung ausgeben, wenn nicht genau ein Backbuffer gewählt wurde.
- if (BackbufferCount != BACKBUFFER_COUNT)
- {
+ if (BackbufferCount != BACKBUFFER_COUNT) {
BS_LOG_WARNINGLN("Can't use %d backbuffers (not supported). Falling back to %d.", BackbufferCount, BACKBUFFER_COUNT);
BackbufferCount = BACKBUFFER_COUNT;
}
@@ -139,8 +132,7 @@ bool BS_OpenGLGfx::Init(int Width, int Height, int BitDepth, int BackbufferCount
// GLsprites initialisieren
HWND hwnd = reinterpret_cast<HWND>(BS_Kernel::GetInstance()->GetWindow()->GetWindowHandle());
GLS_Result Result = GLS_InitExternalWindow(Width, Height, Windowed ? GLS_False : GLS_True, hwnd);
- if (Result != GLS_OK)
- {
+ if (Result != GLS_OK) {
BS_LOG_ERRORLN("Could not initialize GLsprites. Reason: %s", GLS_ResultString(Result));
return false;
}
@@ -153,7 +145,7 @@ bool BS_OpenGLGfx::Init(int Width, int Height, int BitDepth, int BackbufferCount
m_RenderObjectManagerPtr.reset(new BS_RenderObjectManager(Width, Height, BackbufferCount + 1));
// Hauptpanel erstellen
- m_MainPanelPtr = m_RenderObjectManagerPtr->GetTreeRoot()->AddPanel(Width, Height, BS_ARGB(0,0,0,0));
+ m_MainPanelPtr = m_RenderObjectManagerPtr->GetTreeRoot()->AddPanel(Width, Height, BS_ARGB(0, 0, 0, 0));
if (!m_MainPanelPtr.IsValid()) return false;
m_MainPanelPtr->SetVisible(true);
@@ -162,8 +154,7 @@ bool BS_OpenGLGfx::Init(int Width, int Height, int BitDepth, int BackbufferCount
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::StartFrame(bool UpdateAll)
-{
+bool BS_OpenGLGfx::StartFrame(bool UpdateAll) {
// Berechnen, wie viel Zeit seit dem letzten Frame vergangen ist.
// Dieser Wert kann über GetLastFrameDuration() von Modulen abgefragt werden, die zeitabhängig arbeiten.
UpdateLastFrameDuration();
@@ -173,8 +164,7 @@ bool BS_OpenGLGfx::StartFrame(bool UpdateAll)
// GLsprites bescheidgeben
GLS_Result Result = GLS_StartFrame();
- if (Result != GLS_OK)
- {
+ if (Result != GLS_OK) {
BS_LOG_ERRORLN("Call to GLS_StartFrame() failed. Reason: %s", GLS_ResultString(Result));
return false;
}
@@ -184,23 +174,20 @@ bool BS_OpenGLGfx::StartFrame(bool UpdateAll)
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::EndFrame()
-{
+bool BS_OpenGLGfx::EndFrame() {
// Scene zeichnen
m_RenderObjectManagerPtr->Render();
// Debug-Lines zeichnen
- if (!m_DebugLines.empty())
- {
+ if (!m_DebugLines.empty()) {
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINES);
Common::Array<DebugLine>::const_iterator iter = m_DebugLines.begin();
- for (; iter != m_DebugLines.end(); ++iter)
- {
- const unsigned int & Color = (*iter).Color;
- const BS_Vertex & Start = (*iter).Start;
- const BS_Vertex & End = (*iter).End;
+ for (; iter != m_DebugLines.end(); ++iter) {
+ const unsigned int &Color = (*iter).Color;
+ const BS_Vertex &Start = (*iter).Start;
+ const BS_Vertex &End = (*iter).End;
glColor4ub((Color >> 16) & 0xff, (Color >> 8) & 0xff, Color & 0xff, Color >> 24);
glVertex2d(Start.X, Start.Y);
@@ -215,8 +202,7 @@ bool BS_OpenGLGfx::EndFrame()
// Flippen
GLS_Result Result = GLS_EndFrame();
- if (Result != GLS_OK)
- {
+ if (Result != GLS_OK) {
BS_LOG_ERRORLN("Call to GLS_EndFrame() failed. Reason: %s", GLS_ResultString(Result));
return false;
}
@@ -229,27 +215,23 @@ bool BS_OpenGLGfx::EndFrame()
// -----------------------------------------------------------------------------
-BS_RenderObjectPtr<BS_Panel> BS_OpenGLGfx::GetMainPanel()
-{
+BS_RenderObjectPtr<BS_Panel> BS_OpenGLGfx::GetMainPanel() {
return m_MainPanelPtr;
}
// -----------------------------------------------------------------------------
-void BS_OpenGLGfx::SetVsync(bool Vsync)
-{
+void BS_OpenGLGfx::SetVsync(bool Vsync) {
GLS_Result Result = GLS_SetVSync(Vsync ? GLS_True : GLS_False);
if (Result != GLS_OK) BS_LOG_WARNINGLN("Could not set vsync status. Reason: %s", GLS_ResultString(Result));
}
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::GetVsync() const
-{
+bool BS_OpenGLGfx::GetVsync() const {
GLS_Bool Status;
GLS_Result Result = GLS_IsVsync(&Status);
- if (Result != GLS_OK)
- {
+ if (Result != GLS_OK) {
BS_LOG_WARNINGLN("Could not get vsync status. Returning false. Reason: %s", GLS_ResultString(Result));
return false;
}
@@ -259,12 +241,10 @@ bool BS_OpenGLGfx::GetVsync() const
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::Fill(const BS_Rect* FillRectPtr, unsigned int Color)
-{
+bool BS_OpenGLGfx::Fill(const BS_Rect *FillRectPtr, unsigned int Color) {
BS_Rect Rect;
- if (!FillRectPtr)
- {
+ if (!FillRectPtr) {
Rect.left = 0;
Rect.top = 0;
Rect.right = m_Width;
@@ -273,12 +253,12 @@ bool BS_OpenGLGfx::Fill(const BS_Rect* FillRectPtr, unsigned int Color)
}
glBegin(GL_QUADS);
- glColor4ub((Color >> 16) & 0xff, (Color >> 8) & 0xff, Color & 0xff, Color >> 24);
+ glColor4ub((Color >> 16) & 0xff, (Color >> 8) & 0xff, Color & 0xff, Color >> 24);
- glVertex2i(FillRectPtr->left, FillRectPtr->top);
- glVertex2i(FillRectPtr->right, FillRectPtr->top);
- glVertex2i(FillRectPtr->right, FillRectPtr->bottom);
- glVertex2i(FillRectPtr->left, FillRectPtr->bottom);
+ glVertex2i(FillRectPtr->left, FillRectPtr->top);
+ glVertex2i(FillRectPtr->right, FillRectPtr->top);
+ glVertex2i(FillRectPtr->right, FillRectPtr->bottom);
+ glVertex2i(FillRectPtr->left, FillRectPtr->bottom);
glEnd();
return glGetError() == 0;
@@ -286,8 +266,7 @@ bool BS_OpenGLGfx::Fill(const BS_Rect* FillRectPtr, unsigned int Color)
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::GetScreenshot(unsigned int & Width, unsigned int & Height, vector<unsigned int> & Data)
-{
+bool BS_OpenGLGfx::GetScreenshot(unsigned int &Width, unsigned int &Height, vector<unsigned int> & Data) {
if (!ReadFramebufferContents(m_Width, m_Height, Data)) return false;
// Die Größe des Framebuffers zurückgeben.
@@ -303,15 +282,13 @@ bool BS_OpenGLGfx::GetScreenshot(unsigned int & Width, unsigned int & Height, ve
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Height, Common::Array<unsigned int> & Data)
-{
+bool BS_OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Height, Common::Array<unsigned int> & Data) {
Data.resize(Width * Height);
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, &Data[0]);
if (glGetError() == 0)
return true;
- else
- {
+ else {
Data.clear();
return false;
}
@@ -319,11 +296,9 @@ bool BS_OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Heig
// -----------------------------------------------------------------------------
-void BS_OpenGLGfx::ReverseRGBAComponentOrder(vector<unsigned int> & Data)
-{
+void BS_OpenGLGfx::ReverseRGBAComponentOrder(vector<unsigned int> & Data) {
vector<unsigned int>::iterator It = Data.begin();
- while (It != Data.end())
- {
+ while (It != Data.end()) {
unsigned int Pixel = *It;
*It = (Pixel & 0xff00ff00) | ((Pixel >> 16) & 0xff) | ((Pixel & 0xff) << 16);
++It;
@@ -332,12 +307,10 @@ void BS_OpenGLGfx::ReverseRGBAComponentOrder(vector<unsigned int> & Data)
// -----------------------------------------------------------------------------
-void BS_OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height, vector<unsigned int> & Data)
-{
+void BS_OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height, vector<unsigned int> & Data) {
vector<unsigned int> LineBuffer(Width);
- for (unsigned int Y = 0; Y < Height / 2; ++Y)
- {
+ for (unsigned int Y = 0; Y < Height / 2; ++Y) {
vector<unsigned int>::iterator Line1It = Data.begin() + Y * Width;
vector<unsigned int>::iterator Line2It = Data.begin() + (Height - 1 - Y) * Width;
copy(Line1It, Line1It + Width, LineBuffer.begin());
@@ -350,8 +323,7 @@ void BS_OpenGLGfx::FlipImagedataVertical(unsigned int Width, unsigned int Height
// RESOURCE MANAGING
// -----------------------------------------------------------------------------
-static bool DoesStringEndWith(const Common::String & String, const std::string & OtherString)
-{
+static bool DoesStringEndWith(const Common::String &String, const std::string &OtherString) {
Common::String::size_type StringPos = String.rfind(OtherString);
if (StringPos == Common::String::npos) return false;
@@ -360,24 +332,20 @@ static bool DoesStringEndWith(const Common::String & String, const std::string &
// -----------------------------------------------------------------------------
-BS_Resource * BS_OpenGLGfx::LoadResource(const Common::String& FileName)
-{
+BS_Resource *BS_OpenGLGfx::LoadResource(const Common::String &FileName) {
BS_ASSERT(CanLoadResource(FileName));
// Bild für den Softwarebuffer laden
- if (DoesStringEndWith(FileName, PNG_S_EXTENSION))
- {
+ if (DoesStringEndWith(FileName, PNG_S_EXTENSION)) {
bool Result;
- BS_SWImage * pImage = new BS_SWImage(FileName, Result);
- if (!Result)
- {
+ BS_SWImage *pImage = new BS_SWImage(FileName, Result);
+ if (!Result) {
delete pImage;
return 0;
}
- BS_BitmapResource * pResource = new BS_BitmapResource(FileName, pImage);
- if (!pResource->IsValid())
- {
+ BS_BitmapResource *pResource = new BS_BitmapResource(FileName, pImage);
+ if (!pResource->IsValid()) {
delete pResource;
return 0;
}
@@ -386,19 +354,16 @@ BS_Resource * BS_OpenGLGfx::LoadResource(const Common::String& FileName)
}
// Sprite-Bild laden
- if (DoesStringEndWith(FileName, PNG_EXTENSION) || DoesStringEndWith(FileName, B25S_EXTENSION))
- {
+ if (DoesStringEndWith(FileName, PNG_EXTENSION) || DoesStringEndWith(FileName, B25S_EXTENSION)) {
bool Result;
- BS_GLImage * pImage = new BS_GLImage(FileName, Result);
- if (!Result)
- {
+ BS_GLImage *pImage = new BS_GLImage(FileName, Result);
+ if (!Result) {
delete pImage;
return 0;
}
- BS_BitmapResource * pResource = new BS_BitmapResource(FileName, pImage);
- if (!pResource->IsValid())
- {
+ BS_BitmapResource *pResource = new BS_BitmapResource(FileName, pImage);
+ if (!pResource->IsValid()) {
delete pResource;
return 0;
}
@@ -408,33 +373,29 @@ BS_Resource * BS_OpenGLGfx::LoadResource(const Common::String& FileName)
// Vectorgraphik laden
- if (DoesStringEndWith(FileName, SWF_EXTENSION))
- {
+ if (DoesStringEndWith(FileName, SWF_EXTENSION)) {
// Pointer auf Package-Manager holen
- BS_PackageManager * pPackage = BS_Kernel::GetInstance()->GetPackage();
+ BS_PackageManager *pPackage = BS_Kernel::GetInstance()->GetPackage();
BS_ASSERT(pPackage);
// Datei laden
- unsigned char* pFileData;
+ unsigned char *pFileData;
unsigned int FileSize;
- if (!(pFileData = static_cast<unsigned char*>(pPackage->GetFile(FileName, &FileSize))))
- {
+ if (!(pFileData = static_cast<unsigned char *>(pPackage->GetFile(FileName, &FileSize)))) {
BS_LOG_ERRORLN("File \"%s\" could not be loaded.", FileName.c_str());
return 0;
}
bool Result;
- BS_VectorImage * pImage = new BS_VectorImage(pFileData, FileSize, Result);
- if (!Result)
- {
+ BS_VectorImage *pImage = new BS_VectorImage(pFileData, FileSize, Result);
+ if (!Result) {
delete pImage;
delete [] pFileData;
return 0;
}
- BS_BitmapResource * pResource = new BS_BitmapResource(FileName, pImage);
- if (!pResource->IsValid())
- {
+ BS_BitmapResource *pResource = new BS_BitmapResource(FileName, pImage);
+ if (!pResource->IsValid()) {
delete pResource;
delete [] pFileData;
return 0;
@@ -445,26 +406,22 @@ BS_Resource * BS_OpenGLGfx::LoadResource(const Common::String& FileName)
}
// Animation laden
- if (DoesStringEndWith(FileName, ANI_EXTENSION))
- {
- BS_AnimationResource * pResource = new BS_AnimationResource(FileName);
+ if (DoesStringEndWith(FileName, ANI_EXTENSION)) {
+ BS_AnimationResource *pResource = new BS_AnimationResource(FileName);
if (pResource->IsValid())
return pResource;
- else
- {
+ else {
delete pResource;
return 0;
}
}
// Font laden
- if (DoesStringEndWith(FileName, FNT_EXTENSION))
- {
- BS_FontResource * pResource = new BS_FontResource(BS_Kernel::GetInstance(), FileName);
+ if (DoesStringEndWith(FileName, FNT_EXTENSION)) {
+ BS_FontResource *pResource = new BS_FontResource(BS_Kernel::GetInstance(), FileName);
if (pResource->IsValid())
return pResource;
- else
- {
+ else {
delete pResource;
return 0;
}
@@ -476,13 +433,12 @@ BS_Resource * BS_OpenGLGfx::LoadResource(const Common::String& FileName)
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::CanLoadResource(const Common::String& FileName)
-{
+bool BS_OpenGLGfx::CanLoadResource(const Common::String &FileName) {
return DoesStringEndWith(FileName, PNG_EXTENSION) ||
- DoesStringEndWith(FileName, ANI_EXTENSION) ||
- DoesStringEndWith(FileName, FNT_EXTENSION) ||
- DoesStringEndWith(FileName, SWF_EXTENSION) ||
- DoesStringEndWith(FileName, B25S_EXTENSION);
+ DoesStringEndWith(FileName, ANI_EXTENSION) ||
+ DoesStringEndWith(FileName, FNT_EXTENSION) ||
+ DoesStringEndWith(FileName, SWF_EXTENSION) ||
+ DoesStringEndWith(FileName, B25S_EXTENSION);
}
@@ -490,8 +446,7 @@ bool BS_OpenGLGfx::CanLoadResource(const Common::String& FileName)
// DEBUGGING
// -----------------------------------------------------------------------------
-void BS_OpenGLGfx::DrawDebugLine(const BS_Vertex & Start, const BS_Vertex & End, unsigned int Color)
-{
+void BS_OpenGLGfx::DrawDebugLine(const BS_Vertex &Start, const BS_Vertex &End, unsigned int Color) {
m_DebugLines.push_back(DebugLine(Start, End, Color));
}
@@ -499,8 +454,7 @@ void BS_OpenGLGfx::DrawDebugLine(const BS_Vertex & Start, const BS_Vertex & End,
// PERSISTENZ
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::Persist(BS_OutputPersistenceBlock & Writer)
-{
+bool BS_OpenGLGfx::Persist(BS_OutputPersistenceBlock &Writer) {
bool result = true;
result &= BS_GraphicEngine::Persist(Writer);
@@ -511,8 +465,7 @@ bool BS_OpenGLGfx::Persist(BS_OutputPersistenceBlock & Writer)
// -----------------------------------------------------------------------------
-bool BS_OpenGLGfx::Unpersist(BS_InputPersistenceBlock & Reader)
-{
+bool BS_OpenGLGfx::Unpersist(BS_InputPersistenceBlock &Reader) {
bool result = true;
result &= BS_GraphicEngine::Unpersist(Reader);
diff --git a/engines/sword25/gfx/opengl/openglgfx.h b/engines/sword25/gfx/opengl/openglgfx.h
index df0d81cb04..5a7ca8a85e 100644
--- a/engines/sword25/gfx/opengl/openglgfx.h
+++ b/engines/sword25/gfx/opengl/openglgfx.h
@@ -23,7 +23,7 @@
*
*/
-/*
+/*
* This code is based on Broken Sword 2.5 engine
*
* Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
@@ -67,58 +67,56 @@ class BS_RenderObjectManager;
// CLASS DECLARATION
// -----------------------------------------------------------------------------
-class BS_OpenGLGfx : public BS_GraphicEngine
-{
+class BS_OpenGLGfx : public BS_GraphicEngine {
public:
- BS_OpenGLGfx(BS_Kernel* pKernel);
+ BS_OpenGLGfx(BS_Kernel *pKernel);
virtual ~BS_OpenGLGfx();
// Interface
// ---------
- virtual bool Init(int Width, int Height, int BitDepth, int BackbufferCount, bool Windowed);
- virtual bool StartFrame(bool UpdateAll);
- virtual bool EndFrame();
+ virtual bool Init(int Width, int Height, int BitDepth, int BackbufferCount, bool Windowed);
+ virtual bool StartFrame(bool UpdateAll);
+ virtual bool EndFrame();
virtual BS_RenderObjectPtr<BS_Panel> GetMainPanel();
- virtual void SetVsync(bool Vsync);
- virtual bool GetVsync() const;
+ virtual void SetVsync(bool Vsync);
+ virtual bool GetVsync() const;
- virtual bool Fill(const BS_Rect* FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0));
- virtual bool GetScreenshot(unsigned int & Width, unsigned int & Height, Common::Array<unsigned int> & Data);
+ virtual bool Fill(const BS_Rect *FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0));
+ virtual bool GetScreenshot(unsigned int &Width, unsigned int &Height, Common::Array<unsigned int> & Data);
// Resource-Managing Methoden
// --------------------------
- virtual BS_Resource* LoadResource(const Common::String& FileName);
- virtual bool CanLoadResource(const Common::String& FileName);
+ virtual BS_Resource *LoadResource(const Common::String &FileName);
+ virtual bool CanLoadResource(const Common::String &FileName);
// Debugging Methoden
// ------------------
- virtual void DrawDebugLine(const BS_Vertex & Start, const BS_Vertex & End, unsigned int Color);
- static const char * GetGLSResultString(GLS_Result Result);
+ virtual void DrawDebugLine(const BS_Vertex &Start, const BS_Vertex &End, unsigned int Color);
+ static const char *GetGLSResultString(GLS_Result Result);
// Persistenz Methoden
// -------------------
- virtual bool Persist(BS_OutputPersistenceBlock & Writer);
- virtual bool Unpersist(BS_InputPersistenceBlock & Reader);
+ virtual bool Persist(BS_OutputPersistenceBlock &Writer);
+ virtual bool Unpersist(BS_InputPersistenceBlock &Reader);
private:
- bool m_GLspritesInitialized;
+ bool m_GLspritesInitialized;
BS_RenderObjectPtr<BS_Panel> m_MainPanelPtr;
- std::auto_ptr<BS_RenderObjectManager> m_RenderObjectManagerPtr;
+ std::auto_ptr<BS_RenderObjectManager> m_RenderObjectManagerPtr;
- struct DebugLine
- {
- DebugLine(const BS_Vertex & _Start, const BS_Vertex & _End, unsigned int _Color) :
+ struct DebugLine {
+ DebugLine(const BS_Vertex &_Start, const BS_Vertex &_End, unsigned int _Color) :
Start(_Start),
End(_End),
Color(_Color) {};
-
- BS_Vertex Start;
- BS_Vertex End;
- unsigned int Color;
+
+ BS_Vertex Start;
+ BS_Vertex End;
+ unsigned int Color;
};
Common::Array<DebugLine> m_DebugLines;
diff --git a/engines/sword25/gfx/opengl/swimage.cpp b/engines/sword25/gfx/opengl/swimage.cpp
index 1429572767..5eebf44b10 100644
--- a/engines/sword25/gfx/opengl/swimage.cpp
+++ b/engines/sword25/gfx/opengl/swimage.cpp
@@ -23,7 +23,7 @@
*
*/
-/*
+/*
* This code is based on Broken Sword 2.5 engine
*
* Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
@@ -50,21 +50,19 @@ namespace Sword25 {
// CONSTRUCTION / DESTRUCTION
// -----------------------------------------------------------------------------
-BS_SWImage::BS_SWImage(const Common::String & Filename, bool & Result) :
+BS_SWImage::BS_SWImage(const Common::String &Filename, bool &Result) :
_ImageDataPtr(0),
m_Width(0),
- m_Height(0)
-{
+ m_Height(0) {
Result = false;
- BS_PackageManager * pPackage = static_cast<BS_PackageManager*>(BS_Kernel::GetInstance()->GetService("package"));
+ BS_PackageManager *pPackage = static_cast<BS_PackageManager *>(BS_Kernel::GetInstance()->GetService("package"));
BS_ASSERT(pPackage);
// Datei laden
- char* pFileData;
+ char *pFileData;
unsigned int FileSize;
- if (!(pFileData = (char*) pPackage->GetFile(Filename, &FileSize)))
- {
+ if (!(pFileData = (char *) pPackage->GetFile(Filename, &FileSize))) {
BS_LOG_ERRORLN("File \"%s\" could not be loaded.", Filename.c_str());
return;
}
@@ -72,16 +70,14 @@ BS_SWImage::BS_SWImage(const Common::String & Filename, bool & Result) :
// Bildeigenschaften bestimmen
BS_GraphicEngine::COLOR_FORMATS ColorFormat;
int Pitch;
- if (!BS_ImageLoader::ExtractImageProperties(pFileData, FileSize, ColorFormat, m_Width, m_Height))
- {
+ if (!BS_ImageLoader::ExtractImageProperties(pFileData, FileSize, ColorFormat, m_Width, m_Height)) {
BS_LOG_ERRORLN("Could not read image properties.");
return;
}
// Das Bild dekomprimieren
- char * pUncompressedData;
- if (!BS_ImageLoader::LoadImage(pFileData, FileSize, BS_GraphicEngine::CF_ABGR32, pUncompressedData, m_Width, m_Height, Pitch))
- {
+ char *pUncompressedData;
+ if (!BS_ImageLoader::LoadImage(pFileData, FileSize, BS_GraphicEngine::CF_ABGR32, pUncompressedData, m_Width, m_Height, Pitch)) {
BS_LOG_ERRORLN("Could not decode image.");
return;
}
@@ -97,8 +93,7 @@ BS_SWImage::BS_SWImage(const Common::String & Filename, bool & Result) :
// -----------------------------------------------------------------------------
-BS_SWImage::~BS_SWImage()
-{
+BS_SWImage::~BS_SWImage() {
delete [] _ImageDataPtr;
}
@@ -106,35 +101,31 @@ BS_SWImage::~BS_SWImage()
// -----------------------------------------------------------------------------
bool BS_SWImage::Blit(int PosX, int PosY,
- int Flipping,
- BS_Rect* pPartRect,
- unsigned int Color,
- int Width, int Height)
-{
+ int Flipping,
+ BS_Rect *pPartRect,
+ unsigned int Color,
+ int Width, int Height) {
BS_LOG_ERRORLN("Blit() is not supported.");
return false;
}
// -----------------------------------------------------------------------------
-bool BS_SWImage::Fill(const BS_Rect* pFillRect, unsigned int Color)
-{
+bool BS_SWImage::Fill(const BS_Rect *pFillRect, unsigned int Color) {
BS_LOG_ERRORLN("Fill() is not supported.");
return false;
}
// -----------------------------------------------------------------------------
-bool BS_SWImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride)
-{
+bool BS_SWImage::SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride) {
BS_LOG_ERRORLN("SetContent() is not supported.");
return false;
}
// -----------------------------------------------------------------------------
-unsigned int BS_SWImage::GetPixel(int X, int Y)
-{
+unsigned int BS_SWImage::GetPixel(int X, int Y) {
BS_ASSERT(X >= 0 && X < m_Width);
BS_ASSERT(Y >= 0 && Y < m_Height);
diff --git a/engines/sword25/gfx/opengl/swimage.h b/engines/sword25/gfx/opengl/swimage.h
index bbab7c3833..870cbeb830 100644
--- a/engines/sword25/gfx/opengl/swimage.h
+++ b/engines/sword25/gfx/opengl/swimage.h
@@ -23,7 +23,7 @@
*
*/
-/*
+/*
* This code is based on Broken Sword 2.5 engine
*
* Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
@@ -50,36 +50,55 @@ namespace Sword25 {
// CLASS DEFINITION
// -----------------------------------------------------------------------------
-class BS_SWImage : public BS_Image
-{
+class BS_SWImage : public BS_Image {
public:
- BS_SWImage(const Common::String & Filename, bool & Result);
+ BS_SWImage(const Common::String &Filename, bool &Result);
virtual ~BS_SWImage();
- virtual int GetWidth() const { return m_Width; }
- virtual int GetHeight() const { return m_Height; }
- virtual BS_GraphicEngine::COLOR_FORMATS GetColorFormat() const { return BS_GraphicEngine::CF_ARGB32; }
-
- virtual bool Blit(int PosX = 0, int PosY = 0,
- int Flipping = BS_Image::FLIP_NONE,
- BS_Rect* pPartRect = NULL,
- unsigned int Color = BS_ARGB(255, 255, 255, 255),
- int Width = -1, int Height = -1);
- virtual bool Fill(const BS_Rect* FillRectPtr, unsigned int Color);
+ virtual int GetWidth() const {
+ return m_Width;
+ }
+ virtual int GetHeight() const {
+ return m_Height;
+ }
+ virtual BS_GraphicEngine::COLOR_FORMATS GetColorFormat() const {
+ return BS_GraphicEngine::CF_ARGB32;
+ }
+
+ virtual bool Blit(int PosX = 0, int PosY = 0,
+ int Flipping = BS_Image::FLIP_NONE,
+ BS_Rect *pPartRect = NULL,
+ unsigned int Color = BS_ARGB(255, 255, 255, 255),
+ int Width = -1, int Height = -1);
+ virtual bool Fill(const BS_Rect *FillRectPtr, unsigned int Color);
virtual bool SetContent(const byte *Pixeldata, unsigned int Offset, unsigned int Stride);
virtual unsigned int GetPixel(int X, int Y);
- virtual bool IsBlitSource() const { return false; }
- virtual bool IsBlitTarget() const { return false; }
- virtual bool IsScalingAllowed() const { return false; }
- virtual bool IsFillingAllowed() const { return false; }
- virtual bool IsAlphaAllowed() const { return false; }
- virtual bool IsColorModulationAllowed() const { return false; }
- virtual bool IsSetContentAllowed() const { return false; }
+ virtual bool IsBlitSource() const {
+ return false;
+ }
+ virtual bool IsBlitTarget() const {
+ return false;
+ }
+ virtual bool IsScalingAllowed() const {
+ return false;
+ }
+ virtual bool IsFillingAllowed() const {
+ return false;
+ }
+ virtual bool IsAlphaAllowed() const {
+ return false;
+ }
+ virtual bool IsColorModulationAllowed() const {
+ return false;
+ }
+ virtual bool IsSetContentAllowed() const {
+ return false;
+ }
private:
- unsigned int * _ImageDataPtr;
+ unsigned int *_ImageDataPtr;
- int m_Width;
+ int m_Width;
int m_Height;
};