aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx/opengl/glimage.cpp
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/glimage.cpp
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/glimage.cpp')
-rw-r--r--engines/sword25/gfx/opengl/glimage.cpp85
1 files changed, 35 insertions, 50 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;