diff options
| -rw-r--r-- | graphics/VectorRenderer.h | 5 | ||||
| -rw-r--r-- | graphics/VectorRendererSpec.cpp | 38 | ||||
| -rw-r--r-- | graphics/VectorRendererSpec.h | 1 | 
3 files changed, 42 insertions, 2 deletions
| diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h index 1ec28d7e51..5f1ff984ef 100644 --- a/graphics/VectorRenderer.h +++ b/graphics/VectorRenderer.h @@ -290,6 +290,7 @@ public:  	 * Defaults to using the active Foreground color for filling.  	 */  	virtual void fillSurface() = 0; +	virtual void fillSurfaceClip(Common::Rect clipping) = 0;  	/**  	 * Clears the active surface. @@ -394,8 +395,8 @@ public:  		drawRoundedSquareClip(x, y, stepGetRadius(step, area), w, h, clip);  	} -	void drawCallback_FILLSURFACE(const Common::Rect &area, const DrawStep &step, const Common::Rect &clip) { //TODO -		fillSurface(); +	void drawCallback_FILLSURFACE(const Common::Rect &area, const DrawStep &step, const Common::Rect &clip) { +		fillSurfaceClip(clip);  	}  	void drawCallback_TRIANGLE(const Common::Rect &area, const DrawStep &step, const Common::Rect &clip) { 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( diff --git a/graphics/VectorRendererSpec.h b/graphics/VectorRendererSpec.h index f084816660..61d58b3b2c 100644 --- a/graphics/VectorRendererSpec.h +++ b/graphics/VectorRendererSpec.h @@ -89,6 +89,7 @@ public:  	void copyWholeFrame(OSystem *sys) { copyFrame(sys, Common::Rect(0, 0, _activeSurface->w, _activeSurface->h)); }  	void fillSurface(); +	void fillSurfaceClip(Common::Rect clipping);  	void blitSurface(const Graphics::Surface *source, const Common::Rect &r);  	void blitSubSurface(const Graphics::Surface *source, const Common::Rect &r);  	void blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r); | 
