vcl: remove curious self referential OutputDevice ptr.
No need to pay a per-instance cost for this, also avoid a self
reference for every Window sub-class.
Change-Id: I040a0ede9481229e43a39bc23297969e90b95f5e
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 0ee581a..a9ee87d 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -416,10 +416,6 @@ private:
WindowImpl* mpWindowImpl;
// This is a first attempt to start to remove the dependency of Window on
// OutputDevice
VclPtr<::OutputDevice> mpOutputDevice;
#ifdef DBG_UTIL
friend const char* ::ImplDbgCheckWindow( const void* pObj );
#endif
@@ -695,8 +691,8 @@ public:
Window( vcl::Window* pParent, const ResId& rResId );
virtual ~Window();
::OutputDevice const* GetOutDev() const { return mpOutputDevice; };
::OutputDevice* GetOutDev() { return mpOutputDevice; };
::OutputDevice const* GetOutDev() const;
::OutputDevice* GetOutDev();
virtual void EnableRTL ( bool bEnable = true ) SAL_OVERRIDE;
virtual void MouseMove( const MouseEvent& rMEvt );
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b04bad1..89679ba 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -581,6 +581,22 @@ Window::~Window()
disposeOnce();
}
// We will eventually being removing the inheritance of OutputDevice
// from Window. It will be replaced with a transient relationship such
// that the OutputDevice is only live for the scope of the Paint method.
// In the meantime this can help move us towards a Window use an
// OutputDevice, not being one.
::OutputDevice const* Window::GetOutDev() const
{
return this;
}
::OutputDevice* Window::GetOutDev()
{
return this;
}
} /* namespace vcl */
WindowImpl::WindowImpl( WindowType nType )
@@ -1195,11 +1211,6 @@ void Window::ImplInitAppFontData( vcl::Window* pWindow )
void Window::ImplInitWindowData( WindowType nType )
{
// We will eventually being removing the inheritance of OutputDevice from Window.
// It will be replaced with a composition relationship. A Window will use an OutputDevice,
// it will not *be* an OutputDevice
mpOutputDevice = (OutputDevice*)this;
mnRefCnt = 0;
mpWindowImpl = new WindowImpl( nType );