Merge from 0.8.0

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@14232 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-08-03 03:32:19 +00:00
parent 7bf0662f77
commit c910bb1351
10 changed files with 188 additions and 49 deletions

View file

@ -1,3 +1,27 @@
2002-08-02 Adam Fedor <fedor@gnu.org>
* Merge from 0.8.0 into main branch.
2002-08-01 Adam Fedor <fedor@gnu.org>
* Version: 0.8.0
* configure.ac: Check for usleep.
* Source/x11/XGServerWindow.m ([XGServer -windowdevice:]):
Use alternate if no usleep.
2002-07-28 Adam Fedor <fedor@gnu.org>
* Source/xlib/XGBitmap.m (_pixmap_combine_alpha): Use
interger arithmatic. (Patch from Jeff Teunissen)
2002-07-19 Adam Fedor <fedor@gnu.org>
* Source/xlib/XGGeometry.m (clipXRectsForCopying): Shift rect
origin to account for clipping.
* Source/xlib/XGGState.m (-setAlphaColor:): Correct colorspace
of alpha color.
2002-07-17 Adam Fedor <fedor@gnu.org>
* Version: 0.7.9
@ -11,7 +35,7 @@
* Source/xlib/XGBitmap.m (_pixmap_combine_alpha): Fix and
cleanup alpha blending (Rescale by alpha)
(_bitmap_combine_alpha): Idem. (Patch from deek@d2dc.net).
(_bitmap_combine_alpha): Idem. (Patch from Jeff Teunissen).
2002-06-28 Adam Fedor <fedor@gnu.org>

View file

@ -7,7 +7,7 @@
@include version.texi
@end ifset
@section Noteworthy changes in version @samp{0.7.9}
@section Noteworthy changes in version @samp{0.8.0}
Bug fixes.
@ -15,6 +15,10 @@ Bug fixes.
@c Keep the next line just below the list of changes in most recent version.
@ifclear ANNOUNCE-ONLY
@section Noteworthy changes in version @samp{0.7.9}
Bug fixes.
@section Noteworthy changes in version @samp{0.7.8}
Simplified backend selection using --enable-server and

View file

@ -538,7 +538,8 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
int x, y, width, height;
gswindow_device_t *window;
window = WINDOW_WITH_TAG(screen);
/* Screen number is negative to avoid conflict with windows */
window = WINDOW_WITH_TAG(-screen);
if (window)
return window;
@ -550,7 +551,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
window->ident = RootWindow(dpy, screen);
window->root = window->ident;
window->type = NSBackingStoreNonretained;
window->number = screen;
window->number = -screen;
window->map_state = IsViewable;
window->visibility = -1;
if (window->ident)
@ -1358,7 +1359,12 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
*/
if (height != window->siz_hints.height)
{
#if HAVE_USLEEP
usleep(1);
#else
for (x=0; x<10000; x++)
;
#endif
XGetGeometry(dpy, window->ident, &window->root,
&x, &y, &width, &height,
&window->border, &window->depth);

View file

@ -150,18 +150,18 @@ _pixmap_combine_alpha(RContext *context,
for (col = 0; col < srect.width; col++)
{
unsigned sr, sg, sb, sa; // source
unsigned dr, dg, db, da; // dest
double alpha, ialpha;
unsigned sr, sg, sb, sa; // source
unsigned dr, dg, db, da; // dest
unsigned ialpha;
// Get the source pixel information
pixel = XGetPixel (source_im->image, srect.x+col, srect.y+row);
PixelToRGB (pixel, sr, sg, sb);
pixel = XGetPixel(source_im->image, srect.x+col, srect.y+row);
PixelToRGB(pixel, sr, sg, sb);
if (source_alpha)
{
pixel = XGetPixel(source_alpha->image,
srect.x+col, srect.y+row);
pixel = XGetPixel(source_alpha->image,
srect.x + col, srect.y + row);
sa = (pixel >> _ashift) & _amask;
}
else
@ -173,30 +173,37 @@ _pixmap_combine_alpha(RContext *context,
if (fraction < 1.0)
sa *= fraction;
alpha = ((double) sa) / _amask;
sr *= sa;
sg *= sa;
sb *= sa;
ialpha = (_amask - sa);
// Now get dest pixel
pixel = XGetPixel(dest_im->image, col, row);
PixelToRGB (pixel, dr, dg, db);
pixel = XGetPixel(dest_im->image, col, row);
PixelToRGB(pixel, dr, dg, db);
dr *= ialpha;
dg *= ialpha;
db *= ialpha;
if (dest_alpha)
{
{
pixel = XGetPixel(dest_alpha->image, col, row);
da = (pixel >> _ashift) & _amask;
}
}
else // no alpha channel, background is opaque
da = _amask;
ialpha = (1.0 - alpha);
dr = (sr * alpha) + (dr * ialpha);
dg = (sg * alpha) + (dg * ialpha);
db = (sb * alpha) + (db * ialpha);
dr = (sr + dr) / _amask;
dg = (sg + dg) / _amask;
db = (sb + db) / _amask;
// calc final alpha
if (sa == _amask || da == _amask)
da = _amask;
else
da = sa + (da * ialpha);
da = sa + ((da * ialpha) / _amask);
CLAMP(dr);
CLAMP(dg);
@ -857,7 +864,7 @@ _bitmap_combine_alpha(RContext *context,
img.a = malloc(img.screen_w);
{
unsigned long pixel;
unsigned long pixel;
/* Two cases, the *_FAST* method, which
is covered in the first a part of the if
@ -911,24 +918,21 @@ _bitmap_combine_alpha(RContext *context,
unsigned short sg = (*gptr++ >> (8 - _gwidth));
unsigned short sb = (*bptr++ >> (8 - _bwidth));
unsigned short sa = (*aptr++ >> (8 - _awidth));
unsigned dr, dg, db, da;
double alpha = (double) sa / ((1 << _rwidth) - 1);
unsigned dr, dg, db, da; // dest
if (sa == 0) // dest wouldn't be changed
continue;
/*
* Unscale alpha value in each color component
*/
if (sa < _amask)
if (sa == _amask) // source only, don't bother with the rest
{
double multiplier = (double) _amask / sa;
sr *= multiplier;
sg *= multiplier;
sb *= multiplier;
// Yes, this is duplicated code -- but it's worth it.
RGBToPixel(sr, sg, sb, pixel);
XPutPixel(dest_im->image, col, row, pixel);
if (dest_alpha)
XPutPixel(dest_alpha->image, col, row, sa << _ashift);
continue;
}
// get the destination pixel
pixel = XGetPixel(dest_im->image, col, row);
PixelToRGB(pixel, dr, dg, db);
@ -940,24 +944,28 @@ _bitmap_combine_alpha(RContext *context,
}
else // no alpha channel, background is opaque
da = _amask;
if (sa == _amask || da == 0) // source only
{
dr = sr;
dg = sg;
db = sb;
if (da == 0)
{
/*
* Unscale the colors
*/
dr = (sr * _amask) / sa;
dg = (sg * _amask) / sa;
db = (sb * _amask) / sa;
da = sa;
}
else
{
double ialpha = (1.0 - alpha);
dr = (sr * alpha) + (dr * ialpha);
dg = (sg * alpha) + (dg * ialpha);
db = (sb * alpha) + (db * ialpha);
unsigned ialpha = _amask - sa;
dr = (sr * sa + (dr * ialpha)) / _amask;
dg = (sg * sa + (dg * ialpha)) / _amask;
db = (sb * sa + (db * ialpha)) / _amask;
if (da == _amask || da == _amask)
da = _amask;
else
da = sa + (da * ialpha);
da = sa + ((da * ialpha) / _amask);
}
CLAMP(dr);

View file

@ -260,7 +260,7 @@ static Region emptyRegion;
/* Window device isn't set yet */
return;
}
color = gsMakeColor(gray_colorspace, value, 0, 0, 0);
color = gsMakeColor(rgb_colorspace, value, value, value, 0);
gcv.foreground = xrRGBToPixel(context, color);
if (agcntxt == None)
agcntxt = XCreateGC(XDPY, draw, GCForeground, &gcv);

View file

@ -117,14 +117,23 @@ void
clipXRectsForCopying (gswindow_device_t* winA, XRectangle* rectA,
gswindow_device_t* winB, XRectangle* rectB)
{
XPoint shiftA, shiftB;
// First make A smaller.
shiftA.x = rectA->x;
shiftA.y = rectA->y;
*rectA = XGIntersectionRect (*rectA, accessibleRectForWindow (winA));
// update size of B with the size of A
rectB->x += rectA->x - shiftA.x;
rectB->y += rectA->y - shiftA.y;
rectB->width = MIN (rectA->width, rectB->width);
rectB->height = MIN (rectA->height, rectB->height);
// now make B smaller
shiftB.x = rectB->x;
shiftB.y = rectB->y;
*rectB = XGIntersectionRect (*rectB, accessibleRectForWindow (winB));
// and update size of A with size of B
rectA->x += rectB->x - shiftB.x;
rectA->y += rectB->y - shiftB.y;
rectA->width = rectB->width;
rectA->height = rectB->height;
}

View file

@ -3,8 +3,8 @@
# The version number of this release.
GNUSTEP_BACK_MAJOR_VERSION=0
GNUSTEP_BACK_MINOR_VERSION=7
GNUSTEP_BACK_SUBMINOR_VERSION=9
GNUSTEP_BACK_MINOR_VERSION=8
GNUSTEP_BACK_SUBMINOR_VERSION=0
GNUSTEP_BACK_VERSION=${GNUSTEP_BACK_MAJOR_VERSION}.${GNUSTEP_BACK_MINOR_VERSION}.${GNUSTEP_BACK_SUBMINOR_VERSION}
VERSION=${GNUSTEP_BACK_VERSION}

View file

@ -44,6 +44,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP
/* Define if you have XftDrawStringUtf8 */
#undef HAVE_UTF8

80
configure vendored
View file

@ -4461,6 +4461,86 @@ _ACEOF
fi
#--------------------------------------------------------------------
# Functions
#--------------------------------------------------------------------
for ac_func in usleep
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func ();
char (*f) ();
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
f = $ac_func;
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
#--------------------------------------------------------------------
# Find for JPEG
#--------------------------------------------------------------------

View file

@ -195,6 +195,11 @@ if test "x$enable_xim" = "xyes"; then
AC_DEFINE(USE_XIM,1,[Define to enable XIM support])
fi
#--------------------------------------------------------------------
# Functions
#--------------------------------------------------------------------
AC_HAVE_FUNCS(usleep)
#--------------------------------------------------------------------
# Find for JPEG
#--------------------------------------------------------------------