Changeset 526 for abuse/trunk
- Timestamp:
- Apr 22, 2011, 4:13:00 AM (12 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/imlib/image.cpp
r524 r526 1249 1249 } 1250 1250 1251 void image::flip_x() 1252 { 1253 uint8_t *rev=(uint8_t *)malloc(m_size.x), *sl; 1254 CONDITION(rev, "memory allocation"); 1255 int y, x, i; 1256 1257 /* FIXME: Abuse Win32 uses RestoreSurface() here instead of locking */ 1258 Lock(); 1259 for (y=0; y<m_size.y; y++) 1260 { sl=scan_line(y); 1261 for (i=0, x=m_size.x-1; x>=0; x--, i++) 1262 rev[i]=sl[x]; 1263 memcpy(sl, rev, m_size.x); 1264 } 1265 Unlock(); 1266 free(rev); 1267 } 1268 1269 void image::flip_y() 1270 { 1271 uint8_t *rev=(uint8_t *)malloc(m_size.x), *sl; 1272 CONDITION(rev, "memory allocation"); 1273 int y; 1274 1275 /* FIXME: Abuse Win32 uses RestoreSurface() here instead of locking */ 1276 Lock(); 1277 for (y=0; y<m_size.y/2; y++) 1278 { sl=scan_line(y); 1279 memcpy(rev, sl, m_size.x); 1280 memcpy(sl, scan_line(m_size.y-y-1), m_size.x); 1281 memcpy(scan_line(m_size.y-y-1), rev, m_size.x); 1282 } 1283 Unlock(); 1284 free(rev); 1285 } 1286 1251 void image::FlipX() 1252 { 1253 Lock(); 1254 for (int y = 0; y < m_size.y; y++) 1255 { 1256 uint8_t *sl = scan_line(y); 1257 for (int x = 0; x < m_size.x / 2; x++) 1258 { 1259 uint8_t tmp = sl[x]; 1260 sl[x] = sl[m_size.x - 1 - x]; 1261 sl[m_size.x - 1 - x] = tmp; 1262 } 1263 } 1264 Unlock(); 1265 } 1266 1267 void image::FlipY() 1268 { 1269 Lock(); 1270 for (int y = 0; y < m_size.y / 2; y++) 1271 { 1272 uint8_t *sl1 = scan_line(y); 1273 uint8_t *sl2 = scan_line(m_size.y - 1 - y); 1274 for (int x = 0; x < m_size.x; x++) 1275 { 1276 uint8_t tmp = sl1[x]; 1277 sl1[x] = sl2[x]; 1278 sl2[x] = tmp; 1279 } 1280 } 1281 Unlock(); 1282 } 1283 -
abuse/trunk/src/imlib/image.h
r524 r526 169 169 image *create_smooth(int16_t smoothness = 1); // 0 no smoothness 170 170 void unpack_scanline(int16_t line, char bitsperpixel = 1); 171 void flip_x();172 void flip_y();171 void FlipX(); 172 void FlipY(); 173 173 }; 174 174 -
abuse/trunk/src/items.cpp
r515 r526 286 286 image *im=load_image(fp); 287 287 forward=new trans_image(im,"figure data"); 288 im-> flip_x();288 im->FlipX(); 289 289 backward=new trans_image(im,"figure backward data"); 290 290 delete im;
Note: See TracChangeset
for help on using the changeset viewer.