From e83a943ab92a82a2812e3bc787a420eac84e29fa Mon Sep 17 00:00:00 2001
From: Christian Speckner <christian.speckner@mayflower.de>
Date: Tue, 10 Dec 2019 21:28:46 +0100
Subject: [PATCH] Cleanup.

---
 src/common/FBSurfaceSDL2.cxx       |  8 ++++----
 src/common/FBSurfaceSDL2.hxx       |  2 +-
 src/common/FrameBufferSDL2.cxx     |  2 +-
 src/common/FrameBufferSDL2.hxx     | 15 +++++++++++----
 src/emucore/FBSurface.hxx          |  6 +-----
 src/libretro/FBSurfaceLIBRETRO.hxx |  2 +-
 6 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/common/FBSurfaceSDL2.cxx b/src/common/FBSurfaceSDL2.cxx
index ab1dab6c1..944e1ddb6 100644
--- a/src/common/FBSurfaceSDL2.cxx
+++ b/src/common/FBSurfaceSDL2.cxx
@@ -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();
 }
diff --git a/src/common/FBSurfaceSDL2.hxx b/src/common/FBSurfaceSDL2.hxx
index 34006003c..42da59616 100644
--- a/src/common/FBSurfaceSDL2.hxx
+++ b/src/common/FBSurfaceSDL2.hxx
@@ -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);
diff --git a/src/common/FrameBufferSDL2.cxx b/src/common/FrameBufferSDL2.cxx
index 71fb75d2d..d999567d6 100644
--- a/src/common/FrameBufferSDL2.cxx
+++ b/src/common/FrameBufferSDL2.cxx
@@ -441,7 +441,7 @@ bool FrameBufferSDL2::isInitialized() const
 }
 
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-const SDL_PixelFormat& FrameBufferSDL2::pixelFormat()
+const SDL_PixelFormat& FrameBufferSDL2::pixelFormat() const
 {
   return *myPixelFormat;
 }
diff --git a/src/common/FrameBufferSDL2.hxx b/src/common/FrameBufferSDL2.hxx
index 11d162e35..a444e7e33 100644
--- a/src/common/FrameBufferSDL2.hxx
+++ b/src/common/FrameBufferSDL2.hxx
@@ -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:
     //////////////////////////////////////////////////////////////////////
diff --git a/src/emucore/FBSurface.hxx b/src/emucore/FBSurface.hxx
index b990d9738..f287e4b85 100644
--- a/src/emucore/FBSurface.hxx
+++ b/src/emucore/FBSurface.hxx
@@ -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; }
 
diff --git a/src/libretro/FBSurfaceLIBRETRO.hxx b/src/libretro/FBSurfaceLIBRETRO.hxx
index 3af0a91a0..f7bbbf550 100644
--- a/src/libretro/FBSurfaceLIBRETRO.hxx
+++ b/src/libretro/FBSurfaceLIBRETRO.hxx
@@ -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);