CVSROOT:        /cvs/directfb
Module name:    DirectFB
Changes by:     dok     20010702 10:38:36

Modified files:
        include        : directfb.h 
        interfaces/IDirectFBVideoProvider: idirectfbvideoprovider_v4l.c 
        src            : directfb.c 
        src/core       : surfaces.h 
        src/display    : idirectfbdisplaylayer.c idirectfbsurface.c 
                         idirectfbsurface.h idirectfbsurface_layer.c 
                         idirectfbsurface_window.c 
        src/input      : idirectfbinputbuffer.c idirectfbinputdevice.c 
        src/media      : idirectfbfont.c 
        src/misc       : util.c util.h 
        src/windows    : idirectfbwindow.c 

Log message:
Fixed a very bad bug, don't use 'realloc()' on structures containing data you
already installed listeners for with a pointer to it as the context ;-)
Interface constructors no longer use 'realloc()' for 'thiz->priv' to store their
extra data, they do the (bigger) 'malloc()' themselves before calling the parent
constructor. Each interface constructor should check for 'thiz->priv == NULL',
if this is the case they should do the 'malloc()' and then call the parent
constructor if one exists.
This fixes nearly every possible bug, because listener functions wrote into
memory where there shouldn't.

New result code 'DFB_INVAREA' that is returned if a surface has no valid area
or a region or rectangle specified does not match, e.g. SetClip returns it if
the clipping region specified does not intersect with the current (sub) area.
It is also returned by the drawing and blitting functions if the source or the
destination has a current (sub) area of size 0x0. That can happen if the surface
is a sub surface, e.g. at x = 900 and y = 600, and the surface gets resized to
something below that.

Enhanced sub surface handling, there are three rectangles along with an
IDirectFBSurface, these are "wanted", "granted" and "current". The first one is
the rectangle passed to 'GetSubSurface()', it doesn't matter if it's too large
or has negative starting coordinates as long as it intersects with the "granted"
rectangle of the parent. The "wanted" rectangle should be seen as the origin for
operations on that surface. Non sub surfaces have a "wanted" rectangle of
'{ 0, 0, width, height }'. The second one, "granted", is the intersection of the
"wanted" rectangle and the "granted" one of the parent. If they do not intersect
'DFB_INVAREA' is returned. For non sub surfaces its the same as the "wanted"
rectangle, because it's the rectangle describing the whole surface. The "wanted"
and "granted" are calculated just once at creation, the "current" rectangle is
the intersection of the "granted" rectangle and the surface extents.
'SetClip()' and many other functions are limited by that one.
This way sub surface area information is preserved during surface resizing, e.g.
when resizing a window. Calling 'SetClip()' with NULL causes the clipping region
to exactly cover the "current" rectangle, also the flag 'clip_set' is cleared
causing the clipping region to be set to the new "current" after resizing. If
'SetClip()' is called with a clipping region specified, an intersection is done
with the "wanted" rectangle that is then stored in 'clip_wanted' and 'clip_set'
is set. However, if there is no intersection 'DFB_INVARG' is returned, otherwise
another intersection is made with the "current" rectangle and gets applied to
the surface's state. Each resize, after the "current" rectangle is updated, the
clipping region is set to NULL or 'clip_wanted' depending on 'clip_set'.
This way even clipping regions are restored or extended automatically.
It's now possible to create a fullscreen primary and call 'SetVideoMode()' with
different resolutions or pixelformats several times without the need for
"updating" the primary surface by recreating it ;)

So '->req_rect' is now replaced by '->area.wanted'
and '->clip_rect' is replaced by '->area.current' for the most cases.

'IDirectFBSurface->Lock()' now adds the "current" rectangle's offset to the base
address, so applications should use 'GetVisibleRectangle()' before writing into a
locked sub surface to get the offset from the "wanted" rectangle and the limits.
If there is no "current" rectangle 'DFB_INVAREA' is returned.

Added 'region_rectangle_intersect()' and did some minor optimizations.



-- 
Info:  To unsubscribe send a mail to [EMAIL PROTECTED] with 
"unsubscribe directfb-dev" as subject.

Reply via email to