diff options
author | Alexander Tkachev | 2016-06-29 21:30:45 +0600 |
---|---|---|
committer | Eugene Sandulenko | 2016-07-03 12:23:12 +0200 |
commit | e636894b0653f9bf546bdec8768cabbf2606d2e5 (patch) | |
tree | c9f2cfbb6a2ab651885a556d49a3fe84d902e0d3 /graphics/VectorRendererSpec.cpp | |
parent | a39a6533c466e8de48eb367ffe78a162b069de54 (diff) | |
download | scummvm-rg350-e636894b0653f9bf546bdec8768cabbf2606d2e5.tar.gz scummvm-rg350-e636894b0653f9bf546bdec8768cabbf2606d2e5.tar.bz2 scummvm-rg350-e636894b0653f9bf546bdec8768cabbf2606d2e5.zip |
GUI: Add fillSurfaceClip()
Diffstat (limited to 'graphics/VectorRendererSpec.cpp')
-rw-r--r-- | graphics/VectorRendererSpec.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 9260728478..fd1f587c79 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -708,6 +708,44 @@ fillSurface() { template<typename PixelType> void VectorRendererSpec<PixelType>:: +fillSurfaceClip(Common::Rect clipping) { + int w = _activeSurface->w; + int h = _activeSurface->h; + if (clipping.isEmpty() || (clipping.left == 0 && clipping.top == 0 && clipping.right == w && clipping.bottom == h)) { + fillSurface(); + return; + } + + byte *ptr = (byte *)_activeSurface->getPixels(); + int pitch = _activeSurface->pitch; + + if (Base::_fillMode == kFillBackground || Base::_fillMode == kFillForeground) { + PixelType color = (Base::_fillMode == kFillBackground ? _bgColor : _fgColor); + byte *ptrLeft = (ptr + _clippingArea.left), *ptrRight = ptr + _clippingArea.right; + for (int i = 0; i < h; i++) { + if (_clippingArea.top <= i && i < _clippingArea.bottom) { + colorFill<PixelType>((PixelType *)ptrLeft, (PixelType *)ptrRight, color); + } + + ptrLeft += pitch; + ptrRight += pitch; + } + + } else if (Base::_fillMode == kFillGradient) { + precalcGradient(h); + + for (int i = 0; i < h; i++) { + if (_clippingArea.top <= i && i < _clippingArea.bottom) { + gradientFill((PixelType *)ptr + _clippingArea.left, _clippingArea.width(), 0, i); + } + + ptr += pitch; + } + } +} + +template<typename PixelType> +void VectorRendererSpec<PixelType>:: copyFrame(OSystem *sys, const Common::Rect &r) { sys->copyRectToOverlay( |