Index: uspace/lib/memgfx/test/memgfx.c
===================================================================
--- uspace/lib/memgfx/test/memgfx.c	(revision cea9f0cdb1a2d2752bc931602d11342eb862c44e)
+++ uspace/lib/memgfx/test/memgfx.c	(revision f8375f741d0ccd376851c593af6a16c2591aa927)
@@ -34,4 +34,5 @@
 #include <gfx/render.h>
 #include <io/pixelmap.h>
+#include <mem.h>
 #include <memgfx/memgc.h>
 #include <pcut/pcut.h>
@@ -40,4 +41,13 @@
 
 PCUT_TEST_SUITE(memgfx);
+
+static void test_update_rect(void *arg, gfx_rect_t *rect);
+
+typedef struct {
+	/** True if update was called */
+	bool update_called;
+	/** Update rectangle */
+	gfx_rect_t rect;
+} test_update_t;
 
 /** Test creating and deleting a memory GC */
@@ -59,5 +69,5 @@
 	PCUT_ASSERT_NOT_NULL(alloc.pixels);
 
-	rc = mem_gc_create(&rect, &alloc, &mgc);
+	rc = mem_gc_create(&rect, &alloc, NULL, NULL, &mgc);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -72,5 +82,4 @@
 	gfx_rect_t rect;
 	gfx_rect_t frect;
-	gfx_rect_t urect;
 	gfx_bitmap_alloc_t alloc;
 	gfx_context_t *gc;
@@ -80,4 +89,5 @@
 	pixel_t pixel;
 	pixel_t expected;
+	test_update_t update;
 	errno_t rc;
 
@@ -93,5 +103,5 @@
 	PCUT_ASSERT_NOT_NULL(alloc.pixels);
 
-	rc = mem_gc_create(&rect, &alloc, &mgc);
+	rc = mem_gc_create(&rect, &alloc, test_update_rect, &update, &mgc);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -111,4 +121,6 @@
 	frect.p1.x = 5;
 	frect.p1.y = 5;
+
+	memset(&update, 0, sizeof(update));
 
 	rc = gfx_fill_rect(gc, &frect);
@@ -130,14 +142,9 @@
 
 	/* Check that the update rect is equal to the filled rect */
-	mem_gc_get_update_rect(mgc, &urect);
-	PCUT_ASSERT_INT_EQUALS(frect.p0.x, urect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(frect.p0.y, urect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(frect.p1.x, urect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(frect.p1.y, urect.p1.y);
-
-	/* Check that mem_gc_clear_update_rect() clears the update rect */
-	mem_gc_clear_update_rect(mgc);
-	mem_gc_get_update_rect(mgc, &urect);
-	PCUT_ASSERT_TRUE(gfx_rect_is_empty(&urect));
+	PCUT_ASSERT_TRUE(update.update_called);
+	PCUT_ASSERT_INT_EQUALS(frect.p0.x, update.rect.p0.x);
+	PCUT_ASSERT_INT_EQUALS(frect.p0.y, update.rect.p0.y);
+	PCUT_ASSERT_INT_EQUALS(frect.p1.x, update.rect.p1.x);
+	PCUT_ASSERT_INT_EQUALS(frect.p1.y, update.rect.p1.y);
 
 	/* TODO: Check clipping once memgc can support pitch != width etc. */
@@ -152,5 +159,4 @@
 	mem_gc_t *mgc;
 	gfx_rect_t rect;
-	gfx_rect_t urect;
 	gfx_bitmap_alloc_t alloc;
 	gfx_context_t *gc;
@@ -163,4 +169,5 @@
 	pixel_t pixel;
 	pixel_t expected;
+	test_update_t update;
 	errno_t rc;
 
@@ -176,5 +183,5 @@
 	PCUT_ASSERT_NOT_NULL(alloc.pixels);
 
-	rc = mem_gc_create(&rect, &alloc, &mgc);
+	rc = mem_gc_create(&rect, &alloc, test_update_rect, &update, &mgc);
 	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
 
@@ -211,4 +218,6 @@
 	dpmap.height = rect.p1.y - rect.p0.y;
 	dpmap.data = alloc.pixels;
+
+	memset(&update, 0, sizeof(update));
 
 	/* Render the bitmap */
@@ -229,14 +238,9 @@
 
 	/* Check that the update rect is equal to the filled rect */
-	mem_gc_get_update_rect(mgc, &urect);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.x, urect.p0.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p0.y, urect.p0.y);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.x, urect.p1.x);
-	PCUT_ASSERT_INT_EQUALS(params.rect.p1.y, urect.p1.y);
-
-	/* Check that mem_gc_clear_update_rect() clears the update rect */
-	mem_gc_clear_update_rect(mgc);
-	mem_gc_get_update_rect(mgc, &urect);
-	PCUT_ASSERT_TRUE(gfx_rect_is_empty(&urect));
+	PCUT_ASSERT_TRUE(update.update_called);
+	PCUT_ASSERT_INT_EQUALS(params.rect.p0.x, update.rect.p0.x);
+	PCUT_ASSERT_INT_EQUALS(params.rect.p0.y, update.rect.p0.y);
+	PCUT_ASSERT_INT_EQUALS(params.rect.p1.x, update.rect.p1.x);
+	PCUT_ASSERT_INT_EQUALS(params.rect.p1.y, update.rect.p1.y);
 
 	/* TODO: Check clipping once memgc can support pitch != width etc. */
@@ -246,3 +250,12 @@
 }
 
+/** Called by memory GC when a rectangle is updated. */
+static void test_update_rect(void *arg, gfx_rect_t *rect)
+{
+	test_update_t *update = (test_update_t *)arg;
+
+	update->update_called = true;
+	update->rect = *rect;
+}
+
 PCUT_EXPORT(memgfx);
