Subversion Repositories Kolibri OS

Rev

Rev 6357 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;----------------------------------------------------------
  2. ;--------Move picture from array to work screeen-----------
  3. ;----------------------------------------------------------
  4. MovePictureToWorkScreen:
  5.         call    cleare_screen
  6.         mov     eax,[Picture_SizeX]
  7.         mov     ebx,[Picture_SizeY]
  8.         mov     ecx,[MaxWorkScreen_SizeX]
  9.         mov     edx,[MaxWorkScreen_SizeY]
  10.         mov     esi,[k]
  11.         imul    eax,esi
  12.         imul    ebx,esi
  13.         cmp     eax,ecx
  14.         jle     lab1
  15.  
  16.         mov     eax,[MaxWorkScreen_SizeX]
  17.         mov     [WorkScreen_SizeX],eax
  18.         jmp     lab2
  19.  
  20. lab1:
  21.         mov     [WorkScreen_SizeX],eax
  22.  
  23. lab2:
  24.         cmp     ebx,edx
  25.         jle     lab3
  26.         mov     ebx,[MaxWorkScreen_SizeY]
  27.         mov     [WorkScreen_SizeY],ebx
  28.         jmp     lab4
  29.  
  30. lab3:
  31.         mov     [WorkScreen_SizeY],ebx
  32.  
  33. lab4:
  34.         mov     eax,[WorkScreen_SizeX]
  35.         mov     ebx,[k]
  36.         cdq
  37.         idiv    ebx
  38.         mov     [CounterX],eax
  39.         mov     eax,[WorkScreen_SizeY]
  40.         cdq
  41.         idiv    ebx
  42.         mov     [CounterY],eax
  43.  
  44.         mov     eax,[WorkScreen_SizeX]
  45.         mov     ecx,eax
  46.         mov     ebx,[k]
  47.         cdq
  48.         idiv    ebx
  49.         imul    eax,ebx
  50.         sub     ecx,eax
  51.         lea     ecx,[ecx+ecx*2]
  52.  
  53.         mov     eax,[WorkScreen_SizeX]
  54.         mov     ebx,[k]
  55.         dec     ebx
  56.         imul    eax,ebx
  57.         lea     eax,[eax+eax*2]
  58.         add     eax,ecx
  59.         mov     [OffsetYWorkScreen],eax
  60.  
  61.         mov     ebx,[Picture_SizeX]
  62.         mov     eax,[CounterX]
  63.         sub     ebx,eax
  64.         lea     ebx,[ebx+ebx*2]
  65.         mov     [OffsetYPicture],ebx
  66.  
  67.         mov     eax,[WorkScreen_SizeX]
  68.         mov     ebx,[k]
  69.         sub     eax,ebx
  70.         lea     eax,[eax+eax*2]
  71.         mov     [OffsetYBigPixel],eax
  72.  
  73.         mov     eax,[PosX]
  74.         mov     ebx,[PosY]
  75.         mov     ecx,[Picture_SizeX]
  76.         imul    ecx,ebx
  77.         add     eax,ecx
  78.         lea     eax,[eax+eax*2]
  79.         add     eax,[PointerToPicture]
  80.  
  81.         mov     ebx,[ScreenPointer]
  82.         mov     edi,[CounterY]
  83.  
  84. ;if size of picture natural(mastab is 1) than move picture to work screen
  85.         cmp     [k],1
  86.         jne     no_zoom_1_
  87.  
  88. screen_y_1:
  89.         mov     esi,[CounterX]
  90.  
  91. screen_x_1:
  92.         mov     ecx,[eax]
  93.         and     ecx,0xffffff
  94.         mov     ebp,ecx
  95.         shr     ecx,16
  96.         mov     [ebx],bp
  97.         mov     [ebx+2],cl
  98.         add     ebx,3;
  99.         add     eax,3
  100.         dec     esi
  101.         jnz     screen_x_1
  102.         add     eax,[OffsetYPicture]
  103.         add     ebx,[OffsetYWorkScreen]
  104.         dec     edi
  105.         jnz     screen_y_1
  106.         jmp     fps
  107.  
  108. no_zoom_1_:
  109.         cmp     [k],2
  110.         jne     no_zoom_2
  111.  
  112. screen_y_2:
  113.         mov     esi,[CounterX]
  114.  
  115. screen_x_2:
  116.         mov     ecx,[eax]
  117.         and     ecx,0xffffff
  118.         mov     ebp,ecx
  119.         shr     ecx,16
  120.         mov     edx,ebx
  121.         mov     [edx],bp
  122.         mov     [edx+2],cl
  123.         mov     [edx+3],bp
  124.         mov     [edx+3+2],cl
  125.         add     edx,3*2
  126.         add     edx,[OffsetYBigPixel]
  127.         mov     [edx],bp
  128.         mov     [edx+2],cl
  129.         mov     [edx+3],bp
  130.         mov     [edx+3+2],cl
  131.         add     edx,3*2
  132.         add     edx,[OffsetYBigPixel]
  133.         add     ebx,3*2
  134.         add     eax,3
  135.         dec     esi
  136.         jnz     screen_x_2
  137.         add     eax,[OffsetYPicture]
  138.         add     ebx,[OffsetYWorkScreen]
  139.         dec     edi
  140.         jnz     screen_y_2
  141.         jmp     fps
  142.  
  143. no_zoom_2:
  144.         cmp     [k],4
  145.         jne     no_zoom_4
  146.  
  147. screen_y_4:
  148.         mov     esi,[CounterX]
  149.  
  150. screen_x_4:
  151.         mov     ecx,[eax]
  152.         and     ecx,0xffffff
  153.         mov     ebp,ecx
  154.         shr     ecx,16
  155.         mov     edx,ebx
  156.         mov     [edx],bp
  157.         mov     [edx+2],cl
  158.         mov     [edx+3],bp
  159.         mov     [edx+3+2],cl
  160.         mov     [edx+6],bp
  161.         mov     [edx+6+2],cl
  162.         mov     [edx+9],bp
  163.         mov     [edx+9+2],cl
  164.         add     edx,3*4
  165.         add     edx,[OffsetYBigPixel]
  166.         mov     [edx],bp
  167.         mov     [edx+2],cl
  168.         mov     [edx+3],bp
  169.         mov     [edx+3+2],cl
  170.         mov     [edx+6],bp
  171.         mov     [edx+6+2],cl
  172.         mov     [edx+9],bp
  173.         mov     [edx+9+2],cl
  174.         add     edx,3*4
  175.         add     edx,[OffsetYBigPixel]
  176.         mov     [edx],bp
  177.         mov     [edx+2],cl
  178.         mov     [edx+3],bp
  179.         mov     [edx+3+2],cl
  180.         mov     [edx+6],bp
  181.         mov     [edx+6+2],cl
  182.         mov     [edx+9],bp
  183.         mov     [edx+9+2],cl
  184.         add     edx,3*4
  185.         add     edx,[OffsetYBigPixel]
  186.         mov     [edx],bp
  187.         mov     [edx+2],cl
  188.         mov     [edx+3],bp
  189.         mov     [edx+3+2],cl
  190.         mov     [edx+6],bp
  191.         mov     [edx+6+2],cl
  192.         mov     [edx+9],bp
  193.         mov     [edx+9+2],cl
  194.         add     edx,3*4
  195.         add     edx,[OffsetYBigPixel]
  196.         add     ebx,4*3
  197.         add     eax,3
  198.         dec     esi
  199.         jnz     screen_x_4
  200.         add     eax,[OffsetYPicture]
  201.         add     ebx,[OffsetYWorkScreen]
  202.         dec     edi
  203.         jnz     screen_y_4
  204.         jmp     fps
  205.  
  206. no_zoom_4:
  207. ;if zoom more than 4
  208. screen_y:
  209.         mov     esi,[CounterX]
  210.  
  211. screen_x:
  212.         mov     ecx,[eax]
  213.         and     ecx,0xffffff
  214.         mov     ebp,ecx
  215.         shr     ecx,16
  216. ;---------------------------------------------------------
  217.         push    ebx eax
  218.         mov     edx,[k]
  219.  
  220. big_pixel_y:
  221.         mov     eax,[k]
  222.  
  223. big_pixel_x:
  224.         mov     [ebx],bp
  225.         mov     [ebx+2],cl
  226.         add     ebx,3
  227.         dec     eax
  228.         jnz     big_pixel_x
  229.         add     ebx,[OffsetYBigPixel]
  230.         dec     edx
  231.         jnz     big_pixel_y
  232.         pop     eax ebx
  233. ;---------------------------------------------------------
  234.         mov     edx,[k]
  235.         lea     edx,[edx+edx*2]
  236.         add     ebx,edx
  237.         add     eax,3
  238.         dec     esi
  239.         jnz     screen_x
  240.         add     eax,[OffsetYPicture]
  241.         add     ebx,[OffsetYWorkScreen]
  242.         dec     edi
  243.         jnz     screen_y
  244.  
  245. fps:
  246.         mov     ebx,[ScreenPointer]
  247.         mov     ecx,[WorkScreen_SizeX]
  248.         shl     ecx,16
  249.         add     ecx,[WorkScreen_SizeY]
  250.         mov     edx,((ci_edit_wnd_x_pos+ci_edit_wnd_border) shl 16)\
  251.                 + (ci_edit_wnd_y_pos+ci_edit_wnd_border)
  252.         mcall SF_PUT_IMAGE
  253.         ret
  254. ;----------------------------------------------------------
  255. ;--------------------clear screen--------------------------
  256. ;----------------------------------------------------------
  257. cleare_screen:
  258.         mov edi,[ScreenPointer]
  259.         mov ebx,[WorkScreen_SizeX]
  260.         imul ebx,[WorkScreen_SizeY]
  261.         lea ebx,[ebx+ebx*2]
  262.         mov eax,0xffffffff
  263.         mov ecx,ebx
  264.         shr ecx,2
  265.         cld
  266.         rep stosd
  267.         mov ecx,ebx
  268.         and ecx,3
  269.         rep stosb
  270.         ret
  271. ;----------------------------------------------------------
  272. ;-------------cleare work arrea(work screen)---------------
  273. ;----------------------------------------------------------
  274. cleare_work_arrea:
  275.         mov edi,[PointerToPicture]
  276.         mov ebx,[Picture_SizeX]
  277.         imul ebx,[Picture_SizeY]
  278.         lea ebx,[ebx+ebx*2]
  279.         mov eax,0xffffffff
  280.         mov ecx,ebx
  281.         shr ecx,2
  282.         cld
  283.         rep stosd
  284.         mov ecx,ebx
  285.         and ecx,3
  286.         rep stosb
  287.         ret
  288. ;-----------------------------------------------------------
  289. ;calculate position work screen on a picture
  290. ;-----------------------------------------------------------
  291. CalculatePositionScreen:
  292.         mov eax,[Picture_SizeX]
  293.         sub eax,[CounterX]
  294.         cmp [PosX],eax
  295.         jle @f
  296.                 mov [PosX],eax
  297.         @@:
  298.         cmp [PosX],0
  299.         jns @f
  300.                 mov [PosX],0
  301.         @@:
  302.         mov ebx,[Picture_SizeY]
  303.         sub ebx,[CounterY]
  304.         cmp [PosY],ebx
  305.         jle @f
  306.                 mov [PosY],ebx
  307.         @@:
  308.         cmp [PosY],0
  309.         jns @f
  310.                 mov [PosY],0
  311.         @@:
  312.         ret
  313. ;-----------------------------------------------------------
  314. ;-----------calculate cordinats on work picture--------------
  315. ;-----------------------------------------------------------
  316. GetScreenCordinats:
  317.         mov eax,[MouseX]
  318.         mov ebx,[MouseY]
  319.         sub eax,ci_edit_wnd_x_pos+ci_edit_wnd_border
  320.         cmp eax,0
  321.         jge @f
  322.                 xor eax,eax
  323.         @@:
  324.         sub ebx,ci_edit_wnd_y_pos+ci_edit_wnd_border
  325.         cmp ebx,0
  326.         jge @f
  327.                 xor ebx,ebx
  328.         @@:
  329.         mov ecx,[k]
  330.         cdq
  331.         idiv ecx
  332.         mov [ScreenX],eax
  333.         mov eax,ebx
  334.         cdq
  335.         idiv ecx
  336.         mov [ScreenY],eax
  337.         ret