scummvm/scummvm — pull request #271 by singron (2012-08-20 04:49:07+00:00)
Title: GSOC 2012 Scaler Plugins

This adds a more modular and robust way for adding and managing scalers as plugins.

Features:
* All scalers can be initialized to any PixelFormat as long as the corresponding Colormask was used to build it. This includes 4 byte-per-pixel formats
** (i.e. most scalers have a function that is templated over a few colormasks. New formats can be added with little code)
* Scalers report how far "off the screen" they read. For instance, for a given pixel `P`, 2xSAI reads all pixels in the source image marked `X`. It would report that it reads 2 extra pixels in any direction.

```
O|X|X|O
X|P|X|X
X|X|X|X
O|X|X|O
```
* PM2x and Edge2x/3x scalers are added.
* Normal4x and AdvMame4x are added.
* An optional extension to eliminate producing duplicate pixels is added. It is not mandatory for scalers or backends.
* Graphics managers deriving SurfaceSdlGraphicsManager can be less complicated since the code handles the enabled graphics modes by default.

Current Issues:
* Breaks some backends.
* Edge scalers have bad performance, especially in debug builds (although the extension can make it bearable).
* Downscaling and arbitrary scaling are not handled.

I've been playing around with subclassing SurfaceSdlGraphicsManager to handle 1/2 downscaling using some addCustomGraphicsMode member fuction. Let me know if you have any thought on this matter.