summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@l3000.localdomain>2011-12-10 07:06:07 -0500
committerSøren Sandmann Pedersen <ssp@l3000.localdomain>2011-12-10 07:06:07 -0500
commit85b6c59943f141d586027d32d74cd6bee48cbd4d (patch)
tree9c1fa096a70870ca89206a2ea413f98838b9471d
parentbf0ad74099e7001c3ad5c222fffbf0bf51d577fd (diff)
Make sure valid region is confined to the backing store
-rw-r--r--main.c13
-rw-r--r--window.c19
2 files changed, 18 insertions, 14 deletions
diff --git a/main.c b/main.c
index e73aba1..c3fc131 100644
--- a/main.c
+++ b/main.c
@@ -9,14 +9,13 @@ repaint (window_t *window)
{
pixman_color_t color = { 0xffff, 0xabcd, 0x7777, 0xaaaa };
pixman_color_t bg = { 0x0, 0x0, 0x0, 0xffff };
+ pixman_color_t blue = { 0xaaaa, 0xaaaa, 0xffff, 0xffff };
pixman_point_fixed_t p1 = { 0, 0 };
pixman_point_fixed_t p2 = { 0, 0 };
- pixman_gradient_stop_t stops[3] =
- {
- { pixman_int_to_fixed (0), { 0x2222, 0x2222, 0xeeee, 0xeeee } },
- { pixman_double_to_fixed (0.5), { 0xdddd, 0xdddd, 0x0000, 0xdddd } },
- { pixman_int_to_fixed (1), { 0xffff, 0x1111, 0x1111, 0xdddd } }
- };
+ pixman_gradient_stop_t stops[3] = {
+ { pixman_int_to_fixed (0), { 0x0000, 0x0000, 0x0000, 0xeeee } },
+ { pixman_int_to_fixed (1), { 0x6666, 0x2222, 0x2222, 0xeeee } }
+ };
pixman_image_t *image;
int w, h;
@@ -33,7 +32,7 @@ repaint (window_t *window)
pixman_image_unref (image);
p2.x = w << 16;
- p2.y = h << 16;
+ p2.y = 0; // h << 16;
image = pixman_image_create_linear_gradient (&p1, &p2, stops, 3);
ws_window_copy_from_image (window, image, 0, 0, 0, 0, w, h);
pixman_image_unref (image);
diff --git a/window.c b/window.c
index 436a26b..6ac821c 100644
--- a/window.c
+++ b/window.c
@@ -288,12 +288,7 @@ copy_backing_store_to_window (window_t *window,
XGCValues values;
GC gc;
-#if 0
- /* This assertion triggers, but ideally it shouldn't FIXME find
- * out why.
- */
assert (width <= pixman_image_get_width (window->backing_store));
-#endif
format_to_masks (format, &a, &r, &g, &b);
@@ -856,12 +851,16 @@ ws_window_copy_area (window_t *window,
pixman_region32_t moving_valid;
pixman_region32_t dest;
- pixman_region32_init_rect (&moving_valid, src_x, src_y, width, height);
- pixman_region32_intersect (&moving_valid, &moving_valid, &window->valid);
+ pixman_region32_init (&moving_valid);
+ pixman_region32_intersect_rect (&moving_valid, &window->valid,
+ src_x, src_y, width, height);
pixman_region32_translate (&moving_valid, dst_x - src_x, dst_y - src_y);
pixman_region32_init_rect (&dest, dst_x, dst_y, width, height);
pixman_region32_subtract (&dest, &window->valid, &dest);
pixman_region32_union (&window->valid, &dest, &moving_valid);
+ pixman_region32_intersect_rect (&moving_valid, &moving_valid,
+ 0, 0, get_width (window),
+ get_height (window));
pixman_region32_fini (&moving_valid);
pixman_region32_fini (&dest);
@@ -883,14 +882,20 @@ ws_window_copy_from_image (window_t *window,
int width,
int height)
{
+ uint32_t *data;
+
pixman_region32_union_rect (
&window->valid, &window->valid, win_x, win_y, width, height);
+ pixman_region32_intersect_rect (
+ &window->valid, &window->valid, 0, 0, get_width (window), get_height (window));
/* copy from image to backing */
pixman_image_composite32 (PIXMAN_OP_SRC,
image, NULL, window->backing_store,
image_x, image_y, 0, 0, win_x, win_y,
width, height);
+
+ data = pixman_image_get_data (window->backing_store);
}
void