From 4cf1d67140fbcf290a8ad1100ede7717a43e0863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Einar=20Johan=20Tr=C3=B8an=20S=C3=B8m=C3=A5en?= Date: Fri, 11 May 2012 00:12:28 +0200 Subject: [PATCH] WINTERMUTE: Remove a few SDL-includes. --- engines/wintermute/BFontTT.cpp | 20 ++++++++++++-------- engines/wintermute/BFontTT.h | 7 ++++--- engines/wintermute/BObject.h | 1 - engines/wintermute/BRenderSDL.cpp | 15 ++++++++------- engines/wintermute/BRenderSDL.h | 1 - engines/wintermute/BSurfaceSDL.cpp | 17 ++++++++++++----- engines/wintermute/BSurfaceSDL.h | 11 +++++------ engines/wintermute/FontGlyphCache.cpp | 3 +++ engines/wintermute/FontGlyphCache.h | 9 +++++---- 9 files changed, 49 insertions(+), 35 deletions(-) diff --git a/engines/wintermute/BFontTT.cpp b/engines/wintermute/BFontTT.cpp index 5e4370d69f85..8019429329c5 100644 --- a/engines/wintermute/BFontTT.cpp +++ b/engines/wintermute/BFontTT.cpp @@ -238,7 +238,8 @@ CBSurface *CBFontTT::RenderTextToTexture(const WideString &text, int width, TTex TextLineList::iterator it; - + warning("CBFontTT::RenderTextToTexture - Not ported yet"); +#if 0 //TODO int textHeight = lines.size() * (_maxCharHeight + _ascender); SDL_Surface *surface = SDL_CreateRGBSurface(0, width, textHeight, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); @@ -328,21 +329,24 @@ CBSurface *CBFontTT::RenderTextToTexture(const WideString &text, int width, TTex delete wmeSurface; return NULL; } +#endif + return NULL; } ////////////////////////////////////////////////////////////////////////// -void CBFontTT::BlitSurface(SDL_Surface *src, SDL_Surface *target, SDL_Rect *targetRect) { +void CBFontTT::BlitSurface(Graphics::Surface *src, Graphics::Surface *target, Common::Rect *targetRect) { //SDL_BlitSurface(src, NULL, target, targetRect); - + warning("CBFontTT::BlitSurface - not ported yet"); +#if 0 for (int y = 0; y < src->h; y++) { if (targetRect->y + y < 0 || targetRect->y + y >= target->h) continue; - Uint8 *srcBuf = (Uint8 *)src->pixels + y * src->pitch; - Uint8 *tgtBuf = (Uint8 *)target->pixels + (y + targetRect->y) * target->pitch; + uint8 *srcBuf = (uint8 *)src->pixels + y * src->pitch; + uint8 *tgtBuf = (uint8 *)target->pixels + (y + targetRect->y) * target->pitch; - Uint32 *srcBuf32 = (Uint32 *)srcBuf; - Uint32 *tgtBuf32 = (Uint32 *)tgtBuf; + uint32 *srcBuf32 = (uint32 *)srcBuf; + uint32 *tgtBuf32 = (uint32 *)tgtBuf; for (int x = 0; x < src->w; x++) { if (targetRect->x + x < 0 || targetRect->x + x >= target->w) continue; @@ -350,7 +354,7 @@ void CBFontTT::BlitSurface(SDL_Surface *src, SDL_Surface *target, SDL_Rect *targ tgtBuf32[x + targetRect->x] = srcBuf32[x]; } } - +#endif } ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/BFontTT.h b/engines/wintermute/BFontTT.h index 9dc3de192023..812fc61b2e5d 100644 --- a/engines/wintermute/BFontTT.h +++ b/engines/wintermute/BFontTT.h @@ -32,10 +32,11 @@ #include "BFontStorage.h" #include "BFont.h" #include "BSurface.h" +#include "common/rect.h" +#include "graphics/surface.h" #define NUM_CACHED_TEXTS 30 -class SDL_Surface; -class SDL_Rect; + namespace WinterMute { class FontGlyphCache; @@ -150,7 +151,7 @@ class CBFontTT : public CBFont { void CacheGlyph(wchar_t ch); CBSurface *RenderTextToTexture(const WideString &text, int width, TTextAlign align, int maxHeight, int &textOffset); - void BlitSurface(SDL_Surface *src, SDL_Surface *target, SDL_Rect *targetRect); + void BlitSurface(Graphics::Surface *src, Graphics::Surface *target, Common::Rect *targetRect); CBCachedTTFontText *_cachedTexts[NUM_CACHED_TEXTS]; diff --git a/engines/wintermute/BObject.h b/engines/wintermute/BObject.h index 43fe719ae262..835d5fe34ae1 100644 --- a/engines/wintermute/BObject.h +++ b/engines/wintermute/BObject.h @@ -30,7 +30,6 @@ #define WINTERMUTE_BOBJECT_H -//#include "SDL.h" #include "BScriptHolder.h" #include "persistent.h" diff --git a/engines/wintermute/BRenderSDL.cpp b/engines/wintermute/BRenderSDL.cpp index a8e18c74d22b..613995124f81 100644 --- a/engines/wintermute/BRenderSDL.cpp +++ b/engines/wintermute/BRenderSDL.cpp @@ -36,7 +36,6 @@ #include "engines/wintermute/BGame.h" #include "engines/wintermute/BSprite.h" #include "common/system.h" -#include "SDL.h" namespace WinterMute { @@ -147,7 +146,8 @@ HRESULT CBRenderSDL::InitRenderer(int width, int height, bool windowed) { if (!_win) return E_FAIL; #endif - SDL_ShowCursor(SDL_DISABLE); + warning("TODO: Hide cursor"); + //SDL_ShowCursor(SDL_DISABLE); #ifdef __IPHONEOS__ // SDL defaults to OGL ES2, which doesn't work on old devices @@ -366,11 +366,12 @@ const char *CBRenderSDL::GetName() { ////////////////////////////////////////////////////////////////////////// HRESULT CBRenderSDL::SetViewport(int left, int top, int right, int bottom) { - SDL_Rect rect; - rect.x = left + _borderLeft; - rect.y = top + _borderTop; - rect.w = (right - left) * _ratioX; - rect.h = (bottom - top) * _ratioY; + Common::Rect rect; + // TODO: Hopefully this is the same logic that ScummVM uses. + rect.left = left + _borderLeft; + rect.top = top + _borderTop; + rect.right = (right - left) * _ratioX; + rect.bottom = (bottom - top) * _ratioY; // TODO fix this once viewports work correctly in SDL/landscape #ifndef __IPHONEOS__ diff --git a/engines/wintermute/BRenderSDL.h b/engines/wintermute/BRenderSDL.h index 73d3bbac29d9..2d55a3c0038a 100644 --- a/engines/wintermute/BRenderSDL.h +++ b/engines/wintermute/BRenderSDL.h @@ -30,7 +30,6 @@ #define WINTERMUTE_BRENDERER_SDL_H #include "BRenderer.h" -/*#include "SDL.h"*/ #include "common/rect.h" #include "graphics/surface.h" diff --git a/engines/wintermute/BSurfaceSDL.cpp b/engines/wintermute/BSurfaceSDL.cpp index b976585b0b94..0f30101780b3 100644 --- a/engines/wintermute/BSurfaceSDL.cpp +++ b/engines/wintermute/BSurfaceSDL.cpp @@ -181,7 +181,10 @@ HRESULT CBSurfaceSDL::Create(char *Filename, bool default_ck, byte ck_red, byte } ////////////////////////////////////////////////////////////////////////// -void CBSurfaceSDL::GenAlphaMask(SDL_Surface *surface) { +void CBSurfaceSDL::GenAlphaMask(Graphics::Surface *surface) { + warning("CBSurfaceSDL::GenAlphaMask - Not ported yet"); + return; +#if 0 delete[] _alphaMask; _alphaMask = NULL; if (!surface) return; @@ -220,13 +223,16 @@ void CBSurfaceSDL::GenAlphaMask(SDL_Surface *surface) { delete[] _alphaMask; _alphaMask = NULL; } +#endif } ////////////////////////////////////////////////////////////////////////// -Uint32 CBSurfaceSDL::GetPixel(SDL_Surface *surface, int x, int y) { +uint32 CBSurfaceSDL::GetPixel(Graphics::Surface *surface, int x, int y) { + warning("CBSurfaceSDL::GetPixel - Not ported yet"); +#if 0 int bpp = surface->format->BytesPerPixel; /* Here p is the address to the pixel we want to retrieve */ - Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; + uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; switch (bpp) { case 1: @@ -251,6 +257,7 @@ Uint32 CBSurfaceSDL::GetPixel(SDL_Surface *surface, int x, int y) { default: return 0; /* shouldn't happen, but avoids warnings */ } +#endif } ////////////////////////////////////////////////////////////////////////// @@ -271,7 +278,7 @@ HRESULT CBSurfaceSDL::Create(int Width, int Height) { } ////////////////////////////////////////////////////////////////////////// -HRESULT CBSurfaceSDL::CreateFromSDLSurface(SDL_Surface *surface) { +HRESULT CBSurfaceSDL::CreateFromSDLSurface(Graphics::Surface *surface) { warning("CBSurfaceSDL::CreateFromSDLSurface not ported yet"); //TODO #if 0 CBRenderSDL *renderer = static_cast(Game->_renderer); @@ -314,7 +321,7 @@ bool CBSurfaceSDL::IsTransparentAt(int X, int Y) { bool CBSurfaceSDL::IsTransparentAtLite(int X, int Y) { //if (!_lockPixels) return false; - Uint32 format; + uint32 format; int access; int width, height; // This particular warning is rather messy, as this function is called a ton, diff --git a/engines/wintermute/BSurfaceSDL.h b/engines/wintermute/BSurfaceSDL.h index 9053af3d7dbf..792dd01e6df1 100644 --- a/engines/wintermute/BSurfaceSDL.h +++ b/engines/wintermute/BSurfaceSDL.h @@ -31,9 +31,8 @@ #include "graphics/surface.h" #include "BSurface.h" -#include "SDL.h" // TODO, remove -class SDL_Texture; -class SDL_Surface; +#include "graphics/surface.h" + namespace WinterMute { class CBSurfaceSDL : public CBSurface { @@ -44,7 +43,7 @@ class CBSurfaceSDL : public CBSurface { HRESULT Create(char *Filename, bool default_ck, byte ck_red, byte ck_green, byte ck_blue, int LifeTime = -1, bool KeepLoaded = false); HRESULT Create(int Width, int Height); - HRESULT CreateFromSDLSurface(SDL_Surface *surface); + HRESULT CreateFromSDLSurface(Graphics::Surface *surface); //TODO: Rename function bool IsTransparentAt(int X, int Y); bool IsTransparentAtLite(int X, int Y); @@ -69,8 +68,8 @@ class CBSurfaceSDL : public CBSurface { Graphics::Surface *_surface; HRESULT DrawSprite(int X, int Y, RECT *Rect, float ZoomX, float ZoomY, uint32 Alpha, bool AlphaDisable, TSpriteBlendMode BlendMode, bool MirrorX, bool MirrorY, int offsetX = 0, int offsetY = 0); - void GenAlphaMask(SDL_Surface *surface); - uint32 GetPixel(SDL_Surface *surface, int x, int y); + void GenAlphaMask(Graphics::Surface *surface); + uint32 GetPixel(Graphics::Surface *surface, int x, int y); void *_lockPixels; int _lockPitch; diff --git a/engines/wintermute/FontGlyphCache.cpp b/engines/wintermute/FontGlyphCache.cpp index d161c749cf72..81ecd49c86ae 100644 --- a/engines/wintermute/FontGlyphCache.cpp +++ b/engines/wintermute/FontGlyphCache.cpp @@ -71,6 +71,8 @@ void FontGlyphCache::AddGlyph(wchar_t ch, int glyphIndex, FT_GlyphSlot glyphSlot ////////////////////////////////////////////////////////////////////////// void GlyphInfo::SetGlyphImage(size_t width, size_t height, size_t stride, byte *pixels) { + warning("GlyphInfo::SetGlyphImage - Not ported yet"); +#if 0 if (_image) SDL_FreeSurface(_image); _image = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); @@ -91,6 +93,7 @@ void GlyphInfo::SetGlyphImage(size_t width, size_t height, size_t stride, byte * } SDL_UnlockSurface(_image); +#endif } } // end of namespace WinterMute diff --git a/engines/wintermute/FontGlyphCache.h b/engines/wintermute/FontGlyphCache.h index 6800ec996bd8..7fac01e40cd0 100644 --- a/engines/wintermute/FontGlyphCache.h +++ b/engines/wintermute/FontGlyphCache.h @@ -27,8 +27,8 @@ THE SOFTWARE. #define __WmeFontGlyphCache_H__ -#include "SDL.h" #include "BFontStorage.h" +#include "graphics/surface.h" namespace WinterMute { @@ -46,7 +46,8 @@ class GlyphInfo { } ~GlyphInfo() { - if (_image) SDL_FreeSurface(_image); + // TODO + //if (_image) SDL_FreeSurface(_image); } void SetGlyphInfo(float AdvanceX, float AdvanceY, int BearingX, int BearingY) { @@ -79,7 +80,7 @@ class GlyphInfo { int GetBearingY() { return _bearingY; } - SDL_Surface *GetImage() { + Graphics::Surface *GetImage() { return _image; } @@ -94,7 +95,7 @@ class GlyphInfo { int _width; int _height; - SDL_Surface *_image; + Graphics::Surface *_image; };