Hi

Made a small patch that makes a big difference when resizing windows.

Before when resizing windows, it called repaint_stack to repaint the
whole window surfaces aswell. IMHO this is unecassary and it causes a
VERY annoying flicker (If resizing "opaque" and making a blit to the
surface afterwards).

With this patch it will only repaint_stack on the area that previously
was
overlapped by the window. It's a small patch so you'll understand...

I can only see one drawback: calling repaint_stack twice if resize makes
the window smaller in both width and height - might make this solution a
little slower in some cases?

Anyhow the purpose was really to get rid of that very annoying flicker.
Hope it gets applied :)

Regards
Hallvar Helleseth
Index: src/core/windows.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/windows.c,v
retrieving revision 1.46
diff -c -u -r1.46 windows.c
--- src/core/windows.c  4 Feb 2002 11:45:24 -0000       1.46
+++ src/core/windows.c  12 Feb 2002 20:03:01 -0000
@@ -526,6 +526,7 @@
      CoreWindowStack *stack = window->stack;
      int ow = window->width;
      int oh = window->height;
+     int done_corner = 0; // repaint_stack done in lower right corner
 
      dfb_surface_reformat( window->surface, width, height,
                            window->surface->format );
@@ -533,12 +534,26 @@
      window->width = window->surface->width;
      window->height = window->surface->height;
 
-     if (window->opacity) {
-          DFBRegion region = { window->x, window->y,
-                               window->x + MAX(ow, width) - 1,
-                               window->y + MAX(oh, height) - 1 };
+     if(window->opacity) {
+          if (ow > window->width) {
+               DFBRegion region = { window->x + window->width, window->y,
+                                    window->x + ow - 1,
+                                    window->y + window->height -1 };
+                                                               
+               repaint_stack( stack, &region );
+               done_corner = 1;
+          }
 
-          repaint_stack( stack, &region );
+          if (oh > window->height) {
+               DFBRegion region = { window->x, window->y + window->height,
+                                    window->x + window->width -1,
+                                    window->y + oh - 1 };
+
+               if (done_corner)
+                    region.x2 -= ow - window->height;
+               
+               repaint_stack( stack, &region );
+          }
      }
 
      if (!(window->caps & DWHC_GHOST)) {

Reply via email to