This commit is contained in:
Christian Speckner 2019-12-10 21:28:46 +01:00
parent 02dd24d45f
commit a966295e9b
6 changed files with 19 additions and 16 deletions

View File

@ -185,10 +185,10 @@ void FBSurfaceSDL2::createSurface(uInt32 width, uInt32 height,
ASSERT_MAIN_THREAD;
// Create a surface in the same format as the parent GL class
const SDL_PixelFormat* pf = myFB.myPixelFormat;
const SDL_PixelFormat& pf = myFB.pixelFormat();
mySurface = SDL_CreateRGBSurface(0, width, height,
pf->BitsPerPixel, pf->Rmask, pf->Gmask, pf->Bmask, pf->Amask);
pf.BitsPerPixel, pf.Rmask, pf.Gmask, pf.Bmask, pf.Amask);
// We start out with the src and dst rectangles containing the same
// dimensions, indicating no scaling or re-positioning
@ -200,7 +200,7 @@ void FBSurfaceSDL2::createSurface(uInt32 width, uInt32 height,
////////////////////////////////////////////////////
// These *must* be set for the parent class
myPixels = reinterpret_cast<uInt32*>(mySurface->pixels);
myPitch = mySurface->pitch / pf->BytesPerPixel;
myPitch = mySurface->pitch / pf.BytesPerPixel;
////////////////////////////////////////////////////
if(data)
@ -221,7 +221,7 @@ void FBSurfaceSDL2::reinitializeBlitter()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurfaceSDL2::applyAttributes(bool immediate)
void FBSurfaceSDL2::applyAttributes()
{
reinitializeBlitter();
}

View File

@ -62,7 +62,7 @@ class FBSurfaceSDL2 : public FBSurface
void resize(uInt32 width, uInt32 height) override;
protected:
void applyAttributes(bool immediate) override;
void applyAttributes() override;
private:
void createSurface(uInt32 width, uInt32 height, const uInt32* data);

View File

@ -441,7 +441,7 @@ bool FrameBufferSDL2::isInitialized() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const SDL_PixelFormat& FrameBufferSDL2::pixelFormat()
const SDL_PixelFormat& FrameBufferSDL2::pixelFormat() const
{
return *myPixelFormat;
}

View File

@ -34,8 +34,6 @@ class FBSurfaceSDL2;
*/
class FrameBufferSDL2 : public FrameBuffer
{
friend class FBSurfaceSDL2;
public:
/**
Creates a new SDL2 framebuffer
@ -116,11 +114,20 @@ class FrameBufferSDL2 : public FrameBuffer
*/
void clear() override;
/**
Get a pointer to the SDL renderer.
*/
SDL_Renderer* renderer();
bool isInitialized() const;
/**
Get the SDL pixel format.
*/
const SDL_PixelFormat& pixelFormat() const;
const SDL_PixelFormat& pixelFormat();
/**
Is the renderer initialized?
*/
bool isInitialized() const;
protected:
//////////////////////////////////////////////////////////////////////

View File

@ -339,12 +339,8 @@ class FBSurface
/**
The child class chooses which (if any) of the actual attributes
can be applied.
@param immediate Whether to re-initialize the surface immediately
with the new attributes, or wait until manually
reloaded
*/
virtual void applyAttributes(bool immediate = true) = 0;
virtual void applyAttributes() = 0;
static void setPalette(const uInt32* palette) { myPalette = palette; }

View File

@ -58,7 +58,7 @@ class FBSurfaceLIBRETRO : public FBSurface
void resize(uInt32 width, uInt32 height) override { }
protected:
void applyAttributes(bool immediate) override { }
void applyAttributes() override { }
private:
void createSurface(uInt32 width, uInt32 height, const uInt32* data);