Subversion Repositories Kolibri OS

Rev

Rev 2630 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;------------------------------------------------------------------------------
  2. align 4
  3. draw_appl_button:
  4. ; in:
  5. ; ebx = [x]*65536 + [size x]
  6. ; ecx = [y]*65536 + [size y]
  7. ; edx = internal color 0xRRGGBB
  8. ; esi = external color 0xRRGGBB
  9. ; edi = 0 up or 1 down
  10. COLOR_CHANGE_MAGNITUDE_0 = 0x080808
  11. COLOR_CHANGE_MAGNITUDE = 0x101010
  12. COLOR_CHANGE_MAGNITUDE_1 = 0x202020
  13. COLOR_CHANGE_MAGNITUDE_2 = 0x404040
  14.         pusha
  15.         add     ebx,2 shl 16
  16.         sub     bx,4
  17.         add     ecx,2 shl 16
  18.         sub     cx,4
  19.         mcall   13
  20. ;------------------------------------------------------------------------------
  21. ;       mov     edx,esi
  22.         test    edi,edi
  23.         jnz     @f
  24.  
  25.         mov     eax,COLOR_CHANGE_MAGNITUDE
  26.         call    add_color_change_magnitude
  27.         jmp     .1
  28. ;--------------------------------------
  29. align 4
  30. @@:
  31.         mov     eax,COLOR_CHANGE_MAGNITUDE
  32.         call    subtract_color_change_magnitude
  33. ;--------------------------------------
  34. align 4
  35. .1:
  36.         call    draw_four_extreme_lines
  37. ;------------------------------------------------------------------------------
  38.         mov     edx,esi
  39.         mov     eax,COLOR_CHANGE_MAGNITUDE_2
  40.         call    subtract_color_change_magnitude
  41.         sub     ecx,1 shl 16
  42.         add     ecx,2
  43.         sub     ebx,1 shl 16
  44.         add     ebx,2
  45.         call    draw_four_extreme_lines
  46. ;------------------------------------------------------------------------------
  47.         popa
  48.         ret
  49. ;------------------------------------------------------------------------------
  50. align 4
  51. draw_four_extreme_lines:
  52. ; top left point
  53.         push    ebx ecx
  54.         shr     ebx,16
  55.         shr     ecx,16
  56.         mcall   1
  57.         pop     ecx ebx
  58. ; bottom right point
  59.         push    ebx ecx
  60.         movzx   eax,bx
  61.         shr     ebx,16
  62.         add     ebx,eax
  63.         dec     ebx
  64.         movzx   eax,cx
  65.         shr     ecx,16
  66.         add     ecx,eax
  67.         dec     ecx
  68.         mcall   1
  69.         pop     ecx ebx
  70. ;--------------------------------------
  71. ; bottom left point
  72.         push    ebx ecx
  73.         shr     ebx,16
  74.         movzx   eax,cx
  75.         shr     ecx,16
  76.         add     ecx,eax
  77.         dec     ecx
  78.         mcall   1
  79.         pop     ecx ebx
  80. ;--------------------------------------
  81. ; top right point
  82.         push    ebx ecx
  83.         movzx   eax,bx
  84.         shr     ebx,16
  85.         add     ebx,eax
  86.         dec     ebx
  87.         shr     ecx,16
  88.         mcall   1
  89.         pop     ecx ebx
  90. ;--------------------------------------
  91. ; top line
  92.         push    ecx
  93.         sub     ecx,1 shl 16
  94.         mov     cx,1
  95.         mcall   13
  96.         pop     ecx
  97. ; bottom line
  98.         push    ecx
  99.         mov     ax,cx
  100.         shl     eax,16
  101.         add     ecx,eax
  102.         mov     cx,1
  103.         mcall   13
  104.         pop     ecx
  105. ; left line
  106.         push    ebx
  107.         sub     ebx,1 shl 16
  108.         mov     bx,1
  109.         mcall   13
  110.         pop     ebx
  111. ; right line
  112.         push    ebx
  113.         mov     ax,bx
  114.         shl     eax,16
  115.         add     ebx,eax
  116.         mov     bx,1
  117.         mcall   13
  118.         pop     ebx
  119.        
  120.         ret
  121. ;------------------------------------------------------------------------------
  122. align 4
  123. subtract_color_change_magnitude:
  124. ; in:
  125. ; edx = original color
  126. ; eax = magnitude
  127. ; out:
  128. ; edx = processed color
  129.         sub     dl,al
  130.         jae     @f
  131.  
  132.         xor     dl,dl
  133. ;--------------------------------------
  134. align 4
  135. @@:
  136.         ror     edx,8
  137.         ror     eax,8
  138.         sub     dl,al
  139.         jae     @f
  140.  
  141.         xor     dl,dl
  142. ;--------------------------------------
  143. align 4
  144. @@:
  145.         ror     edx,8
  146.         ror     eax,8
  147.         sub     dl,al
  148.         jae     @f
  149.  
  150.         xor     dl,dl
  151. ;--------------------------------------
  152. align 4
  153. @@:
  154.         rol     edx,16
  155.         ret
  156. ;------------------------------------------------------------------------------
  157. align 4
  158. add_color_change_magnitude:
  159. ; in:
  160. ; edx = original color
  161. ; eax = magnitude
  162. ; out:
  163. ; edx = processed color
  164.         add     dl,al
  165.         jae     @f
  166.  
  167.         mov     dl,0xff
  168. ;--------------------------------------
  169. align 4
  170. @@:
  171.         ror     edx,8
  172.         ror     eax,8
  173.         add     dl,al
  174.         jae     @f
  175.  
  176.         mov     dl,0xff
  177. ;--------------------------------------
  178. align 4
  179. @@:
  180.         ror     edx,8
  181.         ror     eax,8
  182.         add     dl,al
  183.         jae     @f
  184.  
  185.         mov     dl,0xff
  186. ;--------------------------------------
  187. align 4
  188. @@:
  189.         rol     edx,16
  190.         ret
  191. ;------------------------------------------------------------------------------
  192. align 4
  193. calculate_button_y_coordinate_and_size:
  194.         mov     ecx,[button_top_offset]
  195.         shl     ecx,16
  196.         add     ecx,[height]
  197.         sub     ecx,[button_top_offset]
  198.         sub     ecx,[button_bottom_offset]
  199.         ret
  200. ;------------------------------------------------------------------------------
  201.