mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
ea1a014145
The intention of the recent refactor was to make it so that the temporary surfaces would be allocated only once, when the mode is enabled, and be freed upon exit. To do this, Graphics.cpp owns the pointers, and passes them to ApplyFilter to modify. Except ApplyFilter doesn't actually modify the pointers, because it's only a single pointer, not a pointer-to-pointer. So every frame of rendering it would actually be creating a new surface and leaking memory. To fix this, they need to be pointer-to-pointer variables that get modified. I also added error logs in case the surface creation failed.
17 lines
461 B
C
17 lines
461 B
C
#ifndef GRAPHICSUTIL_H
|
|
#define GRAPHICSUTIL_H
|
|
|
|
#include <SDL.h>
|
|
|
|
void setRect(SDL_Rect& _r, int x, int y, int w, int h);
|
|
|
|
SDL_Surface* GetSubSurface( SDL_Surface* metaSurface, int x, int y, int width, int height );
|
|
|
|
void DrawPixel(SDL_Surface* surface, int x, int y, SDL_Color color);
|
|
|
|
SDL_Color ReadPixel(const SDL_Surface* surface, int x, int y);
|
|
|
|
void UpdateFilter(void);
|
|
void ApplyFilter(SDL_Surface** src, SDL_Surface** dest);
|
|
|
|
#endif /* GRAPHICSUTIL_H */
|