[Bf-blender-cvs] [f0f3554] master: GHOST: fewer virtual functions

Mike Erwin noreply at git.blender.org
Sun Feb 8 20:22:00 CET 2015


Commit: f0f3554e17398017a824582c401087b7dd3b2708
Author: Mike Erwin
Date:   Sun Feb 8 14:18:53 2015 -0500
Branches: master
https://developer.blender.org/rBf0f3554e17398017a824582c401087b7dd3b2708

GHOST: fewer virtual functions

Reined back over-use of virtual functions in GHOST, especially in
"leaves" of the inheritance hierarchy. This eliminates vtables for many
classes and (in some places) turns virtual function dispatch into direct
function calls.

I'll be around to fix things if other coders think this change is too
much.

Still lots of virtual in GHOST_TaskbarWin32 since it just loves virtual.

===================================================================

M	intern/ghost/intern/GHOST_Buttons.h
M	intern/ghost/intern/GHOST_CallbackEventConsumer.h
M	intern/ghost/intern/GHOST_ContextCGL.h
M	intern/ghost/intern/GHOST_ContextEGL.h
M	intern/ghost/intern/GHOST_ContextGLX.h
M	intern/ghost/intern/GHOST_ContextNone.h
M	intern/ghost/intern/GHOST_ContextSDL.h
M	intern/ghost/intern/GHOST_ContextWGL.h
M	intern/ghost/intern/GHOST_DisplayManagerCocoa.h
M	intern/ghost/intern/GHOST_DisplayManagerWin32.h
M	intern/ghost/intern/GHOST_DropTargetWin32.h
M	intern/ghost/intern/GHOST_Event.h
M	intern/ghost/intern/GHOST_EventManager.h
M	intern/ghost/intern/GHOST_EventPrinter.h
M	intern/ghost/intern/GHOST_ModifierKeys.h
M	intern/ghost/intern/GHOST_System.h
M	intern/ghost/intern/GHOST_SystemCocoa.h
M	intern/ghost/intern/GHOST_SystemPathsCocoa.h
M	intern/ghost/intern/GHOST_SystemPathsWin32.h
M	intern/ghost/intern/GHOST_SystemPathsX11.h
M	intern/ghost/intern/GHOST_SystemWin32.h
M	intern/ghost/intern/GHOST_SystemX11.h
M	intern/ghost/intern/GHOST_TimerManager.h
M	intern/ghost/intern/GHOST_TimerTask.h
M	intern/ghost/intern/GHOST_Window.h
M	intern/ghost/intern/GHOST_WindowCocoa.h
M	intern/ghost/intern/GHOST_WindowManager.h
M	intern/ghost/intern/GHOST_WindowNULL.h
M	intern/ghost/intern/GHOST_WindowSDL.h
M	intern/ghost/intern/GHOST_WindowWin32.h
M	intern/ghost/intern/GHOST_WindowX11.h

===================================================================

diff --git a/intern/ghost/intern/GHOST_Buttons.h b/intern/ghost/intern/GHOST_Buttons.h
index 6b0d74e..0aa93a2 100644
--- a/intern/ghost/intern/GHOST_Buttons.h
+++ b/intern/ghost/intern/GHOST_Buttons.h
@@ -48,26 +48,26 @@ struct GHOST_Buttons {
 	 */
 	GHOST_Buttons();
 
-	virtual ~GHOST_Buttons();
+	~GHOST_Buttons();
 
 	/**
 	 * Returns the state of a single button.
 	 * \param mask Key button to return.
 	 * \return The state of the button (pressed == true).
 	 */
-	virtual bool get(GHOST_TButtonMask mask) const;
+	bool get(GHOST_TButtonMask mask) const;
 
 	/**
 	 * Updates the state of a single button.
 	 * \param mask Button state to update.
 	 * \param down The new state of the button.
 	 */
-	virtual void set(GHOST_TButtonMask mask, bool down);
+	void set(GHOST_TButtonMask mask, bool down);
 
 	/**
 	 * Sets the state of all buttons to up.
 	 */
-	virtual void clear();
+	void clear();
 
 	GHOST_TUns8 m_ButtonLeft        : 1;
 	GHOST_TUns8 m_ButtonMiddle      : 1;
diff --git a/intern/ghost/intern/GHOST_CallbackEventConsumer.h b/intern/ghost/intern/GHOST_CallbackEventConsumer.h
index 770ebdc..3505d65 100644
--- a/intern/ghost/intern/GHOST_CallbackEventConsumer.h
+++ b/intern/ghost/intern/GHOST_CallbackEventConsumer.h
@@ -57,7 +57,7 @@ public:
 	/**
 	 * Destructor.
 	 */
-	virtual ~GHOST_CallbackEventConsumer(void)
+	~GHOST_CallbackEventConsumer(void)
 	{
 	}
 
@@ -66,7 +66,7 @@ public:
 	 * \param event	The event that can be handled or ignored.
 	 * \return Indication as to whether the event was handled.
 	 */
-	virtual bool processEvent(GHOST_IEvent *event);
+	bool processEvent(GHOST_IEvent *event);
 
 protected:
 	/** The call-back routine invoked. */
diff --git a/intern/ghost/intern/GHOST_ContextCGL.h b/intern/ghost/intern/GHOST_ContextCGL.h
index 99d995b..8619a13 100644
--- a/intern/ghost/intern/GHOST_ContextCGL.h
+++ b/intern/ghost/intern/GHOST_ContextCGL.h
@@ -72,53 +72,53 @@ public:
 	/**
 	 * Destructor.
 	 */
-	virtual ~GHOST_ContextCGL();
+	~GHOST_ContextCGL();
 
 	/**
 	 * Swaps front and back buffers of a window.
 	 * \return  A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess swapBuffers();
+	GHOST_TSuccess swapBuffers();
 
 	/**
 	 * Activates the drawing context of this window.
 	 * \return  A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess activateDrawingContext();
+	GHOST_TSuccess activateDrawingContext();
 
 	/**
 	 * Call immediately after new to initialize.  If this fails then immediately delete the object.
 	 * \return Indication as to whether initialization has succeeded.
 	 */
-	virtual GHOST_TSuccess initializeDrawingContext();
+	GHOST_TSuccess initializeDrawingContext();
 
 	/**
 	 * Removes references to native handles from this context and then returns
 	 * \return GHOST_kSuccess if it is OK for the parent to release the handles and
 	 * GHOST_kFailure if releasing the handles will interfere with sharing
 	 */
-	virtual GHOST_TSuccess releaseNativeHandles();
+	GHOST_TSuccess releaseNativeHandles();
 
 	/**
 	 * Sets the swap interval for swapBuffers.
 	 * \param interval The swap interval to use.
 	 * \return A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess setSwapInterval(int interval);
+	GHOST_TSuccess setSwapInterval(int interval);
 
 	/**
 	 * Gets the current swap interval for swapBuffers.
 	 * \param intervalOut Variable to store the swap interval if it can be read.
 	 * \return Whether the swap interval can be read.
 	 */
-	virtual GHOST_TSuccess getSwapInterval(int&);
+	GHOST_TSuccess getSwapInterval(int&);
 
 	/**
 	 * Updates the drawing context of this window.
 	 * Needed whenever the window is changed.
 	 * \return Indication of success.
 	 */
-	virtual GHOST_TSuccess updateDrawingContext();
+	GHOST_TSuccess updateDrawingContext();
 
 //protected:
 //	inline void activateCGLEW() const {
diff --git a/intern/ghost/intern/GHOST_ContextEGL.h b/intern/ghost/intern/GHOST_ContextEGL.h
index 5e45813..70c26c9 100644
--- a/intern/ghost/intern/GHOST_ContextEGL.h
+++ b/intern/ghost/intern/GHOST_ContextEGL.h
@@ -75,39 +75,39 @@ public:
 	/**
 	 * Destructor.
 	 */
-	virtual ~GHOST_ContextEGL();
+	~GHOST_ContextEGL();
 
 	/**
 	 * Swaps front and back buffers of a window.
 	 * \return  A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess swapBuffers();
+	GHOST_TSuccess swapBuffers();
 
 	/**
 	 * Activates the drawing context of this window.
 	 * \return  A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess activateDrawingContext();
+	GHOST_TSuccess activateDrawingContext();
 
 	/**
 	 * Call immediately after new to initialize.  If this fails then immediately delete the object.
 	 * \return Indication as to whether initialization has succeeded.
 	 */
-	virtual GHOST_TSuccess initializeDrawingContext();
+	GHOST_TSuccess initializeDrawingContext();
 
 	/**
 	 * Removes references to native handles from this context and then returns
 	 * \return GHOST_kSuccess if it is OK for the parent to release the handles and
 	 * GHOST_kFailure if releasing the handles will interfere with sharing
 	 */
-	virtual GHOST_TSuccess releaseNativeHandles();
+	GHOST_TSuccess releaseNativeHandles();
 
 	/**
 	 * Sets the swap interval for swapBuffers.
 	 * \param interval The swap interval to use.
 	 * \return A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess setSwapInterval(int interval);
+	GHOST_TSuccess setSwapInterval(int interval);
 
 	/**
 	 * Gets the current swap interval for swapBuffers.
diff --git a/intern/ghost/intern/GHOST_ContextGLX.h b/intern/ghost/intern/GHOST_ContextGLX.h
index 9bc17d4..e2169ac 100644
--- a/intern/ghost/intern/GHOST_ContextGLX.h
+++ b/intern/ghost/intern/GHOST_ContextGLX.h
@@ -75,46 +75,46 @@ public:
 	/**
 	 * Destructor.
 	 */
-	virtual ~GHOST_ContextGLX();
+	~GHOST_ContextGLX();
 
 	/**
 	 * Swaps front and back buffers of a window.
 	 * \return  A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess swapBuffers();
+	GHOST_TSuccess swapBuffers();
 
 	/**
 	 * Activates the drawing context of this window.
 	 * \return  A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess activateDrawingContext();
+	GHOST_TSuccess activateDrawingContext();
 
 	/**
 	 * Call immediately after new to initialize.  If this fails then immediately delete the object.
 	 * \return Indication as to whether initialization has succeeded.
 	 */
-	virtual GHOST_TSuccess initializeDrawingContext();
+	GHOST_TSuccess initializeDrawingContext();
 
 	/**
 	 * Removes references to native handles from this context and then returns
 	 * \return GHOST_kSuccess if it is OK for the parent to release the handles and
 	 * GHOST_kFailure if releasing the handles will interfere with sharing
 	 */
-	virtual GHOST_TSuccess releaseNativeHandles();
+	GHOST_TSuccess releaseNativeHandles();
 
 	/**
 	 * Sets the swap interval for swapBuffers.
 	 * \param interval The swap interval to use.
 	 * \return A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess setSwapInterval(int interval);
+	GHOST_TSuccess setSwapInterval(int interval);
 
 	/**
 	 * Gets the current swap interval for swapBuffers.
 	 * \param intervalOut Variable to store the swap interval if it can be read.
 	 * \return Whether the swap interval can be read.
 	 */
-	virtual GHOST_TSuccess getSwapInterval(int &intervalOut);
+	GHOST_TSuccess getSwapInterval(int &intervalOut);
 
 protected:
 	inline void activateGLXEW() const {
diff --git a/intern/ghost/intern/GHOST_ContextNone.h b/intern/ghost/intern/GHOST_ContextNone.h
index c36873c..80cce76 100644
--- a/intern/ghost/intern/GHOST_ContextNone.h
+++ b/intern/ghost/intern/GHOST_ContextNone.h
@@ -51,44 +51,44 @@ public:
 	 * Dummy function
 	 * \return  Always succeeds
 	 */
-	virtual GHOST_TSuccess swapBuffers();
+	GHOST_TSuccess swapBuffers();
 
 	/**
 	 * Dummy function
 	 * \return  Always succeeds
 	 */
-	virtual GHOST_TSuccess activateDrawingContext();
+	GHOST_TSuccess activateDrawingContext();
 
 	/**
 	 * Dummy function
 	 * \return Always succeeds
 	 */
-	virtual GHOST_TSuccess updateDrawingContext();
+	GHOST_TSuccess updateDrawingContext();
 
 	/**
 	 * Dummy function
 	 * \return Always succeeds
 	 */
-	virtual GHOST_TSuccess initializeDrawingContext();
+	GHOST_TSuccess initializeDrawingContext();
 
 	/**
 	 * Dummy function
 	 * \return Always succeeds
 	 */
-	virtual GHOST_TSuccess releaseNativeHandles();
+	GHOST_TSuccess releaseNativeHandles();
 
 	/**
 	 * Dummy function
 	 * \return Always succeeds
 	 */
-	virtual GHOST_TSuccess setSwapInterval(int interval);
+	GHOST_TSuccess setSwapInterval(int interval);
 
 	/**
 	 * Dummy function
 	 * \param intervalOut Gets whatever was set by setSwapInterval
 	 * \return Always succeeds
 	 */
-	virtual GHOST_TSuccess getSwapInterval(int &intervalOut);
+	GHOST_TSuccess getSwapInterval(int &intervalOut);
 
 private:
 	int m_swapInterval;
diff --git a/intern/ghost/intern/GHOST_ContextSDL.h b/intern/ghost/intern/GHOST_ContextSDL.h
index 5edf1a0..c151d8e 100644
--- a/intern/ghost/intern/GHOST_ContextSDL.h
+++ b/intern/ghost/intern/GHOST_ContextSDL.h
@@ -67,46 +67,46 @@ public:
 	/**
 	 * Destructor.
 	 */
-	virtual ~GHOST_ContextSDL();
+	~GHOST_ContextSDL();
 
 	/**
 	 * Swaps front and back buffers of a window.
 	 * \return  A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess swapBuffers();
+	GHOST_TSuccess swapBuffers();
 
 	/**
 	 * Activates the drawing context of this window.
 	 * \return  A boolean success indicator.
 	 */
-	virtual GHOST_TSuccess activateDrawingContext();
+	GHOST_TSuccess activateDrawingContext();
 
 	/**
 	 * Call immediately after new to initialize.  If this fails then immediately delete the object.
 	 * \return Indication as to whether initialization has succeeded.
 	 */
-	virtual GHOST_TSuccess initializeDrawingContext();
+	GHOST_TSuccess initializeDrawingContext();
 
 	/**
 	 * Removes references to native handles from this context and then returns
 	 * \return GHOST_kSuccess if it is OK for the parent to release the handles and
 	 * GHOST_kFailure if releasing the handles will interfere with sharing
 	 */
-	virtual GHOST_TSuccess releaseNativeHandles();
+	GHOST_TSuccess releaseNativeHandles();
 
 	/**
 	 * Sets the swap interval for swapBuffers.
 	 * \param interval The swap interval to 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list