[Scummvm-cvs-logs] SF.net SVN: scummvm:[53227] scummvm/trunk/engines/sword25/gfx
sev at users.sourceforge.net
sev at users.sourceforge.net
Wed Oct 13 00:39:23 CEST 2010
Revision: 53227
http://scummvm.svn.sourceforge.net/scummvm/?rev=53227&view=rev
Author: sev
Date: 2010-10-12 22:39:23 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
SWORD25: Started rewriting gfx subsystem
Modified Paths:
--------------
scummvm/trunk/engines/sword25/gfx/image/b25sloader.cpp
scummvm/trunk/engines/sword25/gfx/image/b25sloader.h
scummvm/trunk/engines/sword25/gfx/image/imageloader.cpp
scummvm/trunk/engines/sword25/gfx/image/imageloader.h
scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp
scummvm/trunk/engines/sword25/gfx/image/pngloader.h
scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp
scummvm/trunk/engines/sword25/gfx/opengl/glimage.h
scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp
Modified: scummvm/trunk/engines/sword25/gfx/image/b25sloader.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/b25sloader.cpp 2010-10-12 22:38:49 UTC (rev 53226)
+++ scummvm/trunk/engines/sword25/gfx/image/b25sloader.cpp 2010-10-12 22:39:23 UTC (rev 53227)
@@ -85,7 +85,7 @@
// -----------------------------------------------------------------------------
-bool BS_B25SLoader::DecodeImage(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS ColorFormat, char * & UncompressedDataPtr,
+bool BS_B25SLoader::DecodeImage(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
int &Width, int &Height, int &Pitch) {
// PNG innerhalb des Spielstandes finden und den Methodenaufruf zu BS_PNGLoader weiterreichen.
unsigned int PNGOffset = FindEmbeddedPNG(FileDataPtr, FileSize);
Modified: scummvm/trunk/engines/sword25/gfx/image/b25sloader.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/b25sloader.h 2010-10-12 22:38:49 UTC (rev 53226)
+++ scummvm/trunk/engines/sword25/gfx/image/b25sloader.h 2010-10-12 22:39:23 UTC (rev 53227)
@@ -58,7 +58,7 @@
protected:
virtual bool IsCorrectImageFormat(const char *FileDataPtr, unsigned int FileSize);
- virtual bool DecodeImage(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS ColorFormat, char * & UncompressedDataPtr,
+ virtual bool DecodeImage(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
int &Width, int &Height, int &Pitch);
virtual bool ImageProperties(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height);
Modified: scummvm/trunk/engines/sword25/gfx/image/imageloader.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/imageloader.cpp 2010-10-12 22:38:49 UTC (rev 53226)
+++ scummvm/trunk/engines/sword25/gfx/image/imageloader.cpp 2010-10-12 22:39:23 UTC (rev 53227)
@@ -48,7 +48,7 @@
bool BS_ImageLoader::LoadImage(const char *pFileData, unsigned int FileSize,
BS_GraphicEngine::COLOR_FORMATS ColorFormat,
- char*& pUncompressedData,
+ byte *&pUncompressedData,
int &Width, int &Height,
int &Pitch) {
// Falls die Liste der BS_ImageLoader noch nicht initialisiert wurde, wird dies getan.
Modified: scummvm/trunk/engines/sword25/gfx/image/imageloader.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/imageloader.h 2010-10-12 22:38:49 UTC (rev 53226)
+++ scummvm/trunk/engines/sword25/gfx/image/imageloader.h 2010-10-12 22:39:23 UTC (rev 53227)
@@ -106,7 +106,7 @@
*/
static bool LoadImage(const char *pFileData, unsigned int FileSize,
BS_GraphicEngine::COLOR_FORMATS ColorFormat,
- char*& pUncompressedData,
+ byte *&pUncompressedData,
int &Width, int &Height,
int &Pitch);
@@ -175,7 +175,7 @@
*/
virtual bool DecodeImage(const char *pFileData, unsigned int FileSize,
BS_GraphicEngine::COLOR_FORMATS ColorFormat,
- char*& pUncompressedData,
+ byte *&pUncompressedData,
int &Width, int &Height,
int &Pitch) = 0;
Modified: scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp 2010-10-12 22:38:49 UTC (rev 53226)
+++ scummvm/trunk/engines/sword25/gfx/image/pngloader.cpp 2010-10-12 22:39:23 UTC (rev 53227)
@@ -62,7 +62,7 @@
// -----------------------------------------------------------------------------
-bool BS_PNGLoader::DoDecodeImage(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS ColorFormat, char * & UncompressedDataPtr,
+bool BS_PNGLoader::DoDecodeImage(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
int &Width, int &Height, int &Pitch) {
png_structp png_ptr = NULL;
png_infop info_ptr = NULL;
@@ -115,7 +115,7 @@
// Speicher f\xFCr die endg\xFCltigen Bilddaten reservieren
// Dieses geschieht vor dem reservieren von Speicher f\xFCr tempor\xE4re Bilddaten um die Fragmentierung des Speichers gering zu halten
- UncompressedDataPtr = new char[Pitch * Height];
+ UncompressedDataPtr = new byte[Pitch * Height];
if (!UncompressedDataPtr) {
error("Could not allocate memory for output image.");
}
@@ -256,7 +256,7 @@
// -----------------------------------------------------------------------------
-bool BS_PNGLoader::DecodeImage(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS ColorFormat, char * & UncompressedDataPtr,
+bool BS_PNGLoader::DecodeImage(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
int &Width, int &Height, int &Pitch) {
return DoDecodeImage(FileDataPtr, FileSize, ColorFormat, UncompressedDataPtr, Width, Height, Pitch);
}
Modified: scummvm/trunk/engines/sword25/gfx/image/pngloader.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/pngloader.h 2010-10-12 22:38:49 UTC (rev 53226)
+++ scummvm/trunk/engines/sword25/gfx/image/pngloader.h 2010-10-12 22:39:23 UTC (rev 53227)
@@ -61,7 +61,7 @@
// Alle virtuellen Methoden von BS_ImageLoader sind hier als static-Methode implementiert, damit sie von BS_B25SLoader aufgerufen werden k\xF6nnen.
// Die virtuellen Methoden rufen diese Methoden auf.
static bool DoIsCorrectImageFormat(const char *FileDataPtr, unsigned int FileSize);
- static bool DoDecodeImage(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS ColorFormat, char * & UncompressedDataPtr,
+ static bool DoDecodeImage(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS ColorFormat, byte *&UncompressedDataPtr,
int &Width, int &Height, int &Pitch);
static bool DoImageProperties(const char *FileDataPtr, unsigned int FileSize, BS_GraphicEngine::COLOR_FORMATS &ColorFormat, int &Width, int &Height);
@@ -69,7 +69,7 @@
BS_PNGLoader();
bool DecodeImage(const char *pFileData, unsigned int FileSize,
BS_GraphicEngine::COLOR_FORMATS ColorFormat,
- char * & pUncompressedData,
+ byte *&pUncompressedData,
int &Width, int &Height,
int &Pitch);
bool IsCorrectImageFormat(const char *FileDataPtr, unsigned int FileSize);
Modified: scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp 2010-10-12 22:38:49 UTC (rev 53226)
+++ scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp 2010-10-12 22:39:23 UTC (rev 53227)
@@ -75,8 +75,7 @@
}
// Das Bild dekomprimieren
- char *pUncompressedData;
- if (!BS_ImageLoader::LoadImage(pFileData, FileSize, BS_GraphicEngine::CF_ABGR32, pUncompressedData, m_Width, m_Height, Pitch)) {
+ if (!BS_ImageLoader::LoadImage(pFileData, FileSize, BS_GraphicEngine::CF_ABGR32, _data, m_Width, m_Height, Pitch)) {
BS_LOG_ERRORLN("Could not decode image.");
return;
}
@@ -84,19 +83,6 @@
// Dateidaten freigeben
delete[] pFileData;
- // 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) {
- BS_LOG_ERRORLN("Could not create GLS_Sprite. Reason: %s", GLS_ResultString(GLSResult));
- return;
- }
-
- // Bilddaten freigeben
- delete[] pUncompressedData;
-
Result = true;
return;
}
@@ -104,20 +90,11 @@
// -----------------------------------------------------------------------------
BS_GLImage::BS_GLImage(unsigned int Width, unsigned int Height, bool &Result) :
- m_Sprite(0),
m_Width(Width),
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) {
- BS_LOG_ERRORLN("Could not create GLS_Sprite. Reason: %s", GLS_ResultString(GLSResult));
- return;
- }
+ _data = new byte[Width * Height * 4];
Result = true;
return;
@@ -126,7 +103,7 @@
// -----------------------------------------------------------------------------
BS_GLImage::~BS_GLImage() {
- if (m_Sprite) GLS_DeleteSprite(m_Sprite);
+ delete[] _data;
}
// -----------------------------------------------------------------------------
Modified: scummvm/trunk/engines/sword25/gfx/opengl/glimage.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/glimage.h 2010-10-12 22:38:49 UTC (rev 53226)
+++ scummvm/trunk/engines/sword25/gfx/opengl/glimage.h 2010-10-12 22:39:23 UTC (rev 53227)
@@ -113,7 +113,7 @@
return true;
}
private:
- GLS_Sprite m_Sprite;
+ byte *_data;
int m_Width;
int m_Height;
};
Modified: scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp 2010-10-12 22:38:49 UTC (rev 53226)
+++ scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp 2010-10-12 22:39:23 UTC (rev 53227)
@@ -32,15 +32,6 @@
*
*/
-// -----------------------------------------------------------------------------
-// INCLUDES
-// -----------------------------------------------------------------------------
-
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <GL/GL.h>
-
-#include "sword25/util/glsprites/glsprites.h"
#include "sword25/gfx/bitmapresource.h"
#include "sword25/gfx/animationresource.h"
#include "sword25/gfx/fontresource.h"
@@ -125,13 +116,7 @@
m_ScreenRect.right = m_Width;
m_ScreenRect.bottom = m_Height;
- // 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) {
- BS_LOG_ERRORLN("Could not initialize GLsprites. Reason: %s", GLS_ResultString(Result));
- return false;
- }
+ // We already iniitalized gfx after the engine creation
m_GLspritesInitialized = true;
// Standardm\xE4\xDFig ist Vsync an.
@@ -158,13 +143,6 @@
// Den Layer-Manager auf den n\xE4chsten Frame vorbereiten
m_RenderObjectManagerPtr->StartFrame();
- // GLsprites bescheidgeben
- GLS_Result Result = GLS_StartFrame();
- if (Result != GLS_OK) {
- BS_LOG_ERRORLN("Call to GLS_StartFrame() failed. Reason: %s", GLS_ResultString(Result));
- return false;
- }
-
return true;
}
@@ -174,8 +152,11 @@
// Scene zeichnen
m_RenderObjectManagerPtr->Render();
+ g_system->updateScreen();
+
// Debug-Lines zeichnen
if (!m_DebugLines.empty()) {
+#if 0
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINES);
@@ -192,17 +173,13 @@
glEnd();
glDisable(GL_LINE_SMOOTH);
+#endif
+ warning("STUB: Drawing debug lines");
+
m_DebugLines.clear();
}
- // Flippen
- GLS_Result Result = GLS_EndFrame();
- if (Result != GLS_OK) {
- BS_LOG_ERRORLN("Call to GLS_EndFrame() failed. Reason: %s", GLS_ResultString(Result));
- return false;
- }
-
// Framecounter aktualisieren
m_FPSCounter.Update();
@@ -218,21 +195,15 @@
// -----------------------------------------------------------------------------
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));
+ warning("STUB: SetVsync(%d)", Vsync);
}
// -----------------------------------------------------------------------------
bool BS_OpenGLGfx::GetVsync() const {
- GLS_Bool Status;
- GLS_Result Result = GLS_IsVsync(&Status);
- if (Result != GLS_OK) {
- BS_LOG_WARNINGLN("Could not get vsync status. Returning false. Reason: %s", GLS_ResultString(Result));
- return false;
- }
+ warning("STUB: GetVsync()");
- return Status == GLS_True ? true : false;
+ return true;
}
// -----------------------------------------------------------------------------
@@ -248,16 +219,9 @@
FillRectPtr = &Rect;
}
- glBegin(GL_QUADS);
- glColor4ub((Color >> 16) & 0xff, (Color >> 8) & 0xff, Color & 0xff, Color >> 24);
+ warning("STUB: Fill()");
- glVertex2i(FillRectPtr->left, FillRectPtr->top);
- glVertex2i(FillRectPtr->right, FillRectPtr->top);
- glVertex2i(FillRectPtr->right, FillRectPtr->bottom);
- glVertex2i(FillRectPtr->left, FillRectPtr->bottom);
- glEnd();
-
- return glGetError() == 0;
+ return true;
}
// -----------------------------------------------------------------------------
@@ -281,13 +245,8 @@
bool BS_OpenGLGfx::ReadFramebufferContents(unsigned int Width, unsigned int Height, byte **Data) {
*Data = (byte *)malloc(Width * Height * 4);
- glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, *Data);
-
- if (glGetError() == 0)
- return true;
- else {
- return false;
- }
+
+ return true;
}
// -----------------------------------------------------------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list