Changeset 664
 Timestamp:
 May 15, 2011, 5:32:46 PM (9 years ago)
 Location:
 abuse/trunk/src/imlib
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

abuse/trunk/src/imlib/image.cpp
r663 r664 25 25 int keep_dirties, int static_memory) 26 26 { 27 m_clipx1 = 0; m_clipy1 = 0; 28 m_l = size.x; m_h = size.y; 29 m_clipx2 = m_l; m_clipy2 = m_h; 27 m_aa = vec2i(0); 28 m_bb = size; 29 m_size = size; 30 30 31 keep_dirt = keep_dirties; 31 32 static_mem = static_memory; … … 506 507 return; 507 508 508 x1 = Max(0, x1); x2 = Min(m_ l, x2);509 y1 = Max(0, y1); y2 = Min(m_ h, y2);509 x1 = Max(0, x1); x2 = Min(m_size.x, x2); 510 y1 = Max(0, y1); y2 = Min(m_size.y, y2); 510 511 511 512 if (x1 >= x2  y1 >= y2) … … 605 606 return; 606 607 607 x1 = Max(0, x1); x2 = Min(m_ l, x2);608 y1 = Max(0, y1); y2 = Min(m_ h, y2);608 x1 = Max(0, x1); x2 = Min(m_size.x, x2); 609 y1 = Max(0, y1); y2 = Min(m_size.y, y2); 609 610 610 611 if (x1 >= x2  y1 >= y2) 
abuse/trunk/src/imlib/image.h
r661 r664 38 38 { 39 39 private: 40 int m_l, m_h; 41 int m_clipx1, m_clipy1, m_clipx2, m_clipy2; 40 vec2i m_size, m_aa, m_bb; 42 41 43 42 public: … … 49 48 50 49 image_descriptor(vec2i size, int keep_dirties = 1, int static_memory = 0); 51 int bound_x1(int x1) { return x1 < m_clipx1 ? m_clipx1 : x1; }52 int bound_y1(int y1) { return y1 < m_clipy1 ? m_clipy1 : y1; }53 int bound_x2(int x2) { return x2 > m_clipx2 ? m_clipx2 : x2; }54 int bound_y2(int y2) { return y2 > m_clipy2 ? m_clipy2 : y2; }55 inline int x1_clip() { return m_ clipx1; }56 inline int y1_clip() { return m_ clipy1; }57 inline int x2_clip() { return m_ clipx2; }58 inline int y2_clip() { return m_ clipy2; }50 int bound_x1(int x1) { return Max(x1, m_aa.x); } 51 int bound_y1(int y1) { return Max(y1, m_aa.y); } 52 int bound_x2(int x2) { return Min(x2, m_bb.x); } 53 int bound_y2(int y2) { return Min(y2, m_bb.y); } 54 inline int x1_clip() { return m_aa.x; } 55 inline int y1_clip() { return m_aa.y; } 56 inline int x2_clip() { return m_bb.x; } 57 inline int y2_clip() { return m_bb.y; } 59 58 void ClearDirties(); 60 59 void GetClip(int &x1, int &y1, int &x2, int &y2) 61 60 { 62 x1 = m_ clipx1; y1 = m_clipy1; x2 = m_clipx2; y2 = m_clipy2;61 x1 = m_aa.x; y1 = m_aa.y; x2 = m_bb.x; y2 = m_bb.y; 63 62 } 64 63 void SetClip(int x1, int y1, int x2, int y2) … … 66 65 if(x2 < x1 + 1) x2 = x1 + 1; 67 66 if(y2 < y1 + 1) y2 = y1 + 1; 68 m_ clipx1 = Max(x1, 0); m_clipy1= Max(y1, 0);69 m_ clipx2 = Min(x2, m_l); m_clipy2 = Min(y2, m_h);67 m_aa.x = Max(x1, 0); m_aa.y = Max(y1, 0); 68 m_bb.x = Min(x2, m_size.x); m_bb.y = Min(y2, m_size.y); 70 69 } 71 70 void ReduceDirties(); … … 74 73 void Resize(vec2i size) 75 74 { 76 m_l = size.x; m_h = size.y; 77 m_clipx1 = 0; m_clipy1 = 0; m_clipx2 = m_l; m_clipy2 = m_h; 75 m_size = size; 76 m_aa = vec2i(0); 77 m_bb = size; 78 78 } 79 79 };
Note: See TracChangeset
for help on using the changeset viewer.