+ blitter *bl = snew(blitter);
+ bl->x = bl->y = -1;
+ bl->w = w;
+ bl->h = h;
+ bl->img = [[NSImage alloc] initWithSize:NSMakeSize(w, h)];
+ return bl;
+}
+static void osx_blitter_free(void *handle, blitter *bl)
+{
+ [bl->img release];
+ sfree(bl);
+}
+static void osx_blitter_save(void *handle, blitter *bl, int x, int y)
+{
+ frontend *fe = (frontend *)handle;
+ [fe->image unlockFocus];
+ [bl->img lockFocus];
+ [fe->image drawInRect:NSMakeRect(0, 0, bl->w, bl->h)
+ fromRect:NSMakeRect(x, fe->h - y - bl->h, bl->w, bl->h)
+ operation:NSCompositeCopy fraction:1.0];
+ [bl->img unlockFocus];
+ [fe->image lockFocus];
+ bl->x = x;
+ bl->y = y;
+}
+static void osx_blitter_load(void *handle, blitter *bl, int x, int y)
+{
+ frontend *fe = (frontend *)handle;
+ if (x == BLITTER_FROMSAVED && y == BLITTER_FROMSAVED) {
+ x = bl->x;
+ y = bl->y;
+ }
+ [bl->img drawInRect:NSMakeRect(x, fe->h - y - bl->h, bl->w, bl->h)
+ fromRect:NSMakeRect(0, 0, bl->w, bl->h)
+ operation:NSCompositeCopy fraction:1.0];
+}
+static void osx_draw_update(void *handle, int x, int y, int w, int h)
+{
+ frontend *fe = (frontend *)handle;
+ [fe->view setNeedsDisplayInRect:NSMakeRect(x, fe->h - y - h, w, h)];
+}
+static void osx_clip(void *handle, int x, int y, int w, int h)
+{
+ frontend *fe = (frontend *)handle;
+ NSRect r = { {x, fe->h - y - h}, {w, h} };
+