diff options
author | Søren Sandmann <sandmann@redhat.com> | 2005-01-14 04:35:03 +0000 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@src.gnome.org> | 2005-01-14 04:35:03 +0000 |
commit | 0736eb1733f155276ba1e7b3c0a4e16a31f16e24 (patch) | |
tree | 237186d98de035df30b3004d3c95d8da2fa7cdc8 | |
parent | d2b764dde505a099a05cf3a2446c5ed53b465ea3 (diff) | |
download | metacity-0736eb1733f155276ba1e7b3c0a4e16a31f16e24.tar.gz |
Some drawing fixes
Thu Jan 13 23:31:31 2005 Søren Sandmann <sandmann@redhat.com>
* src/cwindow.c (cwindow_new_draw): Some drawing fixes
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/cwindow.c | 124 |
2 files changed, 71 insertions, 57 deletions
@@ -1,3 +1,7 @@ +Thu Jan 13 23:31:31 2005 Søren Sandmann <sandmann@redhat.com> + + * src/cwindow.c (cwindow_new_draw): Some drawing fixes + Thu Jan 13 18:43:17 2005 Søren Sandmann <sandmann@redhat.com> * Initial check-in of changes to compositing manager. New files: diff --git a/src/cwindow.c b/src/cwindow.c index 6d4020ab..3c9c259c 100644 --- a/src/cwindow.c +++ b/src/cwindow.c @@ -817,10 +817,17 @@ cwindow_set_transformation (CWindow *cwindow, int n_distortions) { if (cwindow->distortions) - g_free (cwindow->distortions); + { + g_free (cwindow->distortions); + cwindow->distortions = NULL; + cwindow->n_distortions = 0; + } - cwindow->distortions = g_memdup (distortions, n_distortions * sizeof (Distortion)); - cwindow->n_distortions = n_distortions; + if (n_distortions) + { + cwindow->distortions = g_memdup (distortions, n_distortions * sizeof (Distortion)); + cwindow->n_distortions = n_distortions; + } } void @@ -828,6 +835,8 @@ cwindow_new_draw (CWindow *cwindow, Picture destination, XserverRegion damaged_r { XRenderPictFormat *format; int i; + Picture picture; + XRenderPictureAttributes pa; if (cwindow_get_input_only (cwindow)) return; @@ -837,66 +846,67 @@ cwindow_new_draw (CWindow *cwindow, Picture destination, XserverRegion damaged_r format = XRenderFindVisualFormat (cwindow_get_xdisplay (cwindow), cwindow_get_visual (cwindow)); - - for (i = 0; i < cwindow->n_distortions; ++i) + + pa.subwindow_mode = IncludeInferiors; + picture = XRenderCreatePicture (cwindow_get_xdisplay (cwindow), + cwindow_get_drawable (cwindow), + format, + CPSubwindowMode, + &pa); + + if (cwindow->n_distortions) { - XTransform transform; - Picture picture; - XRenderPictureAttributes pa; - - Distortion *dist = &cwindow->distortions[i]; - compute_transform (dist->source.x, - dist->source.y, - dist->source.width, dist->source.height, - &dist->destination, &transform); - - /* Draw window */ - pa.subwindow_mode = IncludeInferiors; - picture = XRenderCreatePicture (cwindow_get_xdisplay (cwindow), - cwindow_get_drawable (cwindow), - format, - CPSubwindowMode, - &pa); + for (i = 0; i < cwindow->n_distortions; ++i) + { + XTransform transform; + + Distortion *dist = &cwindow->distortions[i]; + compute_transform (dist->source.x, + dist->source.y, + dist->source.width, dist->source.height, + &dist->destination, &transform); + + /* Draw window */ + XRenderSetPictureTransform (cwindow_get_xdisplay (cwindow), picture, &transform); + XRenderSetPictureFilter (cwindow_get_xdisplay (cwindow), picture, "bilinear", 0, 0); + + XRenderComposite (cwindow_get_xdisplay (cwindow), + PictOpOver, /* PictOpOver for alpha, PictOpSrc without */ + picture, + cwindow_get_screen (cwindow)->trans_picture, + destination, + dist->source.x, dist->source.y, + 0, 0, + bbox (&dist->destination).x, bbox (&dist->destination).y, + bbox (&dist->destination).width, bbox (&dist->destination).height); + } + } + else + { + int x, y, w, h; + XRenderColor shadow_color = { 0x0000, 0x000, 0x0000, 0x70c0 }; - XRenderSetPictureTransform (cwindow_get_xdisplay (cwindow), picture, &transform); - XRenderSetPictureFilter (cwindow_get_xdisplay (cwindow), picture, "bilinear", 0, 0); + cwindow_get_paint_bounds (cwindow, &x, &y, &w, &h); + + /* superlame drop shadow */ +#if 0 + XRenderFillRectangle (cwindow_get_xdisplay (cwindow), PictOpOver, + picture, + &shadow_color, + cwindow_get_x (cwindow) + SHADOW_OFFSET, + cwindow_get_y (cwindow) + SHADOW_OFFSET, + cwindow_get_width (cwindow), + cwindow_get_height (cwindow)); +#endif XRenderComposite (cwindow_get_xdisplay (cwindow), PictOpOver, /* PictOpOver for alpha, PictOpSrc without */ picture, - cwindow_get_screen (cwindow)->trans_picture, + None, destination, - dist->source.x, dist->source.y, - 0, 0, - bbox (&dist->destination).x, bbox (&dist->destination).y, - bbox (&dist->destination).width, bbox (&dist->destination).height); - - { - int j = i + 2; - XRenderColor hilit_color = { (j / 10.0) * 0x0000, 0, (j / 10.0) * 0x9999, (j / 10.0) * 0xFFFF } ; - -#if 0 - XRenderFillRectangle (cwindow_get_xdisplay (cwindow), PictOpOver, - destination, - &hilit_color, - bbox (&dist->destination).x, bbox (&dist->destination).y, - bbox (&dist->destination).width, bbox (&dist->destination).height); -#endif - -#if 0 - g_print ("destination (%d %d) (%d %d) (%d %d) (%d %d)\n", - dist->destination.points[0].x, dist->destination.points[0].y, - dist->destination.points[1].x, dist->destination.points[1].y, - dist->destination.points[2].x, dist->destination.points[2].y, - dist->destination.points[3].x, dist->destination.points[3].y); - - g_print ("filling: %d %d %d %d\n", - bbox (&dist->destination).x, bbox (&dist->destination).y, - bbox (&dist->destination).width, bbox (&dist->destination).height); -#endif - - } - - XRenderFreePicture (cwindow_get_xdisplay (cwindow), picture); + 0, 0, 0, 0, + x, y, w, h); } + + XRenderFreePicture (cwindow_get_xdisplay (cwindow), picture); } |