WINTERMUTE: Remove a few SDL-includes.

This commit is contained in:
Einar Johan Trøan Sømåen
2012-06-02 12:42:10 +02:00
committed by Einar Johan Trøan Sømåen
parent 2e12f9fe4d
commit 4cf1d67140
9 changed files with 49 additions and 35 deletions
+12 -8
View File
@@ -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
}
//////////////////////////////////////////////////////////////////////////
+4 -3
View File
@@ -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 @@ private:
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];
-1
View File
@@ -30,7 +30,6 @@
#define WINTERMUTE_BOBJECT_H
//#include "SDL.h"
#include "BScriptHolder.h"
#include "persistent.h"
+8 -7
View File
@@ -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__
-1
View File
@@ -30,7 +30,6 @@
#define WINTERMUTE_BRENDERER_SDL_H
#include "BRenderer.h"
/*#include "SDL.h"*/
#include "common/rect.h"
#include "graphics/surface.h"
+12 -5
View File
@@ -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<CBRenderSDL *>(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,
+5 -6
View File
@@ -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 @@ public:
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 @@ private:
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;
+3
View File
@@ -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
+5 -4
View File
@@ -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 @@ public:
}
~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 @@ public:
int GetBearingY() {
return _bearingY;
}
SDL_Surface *GetImage() {
Graphics::Surface *GetImage() {
return _image;
}
@@ -94,7 +95,7 @@ private:
int _width;
int _height;
SDL_Surface *_image;
Graphics::Surface *_image;
};