diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-19 14:00:55 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-19 16:51:47 +1000 |
commit | 9ad131f3c9980a7135653f187170f9ffb0fb59d8 (patch) | |
tree | 7166bb2a034ba0fec018cfbdbcc7abc450a16e30 /vcl | |
parent | 1c0f94abb59296ec9e686dd3ea6b2cd963923631 (diff) |
fdo#74702 Allow Window & OutputDevice to handle erasure
Window handles erasure of backgrounds for controls. Probably this
needs to be moved to a more specific class in the future, but for
now it should go into Windows.
I also removed an unnecessary temporary variable, and removed the
need to case the pointer to this from OutputDevice to Window. In
other words, this code has been vastly simplified :-)
Change-Id: I44b91cf68f29424ffbc1679b66fbeaeb024880e9
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/outdev/outdev.cxx | 20 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 33 |
2 files changed, 34 insertions, 19 deletions
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index f00f2bfeae27..e8210f449404 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -1581,25 +1581,7 @@ void OutputDevice::Erase() if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) return; - bool bNativeOK = false; - - if( meOutDevType == OUTDEV_WINDOW ) - { - Window* pWindow = static_cast<Window*>(this); - ControlPart aCtrlPart = pWindow->ImplGetWindowImpl()->mnNativeBackground; - if( aCtrlPart != 0 && ! pWindow->IsControlBackground() ) - { - ImplControlValue aControlValue; - Rectangle aCtrlRegion( Point(), GetOutputSizePixel() ); - ControlState nState = 0; - - if( pWindow->IsEnabled() ) nState |= CTRL_STATE_ENABLED; - bNativeOK = pWindow->DrawNativeControl( CTRL_WINDOW_BACKGROUND, aCtrlPart, aCtrlRegion, - nState, aControlValue, OUString() ); - } - } - - if ( mbBackground && ! bNativeOK ) + if ( mbBackground ) { RasterOp eRasterOp = GetRasterOp(); if ( eRasterOp != ROP_OVERPAINT ) diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 0ef7a057b83d..eccb70e1720d 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9417,5 +9417,38 @@ void Window::DrawGradientWallpaper( long nX, long nY, mpMetaFile = pOldMetaFile; } +void Window::Erase() +{ + if ( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) + return; + + bool bNativeOK = false; + + ControlPart aCtrlPart = ImplGetWindowImpl()->mnNativeBackground; + if( aCtrlPart != 0 && ! IsControlBackground() ) + { + Rectangle aCtrlRegion( Point(), GetOutputSizePixel() ); + ControlState nState = 0; + + if( IsEnabled() ) + nState |= CTRL_STATE_ENABLED; + + bNativeOK = DrawNativeControl( CTRL_WINDOW_BACKGROUND, aCtrlPart, aCtrlRegion, + nState, ImplControlValue(), OUString() ); + } + + if ( mbBackground && ! bNativeOK ) + { + RasterOp eRasterOp = GetRasterOp(); + if ( eRasterOp != ROP_OVERPAINT ) + SetRasterOp( ROP_OVERPAINT ); + ImplDrawWallpaper( 0, 0, mnOutWidth, mnOutHeight, maBackground ); + if ( eRasterOp != ROP_OVERPAINT ) + SetRasterOp( eRasterOp ); + } + + if( mpAlphaVDev ) + mpAlphaVDev->Erase(); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |