Skip to content
Browse files

Create an SDLSurfaceSprite2D subclass

Sprite2D is now an abstract base class
  • Loading branch information...
1 parent d7a6a40 commit 86e3ea9bfdb708a2f9ed0fd91e1424804e7f27ac @bradallred bradallred committed Jun 16, 2013
View
18 apple/GemRB.xcodeproj/project.pbxproj
@@ -666,6 +666,8 @@
A2E9967A14DE05590052BABE /* SAVImporter.so in CopyFiles */ = {isa = PBXBuildFile; fileRef = A2F0505113ABB80B0023B7EB /* SAVImporter.so */; };
A2EC2F90176BD28E00FD960E /* BAMSprite2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2EC2F8E176BD28E00FD960E /* BAMSprite2D.cpp */; };
A2EC2F91176BD28E00FD960E /* BAMSprite2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2EC2F8E176BD28E00FD960E /* BAMSprite2D.cpp */; };
+ A2EC2F94176BD44C00FD960E /* SDLSurfaceSprite2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2EC2F92176BD44C00FD960E /* SDLSurfaceSprite2D.cpp */; };
+ A2EC2F95176BD44D00FD960E /* SDLSurfaceSprite2D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A2EC2F92176BD44C00FD960E /* SDLSurfaceSprite2D.cpp */; };
A2EC8059145F9E6E0033754A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2EC8058145F9E6E0033754A /* Foundation.framework */; };
A2EC805B1460556B0033754A /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2EC805A1460556B0033754A /* OpenAL.framework */; };
A2EC805D1460559C0033754A /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A2EC805C1460559C0033754A /* CoreAudio.framework */; };
@@ -1665,6 +1667,8 @@
A2E6646F139E8DFA00310FC8 /* libgemrb_core.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libgemrb_core.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
A2EC2F8E176BD28E00FD960E /* BAMSprite2D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BAMSprite2D.cpp; sourceTree = "<group>"; };
A2EC2F8F176BD28E00FD960E /* BAMSprite2D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BAMSprite2D.h; sourceTree = "<group>"; };
+ A2EC2F92176BD44C00FD960E /* SDLSurfaceSprite2D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SDLSurfaceSprite2D.cpp; sourceTree = "<group>"; };
+ A2EC2F93176BD44C00FD960E /* SDLSurfaceSprite2D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLSurfaceSprite2D.h; sourceTree = "<group>"; };
A2EC8058145F9E6E0033754A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
A2EC805A1460556B0033754A /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/OpenAL.framework; sourceTree = DEVELOPER_DIR; };
A2EC805C1460559C0033754A /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/CoreAudio.framework; sourceTree = DEVELOPER_DIR; };
@@ -2647,15 +2651,17 @@
A27B8757139F0A7D0002DC13 /* SDLVideo */ = {
isa = PBXGroup;
children = (
- A2DB6D5715D9ECB300D70E88 /* SpriteRenderer.inl */,
- A2DB6D5815D9ECB300D70E88 /* TileRenderer.inl */,
- A298DD1714EB4EEB00F59F56 /* SDL20Video.cpp */,
- A298DD1814EB4EEB00F59F56 /* SDL20Video.h */,
+ A249187B141075A60038B170 /* CocoaWrapper.m */,
A298DD1314EB4EDE00F59F56 /* SDL12Video.cpp */,
A298DD1414EB4EDE00F59F56 /* SDL12Video.h */,
- A249187B141075A60038B170 /* CocoaWrapper.m */,
+ A298DD1714EB4EEB00F59F56 /* SDL20Video.cpp */,
+ A298DD1814EB4EEB00F59F56 /* SDL20Video.h */,
+ A2EC2F92176BD44C00FD960E /* SDLSurfaceSprite2D.cpp */,
+ A2EC2F93176BD44C00FD960E /* SDLSurfaceSprite2D.h */,
A27B875A139F0A7D0002DC13 /* SDLVideo.cpp */,
A27B875B139F0A7D0002DC13 /* SDLVideo.h */,
+ A2DB6D5715D9ECB300D70E88 /* SpriteRenderer.inl */,
+ A2DB6D5815D9ECB300D70E88 /* TileRenderer.inl */,
);
path = SDLVideo;
sourceTree = "<group>";
@@ -4603,6 +4609,7 @@
A22693791422934E004468E8 /* CocoaWrapper.m in Sources */,
A276B4EF13A28BE100D41A8A /* SDLVideo.cpp in Sources */,
A298DD1614EB4EDE00F59F56 /* SDL12Video.cpp in Sources */,
+ A2EC2F95176BD44D00FD960E /* SDLSurfaceSprite2D.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -4910,6 +4917,7 @@
A2A2EA3416A5EB630092B903 /* TTFFont.cpp in Sources */,
A2A2EA3816A5FC860092B903 /* Freetype.cpp in Sources */,
A2EC2F90176BD28E00FD960E /* BAMSprite2D.cpp in Sources */,
+ A2EC2F94176BD44C00FD960E /* SDLSurfaceSprite2D.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
11 gemrb/core/Sprite2D.cpp
@@ -55,11 +55,6 @@ Sprite2D::Sprite2D(const Sprite2D &obj)
pixels = obj.pixels;
}
-Sprite2D* Sprite2D::copy() const
-{
- return new Sprite2D(*this);
-}
-
Sprite2D::~Sprite2D()
{
}
@@ -77,12 +72,6 @@ Palette* Sprite2D::GetPalette() const
return core->GetVideoDriver()->GetPalette(vptr);
}
-void Sprite2D::SetPalette(Palette* pal)
-{
- if (!vptr) return;
- core->GetVideoDriver()->SetPalette(vptr, pal);
-}
-
Color Sprite2D::GetPixel(unsigned short x, unsigned short y) const
{
Color c = { 0, 0, 0, 0 };
View
6 gemrb/core/Sprite2D.h
@@ -62,12 +62,12 @@ class GEM_EXPORT Sprite2D {
Sprite2D(int Width, int Height, int Bpp, void* vptr, const void* pixels);
Sprite2D(const Sprite2D &obj);
- virtual Sprite2D* copy() const;
+ virtual Sprite2D* copy() const = 0;
virtual ~Sprite2D();
bool IsPixelTransparent(unsigned short x, unsigned short y) const;
- virtual Palette *GetPalette() const;
- virtual void SetPalette(Palette *pal);
+ virtual Palette *GetPalette() const = 0;
+ virtual void SetPalette(Palette *pal) = 0;
virtual Color GetPixel(unsigned short x, unsigned short y) const;
virtual ieDword GetColorKey() const;
virtual void SetColorKey(ieDword ck);
View
2 gemrb/core/Video.h
@@ -155,8 +155,6 @@ class GEM_EXPORT Video : public Plugin {
* It's generated from the momentary back buffer */
virtual Sprite2D* GetScreenshot( Region r ) = 0;
virtual void ConvertToVideoFormat(Sprite2D* sprite) = 0;
- /** Sets the palette of a plugin specific sprite */
- virtual void SetPalette(void* data, Palette* pal) = 0;
/** This function Draws the Border of a Rectangle as described by the Region parameter. The Color used to draw the rectangle is passes via the Color parameter. */
virtual void DrawRect(const Region& rgn, const Color& color, bool fill = true, bool clipped = false) = 0;
/** this function draws a clipped sprite */
View
2 gemrb/plugins/SDLVideo/CMakeLists.txt
@@ -1,4 +1,4 @@
INCLUDE_DIRECTORIES( ${SDL_INCLUDE_DIR} )
-ADD_GEMRB_PLUGIN (SDLVideo COCOA SDLVideo.cpp SDL12Video.cpp)
+ADD_GEMRB_PLUGIN (SDLVideo COCOA SDLVideo.cpp SDL12Video.cpp SDLSurfaceSprite2D.cpp)
TARGET_LINK_LIBRARIES( SDLVideo ${SDL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${COCOA_LIBRARY_PATH})
View
5 gemrb/plugins/SDLVideo/SDL12Video.cpp
@@ -326,11 +326,6 @@ void SDL12VideoDriver::HideSoftKeyboard()
// Private methods
-bool SDL12VideoDriver::SetSurfacePalette(SDL_Surface* surface, SDL_Color* colors, int ncolors)
-{
- return (bool)SDL_SetPalette( surface, SDL_LOGPAL, colors, 0, ncolors );
-}
-
bool SDL12VideoDriver::SetSurfaceAlpha(SDL_Surface* surface, unsigned short alpha)
{
return (SDL_SetAlpha( surface, SDL_SRCALPHA | SDL_RLEACCEL, alpha ) == 0);
View
1 gemrb/plugins/SDLVideo/SDL12Video.h
@@ -56,7 +56,6 @@ class SDL12VideoDriver : public SDLVideoDriver {
void HideSoftKeyboard();
void SetGamma(int brightness, int contrast);
private:
- bool SetSurfacePalette(SDL_Surface* surface, SDL_Color* colors, int ncolors);
bool SetSurfaceAlpha(SDL_Surface* surface, unsigned short alpha);
int ProcessEvent(const SDL_Event & event);
View
5 gemrb/plugins/SDLVideo/SDL20Video.cpp
@@ -769,11 +769,6 @@ bool SDL20VideoDriver::ToggleGrabInput()
// Private methods
-bool SDL20VideoDriver::SetSurfacePalette(SDL_Surface* surface, SDL_Color* colors, int ncolors)
-{
- return (SDL_SetPaletteColors((surface)->format->palette, colors, 0, ncolors) == 0);
-}
-
bool SDL20VideoDriver::SetSurfaceAlpha(SDL_Surface* surface, unsigned short alpha)
{
return (SDL_SetSurfaceAlphaMod(surface, alpha) == 0);
View
1 gemrb/plugins/SDLVideo/SDL20Video.h
@@ -79,7 +79,6 @@ class SDL20VideoDriver : public SDLVideoDriver {
void HideSoftKeyboard();
void MoveMouse(unsigned int x, unsigned int y);
private:
- bool SetSurfacePalette(SDL_Surface* surface, SDL_Color* colors, int ncolors);
bool SetSurfaceAlpha(SDL_Surface* surface, unsigned short alpha);
int ProcessEvent(const SDL_Event & event);
View
152 gemrb/plugins/SDLVideo/SDLSurfaceSprite2D.cpp
@@ -0,0 +1,152 @@
+/* GemRB - Infinity Engine Emulator
+ * Copyright (C) 2013 The GemRB Project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ */
+
+#include "SDLSurfaceSprite2D.h"
+
+#include <SDL/SDL.h>
+
+namespace GemRB {
+
+SDLSurfaceSprite2D::SDLSurfaceSprite2D(int Width, int Height, int Bpp, void* pixels)
+ : Sprite2D(Width, Height, Bpp, NULL, pixels)
+{
+ surface = SDL_CreateRGBSurfaceFrom( pixels, Width, Height, Bpp < 8 ? 8 : Bpp, Width * ( Bpp / 8 ),
+ 0, 0, 0, 0 );
+ vptr = surface;
+#if SDL_VERSION_ATLEAST(1,3,0)
+ SDL_SetSurfaceRLE(surface, SDL_TRUE);
+#endif
+}
+
+SDLSurfaceSprite2D::SDLSurfaceSprite2D (int Width, int Height, int Bpp, void* pixels,
+ Uint32 rmask, Uint32 gmask, Uint32 bmask, Uint32 amask)
+ : Sprite2D(Width, Height, Bpp, NULL, pixels)
+{
+ surface = SDL_CreateRGBSurfaceFrom( pixels, Width, Height, Bpp < 8 ? 8 : Bpp, Width * ( Bpp / 8 ),
+ rmask, gmask, bmask, amask );
+ vptr = surface;
+#if SDL_VERSION_ATLEAST(1,3,0)
+ SDL_SetSurfaceRLE(surface, SDL_TRUE);
+#endif
+}
+
+SDLSurfaceSprite2D::SDLSurfaceSprite2D(const SDLSurfaceSprite2D &obj)
+ : Sprite2D(obj)
+{
+ surface = SDL_ConvertSurface(obj.surface, obj.surface->format, obj.surface->flags);
+ vptr = surface;
+#if SDL_VERSION_ATLEAST(1,3,0)
+ SDL_SetSurfaceRLE(surface, SDL_TRUE);
+#endif
+}
+
+SDLSurfaceSprite2D* SDLSurfaceSprite2D::copy() const
+{
+ return new SDLSurfaceSprite2D(*this);
+}
+
+SDLSurfaceSprite2D::~SDLSurfaceSprite2D()
+{
+ SDL_FreeSurface(surface);
+}
+
+/** Get the Palette of a Sprite */
+Palette* SDLSurfaceSprite2D::GetPalette() const
+{
+ if (surface->format->BitsPerPixel != 8) {
+ return NULL;
+ }
+ Palette* pal = new Palette();
+ memcpy(pal->col, surface->format->palette->colors, surface->format->palette->ncolors * 4);
+ return pal;
+}
+
+void SDLSurfaceSprite2D::SetPalette(Palette* pal)
+{
+ SetPalette(pal->col);
+}
+
+void SDLSurfaceSprite2D::SetPalette(Color* pal)
+{
+ SDLSurfaceSprite2D::SetSurfacePalette(surface, (SDL_Color*)pal, 0x01 << Bpp);
+}
+
+ieDword SDLSurfaceSprite2D::GetColorKey() const
+{
+ ieDword ck = 0;
+#if SDL_VERSION_ATLEAST(1,3,0)
+ SDL_GetColorKey(surface, &ck);
+#else
+ ck = surface->format->colorkey;
+#endif
+ return ck;
+}
+
+void SDLSurfaceSprite2D::SetColorKey(ieDword ck)
+{
+#if SDL_VERSION_ATLEAST(1,3,0)
+ SDL_SetColorKey(surface, SDL_TRUE, ck);
+#else
+ SDL_SetColorKey(surface, SDL_SRCCOLORKEY | SDL_RLEACCEL, ck);
+#endif
+}
+
+Color SDLSurfaceSprite2D::GetPixel(unsigned short x, unsigned short y) const
+{
+ Color c = { 0, 0, 0, 0 };
+
+ if (x >= Width || y >= Height) return c;
+
+ SDL_LockSurface( surface );
+ Uint8 Bpp = surface->format->BytesPerPixel;
+ unsigned char * pixels = ( ( unsigned char * ) surface->pixels ) +
+ ( ( y * surface->w + x) * Bpp );
+ long val = 0;
+
+ if (Bpp == 1) {
+ val = *pixels;
+ } else if (Bpp == 2) {
+ val = *(Uint16 *)pixels;
+ } else if (Bpp == 3) {
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN
+ val = pixels[0] + ((unsigned int)pixels[1] << 8) + ((unsigned int)pixels[2] << 16);
+#else
+ val = pixels[2] + ((unsigned int)pixels[1] << 8) + ((unsigned int)pixels[0] << 16);
+#endif
+ } else if (Bpp == 4) {
+ val = *(Uint32 *)pixels;
+ }
+
+ SDL_UnlockSurface( surface );
+
+ SDL_GetRGBA( val, surface->format, (Uint8 *) &c.r, (Uint8 *) &c.g, (Uint8 *) &c.b, (Uint8 *) &c.a );
+ return c;
+}
+
+void SDLSurfaceSprite2D::SetSurfacePalette(SDL_Surface* surf, SDL_Color* pal, int numcolors)
+{
+#if SDL_VERSION_ATLEAST(1,3,0)
+ SDL_SetPaletteColors( surf->format->palette, pal, 0, numcolors );
+#else
+ SDL_SetPalette( surf, SDL_LOGPAL | SDL_RLEACCEL, pal, 0, numcolors );
+#endif
+}
+
+}
View
54 gemrb/plugins/SDLVideo/SDLSurfaceSprite2D.h
@@ -0,0 +1,54 @@
+/* GemRB - Infinity Engine Emulator
+ * Copyright (C) 2013 The GemRB Project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ */
+
+#ifndef SDLSURFACESPRITE2D_H
+#define SDLSURFACESPRITE2D_H
+
+#include "Sprite2D.h"
+
+struct SDL_Surface;
+struct SDL_Color;
+
+namespace GemRB {
+
+class SDLSurfaceSprite2D : public Sprite2D {
+private:
+ SDL_Surface* surface;
+public:
+ SDLSurfaceSprite2D(int Width, int Height, int Bpp, void* pixels);
+ SDLSurfaceSprite2D(int Width, int Height, int Bpp, void* pixels,
+ ieDword rmask, ieDword gmask, ieDword bmask, ieDword amask);
+ SDLSurfaceSprite2D(const SDLSurfaceSprite2D &obj);
+ SDLSurfaceSprite2D* copy() const;
+ ~SDLSurfaceSprite2D();
+
+ Palette *GetPalette() const;
+ void SetPalette(Palette *pal);
+ void SetPalette(Color* pal);
+ ieDword GetColorKey() const;
+ void SetColorKey(ieDword ck);
+ Color GetPixel(unsigned short x, unsigned short y) const;
+
+ static void SetSurfacePalette(SDL_Surface* surf, SDL_Color* pal, int numcolors = 256);
+};
+
+}
+
+#endif // ! SDLSURFACESPRITE2D_H
View
39 gemrb/plugins/SDLVideo/SDLVideo.cpp
@@ -20,7 +20,7 @@
#include "SDLVideo.h"
-#include "Sprite2D.h"
+#include "SDLSurfaceSprite2D.h"
#include "TileRenderer.inl"
#include "SpriteRenderer.inl"
@@ -396,12 +396,12 @@ void SDLVideoDriver::AddPolygonToSpriteCover(SpriteCover* sc, Wall_Polygon* poly
Sprite2D* SDLVideoDriver::CreateSprite(int w, int h, int bpp, ieDword rMask,
ieDword gMask, ieDword bMask, ieDword aMask, void* pixels, bool cK, int index)
{
- SDL_Surface* p = SDL_CreateRGBSurfaceFrom( pixels, w, h, bpp, w*( bpp / 8 ),
- rMask, gMask, bMask, aMask );
+ SDLSurfaceSprite2D* spr = new SDLSurfaceSprite2D(w, h, bpp, pixels, rMask, gMask, bMask, aMask);
+
if (cK) {
- SDL_SetColorKey( p, SDL_SRCCOLORKEY | SDL_RLEACCEL, index );
+ spr->SetColorKey(index);
}
- return new Sprite2D(w, h, bpp, p, pixels);
+ return spr;
}
Sprite2D* SDLVideoDriver::CreateSprite8(int w, int h, void* pixels,
@@ -413,12 +413,12 @@ Sprite2D* SDLVideoDriver::CreateSprite8(int w, int h, void* pixels,
Sprite2D* SDLVideoDriver::CreatePalettedSprite(int w, int h, int bpp, void* pixels,
Color* palette, bool cK, int index)
{
- SDL_Surface* p = SDL_CreateRGBSurfaceFrom( pixels, w, h, 8, w, 0, 0, 0, 0 );
- SetSurfacePalette( p, (SDL_Color*)palette, 0x01 << bpp );
+ SDLSurfaceSprite2D* spr = new SDLSurfaceSprite2D(w, h, bpp, pixels);
+ spr->SetPalette(palette);
if (cK) {
- SDL_SetColorKey( p, SDL_SRCCOLORKEY, index );
+ spr->SetColorKey(index);
}
- return new Sprite2D(w, h, bpp, p, pixels);
+ return spr;
}
void SDLVideoDriver::FreeSprite(Sprite2D*& spr)
@@ -436,9 +436,6 @@ void SDLVideoDriver::FreeSprite(Sprite2D*& spr)
// so i am setting it to the object itself for bam sprites for now
assert(spr->vptr == spr);
} else {
- if (spr->vptr) {
- SDL_FreeSurface( ( SDL_Surface * ) spr->vptr );
- }
free( (void*)spr->pixels );
}
delete spr;
@@ -652,10 +649,13 @@ void SDLVideoDriver::BlitSprite(const Sprite2D* spr, int x, int y, bool anchor,
}
if (palette) {
+ // FIXME: casting away const to temporarily change the palette for the
+ // blit opperation. this is no diffrent than what we did before with the
+ // vptr, and the end result leavs the sprite unchanged, but is there a better way?
Palette* tmpPal = spr->GetPalette();
- SetSurfacePalette(( SDL_Surface * )spr->vptr, (SDL_Color*)palette->col, 256);
+ ((Sprite2D*)spr)->SetPalette(palette);
SDL_BlitSurface( ( SDL_Surface * ) spr->vptr, srect, backBuf, &drect );
- SetSurfacePalette(( SDL_Surface * )spr->vptr, (SDL_Color*)tmpPal->col, 256);
+ ((Sprite2D*)spr)->SetPalette(tmpPal);
tmpPal->release();
} else {
SDL_BlitSurface( ( SDL_Surface * ) spr->vptr, srect, backBuf, &drect );
@@ -981,13 +981,6 @@ Sprite2D* SDLVideoDriver::GetScreenshot( Region r )
return screenshot;
}
-/** No descriptions */
-void SDLVideoDriver::SetPalette(void *data, Palette* pal)
-{
- SDL_Surface* sur = ( SDL_Surface* ) data;
- SetSurfacePalette(sur, ( SDL_Color * ) pal->col, sizeof(pal->col) / 4);
-}
-
void SDLVideoDriver::ConvertToVideoFormat(Sprite2D* sprite)
{
if (!sprite->BAM) {
@@ -1025,7 +1018,7 @@ void SDLVideoDriver::DrawRect(const Region& rgn, const Color& color, bool fill,
c.r = color.r;
c.b = color.b;
c.g = color.g;
- SetSurfacePalette( rectsurf, &c, 1 );
+ SDLSurfaceSprite2D::SetSurfacePalette(rectsurf, &c, 1);
SetSurfaceAlpha(rectsurf, color.a);
SDL_BlitSurface( rectsurf, NULL, backBuf, &drect );
SDL_FreeSurface( rectsurf );
@@ -1061,7 +1054,7 @@ void SDLVideoDriver::DrawRectSprite(const Region& rgn, const Color& color, const
c.r = color.r;
c.b = color.b;
c.g = color.g;
- SetSurfacePalette( rectsurf, &c, 1 );
+ SDLSurfaceSprite2D::SetSurfacePalette(rectsurf, &c, 1);
SetSurfaceAlpha(rectsurf, color.a);
SDL_BlitSurface( rectsurf, NULL, surf, &drect );
SDL_FreeSurface( rectsurf );
View
3 gemrb/plugins/SDLVideo/SDLVideo.h
@@ -105,8 +105,6 @@ class SDLVideoDriver : public Video {
void SetDragCursor(Sprite2D* drag);
Sprite2D* GetScreenshot( Region r );
void ConvertToVideoFormat(Sprite2D* sprite);
- /** Sets the palette of an SDL surface pointed by */
- void SetPalette(void* data, Palette* pal);
/** This function Draws the Border of a Rectangle as described by the Region parameter. The Color used to draw the rectangle is passes via the Color parameter. */
void DrawRect(const Region& rgn, const Color& color, bool fill = true, bool clipped = false);
void DrawRectSprite(const Region& rgn, const Color& color, const Sprite2D* sprite);
@@ -172,7 +170,6 @@ class SDLVideoDriver : public Video {
protected:
void DrawMovieSubtitle(ieDword strRef);
- virtual bool SetSurfacePalette(SDL_Surface* surface, SDL_Color* colors, int ncolors)=0;
virtual bool SetSurfaceAlpha(SDL_Surface* surface, unsigned short alpha)=0;
/* used to process the SDL events dequeued by PollEvents or an arbitraty event from another source.*/
virtual int ProcessEvent(const SDL_Event & event);

0 comments on commit 86e3ea9

Please sign in to comment.
Something went wrong with that request. Please try again.