proper destruction and dirty reporting for mng and movie guichan images
This commit is contained in:
parent
1982f73eba
commit
389f629649
4 changed files with 14 additions and 7 deletions
|
@ -87,7 +87,7 @@ class Movie : public gcn::Image
|
|||
{
|
||||
public:
|
||||
Movie() : rect(NULL), yuv_overlay(NULL), surface(NULL), need_data(true), start_time(0),
|
||||
is_dirty(true), Width(0), Height(0), data(NULL) {};
|
||||
is_dirty(true), Width(0), Height(0), data(NULL), f(NULL) {};
|
||||
~Movie();
|
||||
int Load(const std::string &filename, int w, int h);
|
||||
bool IsPlaying() const { return is_dirty; }
|
||||
|
|
|
@ -155,7 +155,9 @@ public:
|
|||
virtual void *_getData() const;
|
||||
virtual int getWidth() const { return surface->h; }
|
||||
virtual int getHeight() const { return surface->w; }
|
||||
virtual bool isDirty() const { return is_dirty; }
|
||||
|
||||
mutable bool is_dirty;
|
||||
std::string name;
|
||||
FILE *fd;
|
||||
mng_handle handle;
|
||||
|
|
|
@ -184,7 +184,7 @@ static mng_bool MNG_DECL my_errorproc(mng_handle handle, mng_int32,
|
|||
|
||||
Mng::Mng() :
|
||||
name(NULL), fd(NULL), handle(NULL), surface(NULL), buffer(NULL),
|
||||
ticks(0), iteration(0)
|
||||
ticks(0), iteration(0), is_dirty(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,10 @@ void Mng::Reset()
|
|||
void* Mng::_getData() const
|
||||
{
|
||||
if (ticks <= GetTicks()) {
|
||||
is_dirty = true;
|
||||
mng_display_resume(handle);
|
||||
} else {
|
||||
is_dirty = false;
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
|
|
@ -426,17 +426,19 @@ int PlayMovie(const std::string &name)
|
|||
Movie::~Movie()
|
||||
{
|
||||
if (rect != NULL) {
|
||||
// free(rect);
|
||||
free(rect);
|
||||
}
|
||||
if (surface != NULL) {
|
||||
// SDL_FreeSurface(surface);
|
||||
SDL_FreeSurface(surface);
|
||||
}
|
||||
if (yuv_overlay != NULL) {
|
||||
// SDL_DestroyTexture(yuv_overlay);
|
||||
SDL_DestroyTexture(yuv_overlay);
|
||||
}
|
||||
if (data != NULL) {
|
||||
// data.File->close();
|
||||
// OggFree(&data);
|
||||
OggFree(data);
|
||||
}
|
||||
if (f != NULL) {
|
||||
delete f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue