API change proposal

Hi

No one replied to my mail with subject “[SDL] SDL_DisplayYUVOverlay, source
rectangle”. I believe the problam stated in that mail can’t be solved with the
current API of SDL. (Please correct me if I am wrong.) I therefore propose that
a new function is added to the public SDL API.

(It should probably have some other name.)
int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *srcrect,
SDL_Rect *dstrect);

Description

Blit the overlay to the surface specified when it was created. The SDL_Rect
structure, dstrect, specifies the position and size of the destination. If the
dstrect is a larger or smaller than srcrect then the overlay will be scaled,
this is optimized for 2x scaling. srcrect specifies the rectangle of overlay
which will be displayed on the surface. If srcrect is NULL the entire overlay
will be displayed.

Return Values

Returns 0 on success

The introduction of this new function can be done in a few different ways.

  1. Give the new function a new name and optionally mark the old function as
    deprecated.

  2. Remove the old function and have the new one instead. Results in source
    incompability.

  3. Use some C99 variadic macro hacks to be able to let both functions have the
    same name.

1 is probably the best way to go. 3 is quite nice in IMHO but I don’t know how
well C99 is implemented on all the platforms. I don’t like 2. If we go with 1
we need a new name, suggestions?

What do you think about this? Is it a good idea? Any chance that it will be
included in SDL?

I can make a patch which implements this if people think it is a good idea and
there is any possibility that it may be included in SDL.

/ Fredrik Kuivinen

What do you think about this? Is it a good idea? Any chance that it will be
included in SDL?

I can make a patch which implements this if people think it is a good idea and
there is any possibility that it may be included in SDL.

Go ahead and make a patch. It will not go into SDL 1.2, which is API frozen,
but will be considered for SDL 1.3

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment