- // middle
- destRect.y += borderHeight;
- int fullRepeatHeight(height - (2 * borderHeight));
- int hRepeatCursor(0);
- while (hRepeatCursor < fullRepeatHeight) {
-
- // left border
- srcRect.x = xOffset;
- srcRect.y = yOffset + borderHeight;
- srcRect.w = borderWidth;
- srcRect.h = repeatHeight;
- destRect.x = position.X();
- SDL_BlitSurface(surface, &srcRect, dest, &destRect);
-
- // fill
- repeatCursor = 0;
- srcRect.x += borderWidth;
- srcRect.w = repeatWidth;
- destRect.x += borderWidth;
- while (repeatCursor < fullRepeatWidth) {
- SDL_BlitSurface(surface, &srcRect, dest, &destRect);
- destRect.x += repeatWidth;
- repeatCursor += repeatWidth;
- }
-
- // right border
- srcRect.x += repeatWidth;
- srcRect.w = borderWidth;
- SDL_BlitSurface(surface, &srcRect, dest, &destRect);
-
- destRect.y += repeatHeight;
- hRepeatCursor += repeatHeight;
- }
+ // left border
+ Texture(surface, Vector<int>(BorderWidth(), RepeatHeight()), Vector<int>(offset.X(), offset.Y() + BorderHeight()))
+ .Render(dest, Vector<int>(position.X(), position.Y() + BorderHeight()), Vector<int>(position.X() + BorderWidth(), position.Y() + height - BorderHeight()));
+
+ // center fill
+ Texture(surface, RepeatSize(), Vector<int>(offset.X() + BorderWidth(), offset.Y() + BorderHeight()))
+ .Render(dest, position + BorderSize(), position + Vector<int>(width, height) - BorderSize());
+
+ // right border
+ Texture(surface, Vector<int>(BorderWidth(), RepeatHeight()), Vector<int>(offset.X() + BorderWidth() + RepeatWidth(), offset.Y() + BorderHeight()))
+ .Render(dest, Vector<int>(position.X() + width - BorderWidth(), position.Y() + BorderHeight()), Vector<int>(position.X() + width, position.Y() + height - BorderHeight()));