   Wrapping around images in SDL?
void video::renderer::render(pointer<SDL_Surface> raw, int x, int y, pointer<SDL_Rect> s, bool clip, bool wrap) {   pointer<SDL_Surface> screen = SDL_GetVideoSurface();   if (!raw || !screen)  throw rendering_exception("Invalid image/animation passed to render or screen is invalid.");   SDL_Rect src;   if (s)  src = *s;   else {  src.x = 0;  src.y = 0;  src.w = raw->w;  src.h = raw->h;   }   if (clip) {  if (x < 0) { if (abs(x) > src.w)return; src.x += abs(x); src.w -= abs(x); x = 0;  }  if (y < 0) { if (abs(y) > src.h)return; src.y += abs(y); src.h -= abs(y); y = 0;  }  if (x > m_viewport.w || y > m_viewport.h) return;  if (src.w > m_viewport.w - x) src.w = m_viewport.w - x;  if (src.h > m_viewport.h - y) src.h = m_viewport.h - y;  x += m_viewport.x;  y += m_viewport.y;   }   SDL_Rect dst = {x, y, src.w, src.h};   SDL_BlitSurface(raw, &src, screen, &dst);    }The above is a little function to clip images (if requested) and draw them relative to the renderer's position.What I want to do is if the wrap flag is set to draw the unseen part of the image on the other side.  So, if x < 0 then the stuff that I can't see would be drawn on the opposite side.  Same with the y.I just can't wrap my head around how to get the rectangle for the missing part.  It's early in the morning and either I'm sleepy or just not getting it...Thanks!(I'm just looking for a small hint as to what I must do, so I can still figure it out on my own...)Sorry if this is kinda of a stupid question [smile].   