Permalink
Browse files

Video: remove DuplicateSpriteMethod alltogether

use spritexx::copy() instead
  • Loading branch information...
1 parent c8cf5a7 commit 68883305f10e82923ded21a16cb03d89ac9b54b6 @bradallred bradallred committed Jun 16, 2013
@@ -127,8 +127,7 @@ Sprite2D* AnimationFactory::GetPaperdollImage(ieDword *Colors,
return NULL;
}
- Video* video = core->GetVideoDriver();
- Picture2 = video->DuplicateSprite(frames[1]);
+ Picture2 = frames[1]->copy();
if (!Picture2) {
return NULL;
}
@@ -142,8 +141,7 @@ Sprite2D* AnimationFactory::GetPaperdollImage(ieDword *Colors,
Picture2->XPos = (short)frames[1]->XPos;
Picture2->YPos = (short)frames[1]->YPos - 80;
-
- Sprite2D* spr = core->GetVideoDriver()->DuplicateSprite(frames[0]);
+ Sprite2D* spr = frames[0]->copy();
if (Colors) {
Palette* palette = spr->GetPalette();
palette->SetupPaperdollColours(Colors, type);
@@ -154,8 +152,6 @@ Sprite2D* AnimationFactory::GetPaperdollImage(ieDword *Colors,
spr->XPos = (short)frames[0]->XPos;
spr->YPos = (short)frames[0]->YPos;
- //don't free pixels, createsprite stores it in spr
-
return spr;
}
View
@@ -140,7 +140,6 @@ class GEM_EXPORT Video : public Plugin {
Color* palette, bool cK = false, int index = 0) = 0;
virtual bool SupportsBAMSprites() { return false; }
virtual void FreeSprite(Sprite2D* &spr) = 0;
- virtual Sprite2D* DuplicateSprite(const Sprite2D* spr) = 0;
virtual void BlitTile(const Sprite2D* spr, const Sprite2D* mask, int x, int y, const Region* clip, unsigned int flags) = 0;
virtual void BlitSprite(const Sprite2D* spr, int x, int y, bool anchor = false,
const Region* clip = NULL, Palette* palette = NULL) = 0;
@@ -3734,7 +3734,7 @@ static PyObject* SetButtonBAM(int wi, int ci, const char *ResRef, int CycleIndex
if (col1 >= 0) {
Sprite2D* old = Picture;
- Picture = core->GetVideoDriver()->DuplicateSprite(old);
+ Picture = old->copy();
core->GetVideoDriver()->FreeSprite(old);
Palette* newpal = Picture->GetPalette()->Copy();
@@ -429,12 +429,6 @@ void SDLVideoDriver::FreeSprite(Sprite2D*& spr)
}
}
-Sprite2D* SDLVideoDriver::DuplicateSprite(const Sprite2D* sprite)
-{
- if (!sprite) return NULL;
- return sprite->copy();
-}
-
void SDLVideoDriver::BlitTile(const Sprite2D* spr, const Sprite2D* mask, int x, int y, const Region* clip, unsigned int flags)
{
if (spr->BAM) {
@@ -1515,7 +1509,7 @@ Sprite2D *SDLVideoDriver::MirrorSpriteVertical(const Sprite2D* sprite, bool Mirr
if (!sprite)
return NULL;
- Sprite2D* dest = DuplicateSprite(sprite);
+ Sprite2D* dest = sprite->copy();
if (!sprite->BAM) {
for (int x = 0; x < dest->Width; x++) {
@@ -1549,7 +1543,7 @@ Sprite2D *SDLVideoDriver::MirrorSpriteHorizontal(const Sprite2D* sprite, bool Mi
if (!sprite)
return NULL;
- Sprite2D* dest = DuplicateSprite(sprite);
+ Sprite2D* dest = sprite->copy();
if (!sprite->BAM) {
for (int y = 0; y < dest->Height; y++) {
@@ -93,7 +93,6 @@ class SDLVideoDriver : public Video {
Color* palette, bool cK = false, int index = 0);
bool SupportsBAMSprites() { return true; }
void FreeSprite(Sprite2D* &spr);
- Sprite2D* DuplicateSprite(const Sprite2D* spr);
void BlitTile(const Sprite2D* spr, const Sprite2D* mask, int x, int y, const Region* clip, unsigned int flags);
void BlitSprite(const Sprite2D* spr, int x, int y, bool anchor = false,
const Region* clip = NULL, Palette* palette = NULL);

0 comments on commit 6888330

Please sign in to comment.