diff --git a/binding/bitmap-binding.cpp b/binding/bitmap-binding.cpp index fd183453..117bfd97 100644 --- a/binding/bitmap-binding.cpp +++ b/binding/bitmap-binding.cpp @@ -204,17 +204,6 @@ RB_METHOD(bitmapClear) return self; } -RB_METHOD(bitmapUpdate) -{ - RB_UNUSED_PARAM; - - Bitmap *b = getPrivateData(self); - - GUARD_EXC( b->update(); ) - - return self; -} - RB_METHOD(bitmapGetPixel) { Bitmap *b = getPrivateData(self); @@ -471,7 +460,6 @@ bitmapBindingInit() _rb_define_method(klass, "stretch_blt", bitmapStretchBlt); _rb_define_method(klass, "fill_rect", bitmapFillRect); _rb_define_method(klass, "clear", bitmapClear); - _rb_define_method(klass, "update", bitmapUpdate); _rb_define_method(klass, "get_pixel", bitmapGetPixel); _rb_define_method(klass, "set_pixel", bitmapSetPixel); _rb_define_method(klass, "hue_change", bitmapHueChange); diff --git a/meson.build b/meson.build index 58a4813f..b081371e 100644 --- a/meson.build +++ b/meson.build @@ -28,19 +28,6 @@ if discord_libpath != '' endif endif -# GIFLIB - -gif = false -gif_prefix = get_option('giflib_prefix') -if gif_prefix != '' - giflib = compiler.find_library('gif', required: false, dirs: gif_prefix+'/lib') - if giflib.found() == true - add_project_arguments(['-I@0@/include'.format(gif_prefix), '-DHAVE_GIFLIB'], language: 'cpp') - ext_dependencies += giflib - gif = true - endif -endif - # ==================== # Main source # ==================== diff --git a/meson_options.txt b/meson_options.txt index 68dd7e43..be9fb909 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -10,5 +10,4 @@ option('default_framerate', type: 'boolean', value: false, description: 'Disable option('no_preload_scripts', type: 'boolean', value: false, description: 'Disable the preloadScript configuration option') option('workdir_current', type: 'boolean', value: false, description: 'Keep current directory on startup') -option('discord_sdk_path', type: 'string', value: '', description: 'Path to Discord GameSDK') -option('giflib_prefix', type: 'string', value: '', description: 'Path to the prefix where giflib is installed') \ No newline at end of file +option('discord_sdk_path', type: 'string', value: '', description: 'Path to Discord GameSDK') \ No newline at end of file diff --git a/src/bitmap.cpp b/src/bitmap.cpp index 3637fd2d..1fa08cde 100644 --- a/src/bitmap.cpp +++ b/src/bitmap.cpp @@ -44,10 +44,6 @@ #include "font.h" #include "eventthread.h" -#ifdef HAVE_GIFLIB -#include -#endif - #define GUARD_MEGA \ { \ if (p->megaSurface) \ @@ -105,20 +101,9 @@ struct BitmapPrivate * in the texture and blit to it directly, saving * ourselves the expensive blending calculation */ pixman_region16_t tainted; - - /* If the image is a gif, its frames are located here. */ -#ifdef HAVE_GIFLIB - SDL_Surface* gifSurfaces[256]; - int nFrames; - int currentFrame; -#endif BitmapPrivate(Bitmap *self) : self(self), -#ifdef HAVE_GIFLIB - nFrames(1), - currentFrame(0), -#endif megaSurface(0), surface(0) { @@ -132,10 +117,6 @@ struct BitmapPrivate { SDL_FreeFormat(format); pixman_region_fini(&tainted); -#ifdef HAVE_GIFLIB - if (nFrames > 1) - for (int i = 0; i < nFrames; i++) SDL_FreeSurface(gifSurfaces[i]); -#endif } void allocSurface() @@ -270,53 +251,6 @@ struct BitmapOpenHandler : FileSystem::OpenHandler Bitmap::Bitmap(const char *filename) { BitmapOpenHandler handler; - - // If the file is a gif, try opening it with giflib first - // and read every frame -#ifdef HAVE_GIFLIB - char *extension = strrchr((char*)filename, '.'); - int *rc{}; - if (extension && !strcmp((extension+1), "gif")) - { - GifFileType *gif = DGifOpenFileName(filename, rc); - if (rc && DGifSlurp(gif) == GIF_OK) - { - p->nFrames = gif->ImageCount; - int colorReso = gif->SColorResolution; - for (int i = 0; i < p->nFrames; i++) - { - SDL_Surface *frame = SDL_CreateRGBSurface(0, - gif->SWidth, - gif->SHeight, - colorReso, - p->format->Rmask, - p->format->Gmask, - p->format->Bmask, - p->format->Amask); - if (frame) - { - memcpy(frame->pixels, - gif->SavedImages[i].RasterBits, - frame->w*frame->h*(colorReso/8)); - p->gifSurfaces[i] = frame; - } - else - { - for (int b = i; b >= 0; b--) - { - SDL_FreeSurface(p->gifSurfaces[b]); - p->gifSurfaces[b] = 0; - } - break; - } - } - GifFreeSavedImages(gif); - handler.surf = p->gifSurfaces[0]; - } - } - - if (!handler.surf) -#endif shState->fileSystem().openRead(handler, filename); SDL_Surface *imgSurf = handler.surf; @@ -880,31 +814,6 @@ void Bitmap::clear() p->onModified(); } -void Bitmap::update() -{ -#ifdef HAVE_GIFLIB - if (p->nFrames < 2) return; - - guardDisposed(); - - GUARD_MEGA; - - if (p->currentFrame >= p->nFrames) - { - p->currentFrame = 0; - } - else - { - p->currentFrame++; - } - SDL_Surface *surf = p->gifSurfaces[p->currentFrame]; - - replaceRaw(surf->pixels, surf->w, surf->h); -#else - return; -#endif -} - static uint32_t &getPixelAt(SDL_Surface *surf, SDL_PixelFormat *form, int x, int y) { size_t offset = x*form->BytesPerPixel + y*surf->pitch; @@ -993,7 +902,6 @@ void Bitmap::replaceRaw(void *pixel_data, int w, int h) TEXFBO::fini(buf); taintArea(IntRect(0,0,w,h)); - p->onModified(); } diff --git a/src/bitmap.h b/src/bitmap.h index 43f6216e..a044b05d 100644 --- a/src/bitmap.h +++ b/src/bitmap.h @@ -78,8 +78,6 @@ public: void radialBlur(int angle, int divisions); void clear(); - - void update(); Color getPixel(int x, int y) const; void setPixel(int x, int y, const Color &color); diff --git a/src/graphics.cpp b/src/graphics.cpp index c5f4b326..e2a7f635 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -974,7 +974,8 @@ void Graphics::screenshot(const char *filename) #ifdef __WIN32__ SDL_Surface *img = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32, 0,0,0,0); if (!img) throw Exception(Exception::SDLError, "%s", SDL_GetError()); - + + glReadBuffer(GL_FRONT); glReadPixels(0,0,w,h,GL_BGRA,GL_UNSIGNED_BYTE, img->pixels); #else SDL_Surface *tmp, *img; @@ -987,6 +988,7 @@ void Graphics::screenshot(const char *filename) throw Exception(Exception::SDLError, "%s", SDL_GetError()); } + glReadBuffer(GL_FRONT); glReadPixels(0,0,w,h,GL_BGRA,GL_UNSIGNED_BYTE, tmp->pixels); for (int i = 0; i < h; i++)