From 570e99f573c57fc59a2ba2bc9e0ff689600e2635 Mon Sep 17 00:00:00 2001
From: "Marat Zakiyanov (Mario79)" <mario79@bk.ru>
Date: Wed, 29 Feb 2012 23:03:13 +0000
Subject: [PATCH] Removing the "blinking" of redrawing titlebar for skinned
 window (type III and IV)

git-svn-id: svn://kolibrios.org@2423 a494cfbc-eb01-0410-851d-a64ba20cac60
---
 kernel/trunk/gui/skincode.inc | 11 +++++++++--
 kernel/trunk/gui/window.inc   | 20 ++++++++++++++++----
 kernel/trunk/video/vesa20.inc |  2 ++
 3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/kernel/trunk/gui/skincode.inc b/kernel/trunk/gui/skincode.inc
index aa3496b678..e5951e1f39 100644
--- a/kernel/trunk/gui/skincode.inc
+++ b/kernel/trunk/gui/skincode.inc
@@ -317,22 +317,29 @@ drawwindow_IV:
 ;        shr   esi,1
 ;        and   esi,0x007f7f7f
         mov     esi, [ebp+SKIN_DATA.colors.outer]
+        or      esi, 1 shl 25 ; 0x02000000 used for draw_rectangle without top line
+        ror     ebx, 16
+        add     ebx, [_skinh]
+        sub     bx, 1
+        rol     ebx, 16
         call    draw_rectangle
         mov     ecx, 3
       _dw3l:
         add     eax, 1*65536-1
-        add     ebx, 1*65536-1
+        add     ebx, 0*65536-1
         test    ax, ax
         js      no_skin_add_button
         test    bx, bx
         js      no_skin_add_button
         mov     esi, [ebp+SKIN_DATA.colors.frame];[edi+24]
+        or      esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
         call    draw_rectangle
         dec     ecx
         jnz     _dw3l
         mov     esi, [ebp+SKIN_DATA.colors.inner]
+        or      esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
         add     eax, 1*65536-1
-        add     ebx, 1*65536-1
+        add     ebx, 0*65536-1
         test    ax, ax
         js      no_skin_add_button
         test    bx, bx
diff --git a/kernel/trunk/gui/window.inc b/kernel/trunk/gui/window.inc
index 4473a23a3e..759b400d34 100644
--- a/kernel/trunk/gui/window.inc
+++ b/kernel/trunk/gui/window.inc
@@ -609,6 +609,9 @@ draw_rectangle: ;//////////////////////////////////////////////////////////////
 ;> eax = pack[16(left), 16(right)]
 ;> ebx = pack[16(top), 16(bottom)]
 ;> esi = color
+;       ?? RR GG BB    ; 0x01000000 negation
+;                      ; 0x02000000 used for draw_rectangle without top line
+;                      ;           for example drawwindow_III and drawwindow_IV
 ;------------------------------------------------------------------------------
         push    eax ebx ecx edi
 
@@ -619,14 +622,17 @@ draw_rectangle: ;//////////////////////////////////////////////////////////////
 
         ; set line color
         mov     ecx, esi
-
+        sub     esi, 1 shl 25
         ; draw top border
         rol     ebx, 16
         push    ebx
         rol     ebx, 16
         pop     bx
+        test    ecx, 1 shl 25
+        jnz     @f
+        sub     ecx, 1 shl 25
         call    [draw_line]
-
+@@:
         ; draw bottom border
         mov     ebx, [esp - 2]
         pop     bx
@@ -828,22 +834,28 @@ drawwindow_III: ;//////////////////////////////////////////////////////////////
         mov     esi, [edx + WDATA.cl_frames]
         shr     esi, 1
         and     esi, 0x007f7f7f
+        or      esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
+        ror     ebx, 16
+        add     ebx, [_skinh]
+        sub     bx, 1
+        rol     ebx, 16
         call    draw_rectangle
 
         push    esi
         mov     ecx, 3
         mov     esi, [edx + WDATA.cl_frames]
+        or      esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
 
   .next_frame:
         add     eax, 1 * 65536 - 1
-        add     ebx, 1 * 65536 - 1
+        add     ebx, 0 * 65536 - 1
         call    draw_rectangle
         dec     ecx
         jnz     .next_frame
 
         pop     esi
         add     eax, 1 * 65536 - 1
-        add     ebx, 1 * 65536 - 1
+        add     ebx, 0 * 65536 - 1
         call    draw_rectangle
 
         ; window caption
diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc
index 019f3345c0..6b46f2a578 100644
--- a/kernel/trunk/video/vesa20.inc
+++ b/kernel/trunk/video/vesa20.inc
@@ -300,6 +300,8 @@ __sys_putpixel:
 ; eax = x coordinate
 ; ebx = y coordinate
 ; ecx = ?? RR GG BB    ; 0x01000000 negation
+                       ; 0x02000000 used for draw_rectangle without top line
+                       ;            for example drawwindow_III and drawwindow_IV
 ; edi = 0x00000001 force
 
 ;;;        mov  [novesachecksum], dword 0