Subversion Repositories Kolibri OS

Rev

Rev 8320 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. struct _img
  3. {
  4.         collection url;
  5.         collection_int xywh;
  6.         int getid;
  7.  
  8.         void clear();
  9.         dword add_pos();
  10.         bool set_size();
  11.  
  12.         dword current_url();
  13.         bool next_url();
  14.        
  15.         void draw_all();
  16.         bool draw();
  17. };
  18.  
  19. void _img::clear()
  20. {
  21.         url.drop();
  22.         xywh.drop();
  23.         getid = 0;
  24. }
  25.  
  26. dword _img::add_pos(dword _path, _x, _y)
  27. {
  28.         char full_path[URL_SIZE];
  29.         strncpy(#full_path, _path, URL_SIZE);
  30.         get_absolute_url(#full_path, history.current());
  31.  
  32.         url.add(#full_path);
  33.         xywh.add(_x);
  34.         xywh.add(_y);
  35.         xywh.add(NULL);
  36.         xywh.add(NULL);
  37.         return #full_path;
  38. }
  39.  
  40. bool _img::set_size(dword _id, _buf, _size)
  41. {
  42.         img_decode stdcall (_buf, _size, 0);
  43.         if (EAX) {
  44.                 EDI = EAX;
  45.                 xywh.set(_id*4+2, ESDWORD[EDI+4]);
  46.                 xywh.set(_id*4+3, ESDWORD[EDI+8]);
  47.                 free(EDI);
  48.                 return true;
  49.         }      
  50.         return false;
  51. }
  52.  
  53. //DELTE!!!!!11111111111111111111111111111111111111
  54. dword _img::current_url()
  55. {
  56.         return url.get(getid);
  57. }
  58.  
  59. //DELTE!!!!!11111111111111111111111111111111111111
  60. bool _img::next_url()
  61. {
  62.         if (getid < url.count-1) {
  63.                 getid++;
  64.                 return 1;
  65.         }
  66.         return 0;
  67. }
  68.  
  69. void _img::draw_all(int _x, _y, _w, _h, _start)
  70. {
  71.         int i, img_y;
  72.  
  73.         for (i=0; i<url.count; i++)
  74.         {
  75.                 img_y = xywh.get(i*4 + 1);
  76.  
  77.                 if (img_y > _start) && (img_y < _start + _h)
  78.                 && (cache.has(url.get(i))) draw(_x, _y, _w, _h, _start, i);
  79.         }
  80. }
  81.  
  82. bool _img::draw(int _x, _y, _w, _h, _start, i)
  83. {
  84.         int img_x, img_y, img_w, img_h;
  85.         img_decode stdcall (cache.current_buf, cache.current_size, 0);
  86.         if (EAX) {
  87.                 EDI = EAX;
  88.  
  89.                 img_x = xywh.get(i*4+0);
  90.                 img_y = xywh.get(i*4+1);
  91.                 img_w = math.min(xywh.set(getid*4+2, ESDWORD[EDI+4]), _w - img_x);
  92.                 img_h = math.min(xywh.set(getid*4+3, ESDWORD[EDI+8]), _h + _start - img_y);
  93.  
  94.  
  95.                 img_draw stdcall(EDI, img_x + _x, img_y - _start + _y, img_w, img_h, 0, 0);    
  96.                 free(EDI);
  97.         }      
  98. }
  99.