diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-17 03:45:23 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-17 03:45:23 +1000 |
commit | 948c4654f683e93b757f96e8859e9e91b45298a4 (patch) | |
tree | 9096d0352a384e7032ff80cd92207452f7e0cc88 /vcl | |
parent | bc3625fce46e3e4529b2eb7daabc5c66d7b1cbcc (diff) |
fdo#74702 Seperate ImplDrawGradientWallpaper and rename
I have made ImplDrawGradientWallpaper a virtual protected function as
Window needs to handle this differently to Printer and VirtualDevice
instances. I have also renamed it to DrawGradientWallpaper.
Change-Id: I529ed0a757cfcebb6fe06f3738219ec43272f657
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/outdev/wallpaper.cxx | 35 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 40 |
2 files changed, 47 insertions, 28 deletions
diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx index c53c1ecf6a39..d59d9f462caa 100644 --- a/vcl/source/outdev/wallpaper.cxx +++ b/vcl/source/outdev/wallpaper.cxx @@ -113,7 +113,7 @@ void OutputDevice::ImplDrawBitmapWallpaper( long nX, long nY, // background of bitmap? if( bDrawGradientBackground ) - ImplDrawGradientWallpaper( nX, nY, nWidth, nHeight, rWallpaper ); + DrawGradientWallpaper( nX, nY, nWidth, nHeight, rWallpaper ); else if( bDrawColorBackground && bTransparent ) { ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper ); @@ -301,43 +301,22 @@ void OutputDevice::ImplDrawBitmapWallpaper( long nX, long nY, mpMetaFile = pOldMetaFile; } -void OutputDevice::ImplDrawGradientWallpaper( long nX, long nY, - long nWidth, long nHeight, - const Wallpaper& rWallpaper ) +void OutputDevice::DrawGradientWallpaper( long nX, long nY, + long nWidth, long nHeight, + const Wallpaper& rWallpaper ) { Rectangle aBound; GDIMetaFile* pOldMetaFile = mpMetaFile; const bool bOldMap = mbMap; - bool bNeedGradient = true; - aBound = Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ); + aBound = Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ); mpMetaFile = NULL; EnableMapMode( false ); Push( PUSH_CLIPREGION ); IntersectClipRegion( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) ); - if( OUTDEV_WINDOW == meOutDevType && rWallpaper.GetStyle() == WALLPAPER_APPLICATIONGRADIENT ) - { - Window *pWin = dynamic_cast< Window* >( this ); - if( pWin ) - { - // limit gradient to useful size, so that it still can be noticed - // in maximized windows - long gradientWidth = pWin->GetDesktopRectPixel().GetSize().Width(); - if( gradientWidth > 1024 ) - gradientWidth = 1024; - if( mnOutOffX+nWidth > gradientWidth ) - ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper.GetGradient().GetEndColor() ); - if( mnOutOffX > gradientWidth ) - bNeedGradient = false; - else - aBound = Rectangle( Point( -mnOutOffX, nY ), Size( gradientWidth, nHeight ) ); - } - } - - if( bNeedGradient ) - DrawGradient( aBound, rWallpaper.GetGradient() ); + DrawGradient( aBound, rWallpaper.GetGradient() ); Pop(); EnableMapMode( bOldMap ); @@ -351,7 +330,7 @@ void OutputDevice::ImplDrawWallpaper( long nX, long nY, if( rWallpaper.IsBitmap() ) ImplDrawBitmapWallpaper( nX, nY, nWidth, nHeight, rWallpaper ); else if( rWallpaper.IsGradient() ) - ImplDrawGradientWallpaper( nX, nY, nWidth, nHeight, rWallpaper ); + DrawGradientWallpaper( nX, nY, nWidth, nHeight, rWallpaper ); else ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper ); } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 0f9833255867..0ef7a057b83d 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -9378,4 +9378,44 @@ bool Window::UsePolyPolygonForComplexGradient() return false; } +void Window::DrawGradientWallpaper( long nX, long nY, + long nWidth, long nHeight, + const Wallpaper& rWallpaper ) +{ + Rectangle aBound; + GDIMetaFile* pOldMetaFile = mpMetaFile; + const bool bOldMap = mbMap; + bool bNeedGradient = true; + + aBound = Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ); + + mpMetaFile = NULL; + EnableMapMode( false ); + Push( PUSH_CLIPREGION ); + IntersectClipRegion( Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) ) ); + + if( rWallpaper.GetStyle() == WALLPAPER_APPLICATIONGRADIENT ) + { + // limit gradient to useful size, so that it still can be noticed + // in maximized windows + long gradientWidth = GetDesktopRectPixel().GetSize().Width(); + if( gradientWidth > 1024 ) + gradientWidth = 1024; + if( mnOutOffX+nWidth > gradientWidth ) + ImplDrawColorWallpaper( nX, nY, nWidth, nHeight, rWallpaper.GetGradient().GetEndColor() ); + if( mnOutOffX > gradientWidth ) + bNeedGradient = false; + else + aBound = Rectangle( Point( -mnOutOffX, nY ), Size( gradientWidth, nHeight ) ); + } + + if( bNeedGradient ) + DrawGradient( aBound, rWallpaper.GetGradient() ); + + Pop(); + EnableMapMode( bOldMap ); + mpMetaFile = pOldMetaFile; +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |