29 May 2012

Scaler Plugin WIP

I have a functioning proof-of-concept implementation for the new scaler plugin system. It has some hacks for now to make it easier to prototype. Also it is missing GUI features and ignores configuration settings.

The benefits are really starting to show. Adding new plugins is really easy and takes no additional configuration from the sdl backend. Also, I have made small changes to the DotMatrix scaler to take advantage of the coordinates passed from the backend. Now it does not change the surrounding pixels when the mouse is moving.

If you want to try it out, my code is on github. "Ctrl alt +" and "ctrl alt -" increase and decrease the size (as usual) but "ctrl alt [" and "ctrl alt ]" cycle through the different scalers.

24 May 2012

New Scaler API

This new api  attempts to solve problems with the old scalers that were difficult to fix without a full redesign. I'll give an overview.

void initialize(Graphics::PixelFormat format) 
  • This is called before each scaler is used so that it knows what the pixel format is.
  • Generating RGBYUV tables and other precomputed data should happen here.
int increaseFactor() 
int decreaseFactor() 
int getFactor()
int setFactor() // For loading from configuration
Common::Array<int> getFactors() // For displaying in GUI
  • These give easy ways for setting and manipulating the scale factor.
  • These functions always return a valid scale factor so mapping these functions to hotkeys is simple.
  • Also this allows different sized versions of the same scaler to be included in the same plugin.
 bool canDrawCursor()
  • Some scalers are not suitable for scaling the cursor since they blur the image.
  • Since the cursor is not always scaled the same way as the background and can use a 1.5x scaler, the mouse scaling needs extra thought. If you have good ideas for this, leave a message or otherwise contact me.
int extraPixels()
  • Since some scalers look at surrounding pixels outside of the area to be scaled, the rects to be scaled need to be expanded, and the surface needs to be extended to prevent memory access errors.

void scale(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32  dstPitch, int width, int height, int x, int y)
  •  This is the scaling function similar to what is currently used.
  • The addition of x and y coordinates allows position sensitive scalers like TV and DotMatrix to produce consistant results.
A couple changes could possibly be made.

void transform(Rect *dirty)
  • Instead of extraPixels(), this function changes a dirty Rect so that it will behave properly when passed to a scale function.  The backend can change this afterward in case the Rect was expanded off the edge of the surface (or possibly the dimensions of the surface can be given as well).
The same Rect struct could be passed to the scale function as well.

Currently I am working on proof of concept implementations try out some of these ideas and decide what to put in the final version. If you have suggestions please leave comments or message me.

EDIT: Also there is a deinitialize function. It's self explanatory.




01 May 2012

Hello ScummVM!

My name is Eric Culp (a.k.a. singron). I'll be working on the scaler plugins project.

I'm very excited to work on a project like this. If you have questions, comments, or witty insults, you can leave them as comments on this blog or catch me on irc. Relevant links to to github will be in the sidebar.