projects
/
dana
/
xcompmgr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
54fb13f
)
Use an alpha map instead of an ARGB picture for shadows. Update last_update
author
Keith Packard
<keithp@keithp.com>
Thu, 13 Nov 2003 09:16:18 +0000
(09:16 +0000)
committer
Keith Packard
<keithp@keithp.com>
Thu, 13 Nov 2003 09:16:18 +0000
(09:16 +0000)
only when actually updating windows.
ChangeLog
patch
|
blob
|
history
xcompmgr.c
patch
|
blob
|
history
diff --git
a/ChangeLog
b/ChangeLog
index
59ebf22
..
3b2f8ef
100644
(file)
--- a/
ChangeLog
+++ b/
ChangeLog
@@
-1,3
+1,10
@@
+2003-11-13 Keith Packard <keithp@keithp.com>
+
+ * xcompmgr.c: (make_gaussian_map), (sum_gaussian), (make_shadow),
+ (shadow_picture), (paint_all), (main):
+ Use an alpha map instead of an ARGB picture for shadows.
+ Update last_update only when actually updating windows.
+
2003-11-11 Keith Packard <keithp@keithp.com>
* xcompmgr.c: (win_extents), (paint_all), (add_win), (main):
2003-11-11 Keith Packard <keithp@keithp.com>
* xcompmgr.c: (win_extents), (paint_all), (add_win), (main):
diff --git
a/xcompmgr.c
b/xcompmgr.c
index
e06d08c
..
20b4466
100644
(file)
--- a/
xcompmgr.c
+++ b/
xcompmgr.c
@@
-61,6
+61,7
@@
Window root;
Picture rootPicture;
Picture rootBuffer;
Picture transPicture;
Picture rootPicture;
Picture rootBuffer;
Picture transPicture;
+Picture blackPicture;
Picture rootTile;
XserverRegion allDamage;
int root_height, root_width;
Picture rootTile;
XserverRegion allDamage;
int root_height, root_width;
@@
-110,7
+111,7
@@
make_gaussian_map (Display *dpy, double r)
t += g;
c->data[y * size + x] = g;
}
t += g;
c->data[y * size + x] = g;
}
- printf ("gaussian total %f\n", t);
+/* printf ("gaussian total %f\n", t); */
for (y = 0; y < size; y++)
for (x = 0; x < size; x++)
{
for (y = 0; y < size; y++)
for (x = 0; x < size; x++)
{
@@
-136,7
+137,7
@@
make_gaussian_map (Display *dpy, double r)
* center +-----+-------------------+-----+
*/
* center +-----+-------------------+-----+
*/
-unsigned
int
+unsigned
char
sum_gaussian (conv *map, double opacity, int x, int y, int width, int height)
{
int fx, fy;
sum_gaussian (conv *map, double opacity, int x, int y, int width, int height)
{
int fx, fy;
@@
-187,7
+188,7
@@
sum_gaussian (conv *map, double opacity, int x, int y, int width, int height)
if (v > 1)
v = 1;
if (v > 1)
v = 1;
- return ((unsigned int) (v * opacity * 255.0))
<< 24
;
+ return ((unsigned int) (v * opacity * 255.0));
}
XImage *
}
XImage *
@@
-196,7
+197,7
@@
make_shadow (Display *dpy, double opacity, double r, int width, int height)
conv *map = make_gaussian_map (dpy, r);
XImage *ximage;
double *gdata = map->data;
conv *map = make_gaussian_map (dpy, r);
XImage *ximage;
double *gdata = map->data;
- unsigned
int
*data;
+ unsigned
char
*data;
int gsize = map->size;
int ylimit, xlimit;
int swidth = width + gsize;
int gsize = map->size;
int ylimit, xlimit;
int swidth = width + gsize;
@@
-205,18
+206,18
@@
make_shadow (Display *dpy, double opacity, double r, int width, int height)
int x, y;
int fx, fy;
int sx, sy;
int x, y;
int fx, fy;
int sx, sy;
- unsigned
int
d;
+ unsigned
char
d;
double v;
unsigned char c;
double v;
unsigned char c;
- data = malloc (swidth * sheight * sizeof (
int
));
+ data = malloc (swidth * sheight * sizeof (
unsigned char
));
ximage = XCreateImage (dpy,
DefaultVisual(dpy, DefaultScreen(dpy)),
ximage = XCreateImage (dpy,
DefaultVisual(dpy, DefaultScreen(dpy)),
-
32
,
+
8
,
ZPixmap,
0,
(char *) data,
ZPixmap,
0,
(char *) data,
- swidth, sheight,
32, swidth * sizeof (int
));
+ swidth, sheight,
8, swidth * sizeof (unsigned char
));
/*
* Build the gaussian in sections
*/
/*
* Build the gaussian in sections
*/
@@
-288,9
+289,9
@@
shadow_picture (Display *dpy, double opacity, double r, int width, int height, i
Pixmap shadowPixmap = XCreatePixmap (dpy, root,
shadowImage->width,
shadowImage->height,
Pixmap shadowPixmap = XCreatePixmap (dpy, root,
shadowImage->width,
shadowImage->height,
-
32
);
+
8
);
Picture shadowPicture = XRenderCreatePicture (dpy, shadowPixmap,
Picture shadowPicture = XRenderCreatePicture (dpy, shadowPixmap,
- XRenderFindStandardFormat (dpy, PictStandardA
RGB32
),
+ XRenderFindStandardFormat (dpy, PictStandardA
8
),
0, 0);
GC gc = XCreateGC (dpy, shadowPixmap, 0, 0);
0, 0);
GC gc = XCreateGC (dpy, shadowPixmap, 0, 0);
@@
-478,7
+479,7
@@
paint_all (Display *dpy, XserverRegion region)
XFixesSetPictureClipRegion (dpy, rootBuffer, 0, 0, w->borderClip);
if (w->shadow)
{
XFixesSetPictureClipRegion (dpy, rootBuffer, 0, 0, w->borderClip);
if (w->shadow)
{
- XRenderComposite (dpy, PictOpOver,
w->shadow, None
, rootBuffer,
+ XRenderComposite (dpy, PictOpOver,
blackPicture, w->shadow
, rootBuffer,
0, 0, 0, 0,
w->a.x + w->a.border_width + w->shadow_dx,
w->a.y + w->a.border_width + w->shadow_dy,
0, 0, 0, 0,
w->a.x + w->a.border_width + w->shadow_dx,
w->a.y + w->a.border_width + w->shadow_dy,
@@
-776,6
+777,7
@@
main ()
Window root_return, parent_return;
Window *children;
Pixmap transPixmap;
Window root_return, parent_return;
Window *children;
Pixmap transPixmap;
+ Pixmap blackPixmap;
unsigned int nchildren;
int i;
int damage_event, damage_error;
unsigned int nchildren;
int i;
int damage_event, damage_error;
@@
-820,6
+822,15
@@
main ()
DefaultVisual (dpy, scr)),
CPSubwindowMode,
&pa);
DefaultVisual (dpy, scr)),
CPSubwindowMode,
&pa);
+ blackPixmap = XCreatePixmap (dpy, root, 1, 1, 32);
+ pa.repeat = True;
+ blackPicture = XRenderCreatePicture (dpy, blackPixmap,
+ XRenderFindStandardFormat (dpy, PictStandardARGB32),
+ CPRepeat,
+ &pa);
+ c.red = c.green = c.blue = 0;
+ c.alpha = 0xffff;
+ XRenderFillRectangle (dpy, PictOpSrc, blackPicture, &c, 0, 0, 1, 1);
if (!XCompositeQueryExtension (dpy, &event_base, &error_base))
{
fprintf (stderr, "No composite extension\n");
if (!XCompositeQueryExtension (dpy, &event_base, &error_base))
{
fprintf (stderr, "No composite extension\n");
@@
-855,9
+866,12
@@
main ()
last_update = time_in_millis ();
for (;;)
{
last_update = time_in_millis ();
for (;;)
{
+ int busy_start = 0;
/* dump_wins (); */
do {
XNextEvent (dpy, &ev);
/* dump_wins (); */
do {
XNextEvent (dpy, &ev);
+ if (!busy_start)
+ busy_start = time_in_millis();
/* printf ("event %d\n", ev.type); */
switch (ev.type) {
case CreateNotify:
/* printf ("event %d\n", ev.type); */
switch (ev.type) {
case CreateNotify:
@@
-930,6
+944,7
@@
main ()
}
} while (XEventsQueued (dpy, QueuedAfterReading));
now = time_in_millis ();
}
} while (XEventsQueued (dpy, QueuedAfterReading));
now = time_in_millis ();
+/* printf ("\t\tbusy %d\n", now - busy_start); */
timeout = INTERVAL - (now - last_update);
if (timeout > 0)
{
timeout = INTERVAL - (now - last_update);
if (timeout > 0)
{
@@
-939,9
+954,11
@@
main ()
if (n > 0 && (ufd.revents & POLLIN) && XEventsQueued (dpy, QueuedAfterReading))
continue;
}
if (n > 0 && (ufd.revents & POLLIN) && XEventsQueued (dpy, QueuedAfterReading))
continue;
}
- last_update = time_in_millis();
if (allDamage)
{
if (allDamage)
{
+ int old_update = last_update;
+ last_update = time_in_millis();
+/* printf ("delta %d\n", last_update - old_update); */
paint_all (dpy, allDamage);
allDamage = None;
}
paint_all (dpy, allDamage);
allDamage = None;
}