annotate window/surface.h @ 0:223b71206888

Initial import
author thib
date Fri, 01 Aug 2008 16:32:45 +0000
parents
children 5ae5533b3a9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
223b71206888 Initial import
thib
parents:
diff changeset
1 #ifndef __SURFACE_H__
223b71206888 Initial import
thib
parents:
diff changeset
2 #define __SURFACE_H__
223b71206888 Initial import
thib
parents:
diff changeset
3
223b71206888 Initial import
thib
parents:
diff changeset
4 #include<SDL.h>
223b71206888 Initial import
thib
parents:
diff changeset
5 #include"rect.h"
223b71206888 Initial import
thib
parents:
diff changeset
6
223b71206888 Initial import
thib
parents:
diff changeset
7 struct Surface : public SDL_Surface {
223b71206888 Initial import
thib
parents:
diff changeset
8 char* mem(const Rect& r) {
223b71206888 Initial import
thib
parents:
diff changeset
9 return (char*)(pixels) + r.ty * pitch + r.lx * format->BytesPerPixel;
223b71206888 Initial import
thib
parents:
diff changeset
10 }
223b71206888 Initial import
thib
parents:
diff changeset
11 char* mem_end(const Rect& r) {
223b71206888 Initial import
thib
parents:
diff changeset
12 return (char*)(pixels) + (r.by-1) * pitch + r.rx * format->BytesPerPixel;
223b71206888 Initial import
thib
parents:
diff changeset
13 }
223b71206888 Initial import
thib
parents:
diff changeset
14 };
223b71206888 Initial import
thib
parents:
diff changeset
15
223b71206888 Initial import
thib
parents:
diff changeset
16 #endif /* __SURFACE_H__ */