| 198 | } |
| 199 | |
| 200 | void PiuSkinDrawAux(PiuSkin* self, PiuView* view, PiuRectangle bounds, PiuVariant variant, PiuState state, PiuAlignment horizontal, PiuAlignment vertical) |
| 201 | { |
| 202 | PiuFlags flags = (*self)->flags; |
| 203 | PiuTexture* texture = (*self)->data.pattern.texture; |
| 204 | PiuCoordinate x = bounds->x; |
| 205 | PiuCoordinate y = bounds->y; |
| 206 | PiuCoordinate dx = bounds->width; |
| 207 | PiuCoordinate dy = bounds->height; |
| 208 | PiuCoordinate u = (*self)->data.pattern.bounds.x + ((*self)->data.pattern.delta.x * variant); |
| 209 | PiuCoordinate v = (*self)->data.pattern.bounds.y + ((*self)->data.pattern.delta.y * (PiuCoordinate)state); |
| 210 | PiuCoordinate du = (*self)->data.pattern.bounds.width; |
| 211 | PiuCoordinate dv = (*self)->data.pattern.bounds.height; |
| 212 | PiuCoordinate dl = (*self)->data.pattern.tiles.left; |
| 213 | PiuCoordinate dr = (*self)->data.pattern.tiles.right; |
| 214 | PiuCoordinate dt = (*self)->data.pattern.tiles.top; |
| 215 | PiuCoordinate db = (*self)->data.pattern.tiles.bottom; |
| 216 | if (flags & piuRepeatX) { |
| 217 | if (flags & piuRepeatY) { |
| 218 | PiuViewDrawTexture(view, texture, x, y, u, v, dl, dt); |
| 219 | PiuViewFillTexture(view, texture, x + dl, y, dx - dl - dr, dt, u + dl, v, du - dl - dr, dt); |
| 220 | PiuViewDrawTexture(view, texture, x + dx - dr, y, u + du - dr, v, dr, dt); |
| 221 | PiuViewFillTexture(view, texture, x + dx - dr, y + dt, dr, dy - dt - db, u + du - dr, v + dt, dr, dv - dt - db); |
| 222 | PiuViewDrawTexture(view, texture, x + dx - dr, y + dy - db, u + du - dr, v + dv - db, dr, db); |
| 223 | PiuViewFillTexture(view, texture, x + dl, y + dy - db, dx - dl - dr, db, u + dl, v + dv - db, du - dl - dr, db); |
| 224 | PiuViewDrawTexture(view, texture, x, y + dy - db, u, v + dv - db, dl, db); |
| 225 | PiuViewFillTexture(view, texture, x, y + dt, dl, dy - dt - db, u, v + dt, dl, dv - dt - db); |
| 226 | PiuViewFillTexture(view, texture, x + dl, y + dt, dx - dl - dr, dy - dt - db, u + dl, v + dt, du - dl - dr, dv - dt - db); |
| 227 | } |
| 228 | else { |
| 229 | switch (vertical & piuTopBottom) { |
| 230 | case piuTop: break; |
| 231 | case piuBottom: y += dy - dv; break; |
| 232 | #ifdef piuPC |
| 233 | default: y += ((dy - dv) / 2); break; |
| 234 | #else |
| 235 | default: y += ((dy - dv + 1) >> 1); break; |
| 236 | #endif |
| 237 | } |
| 238 | PiuViewDrawTexture(view, texture, x, y, u, v, dl, dv); |
| 239 | PiuViewFillTexture(view, texture, x + dl, y, dx - dl - dr, dv, u + dl, v, du - dl - dr, dv); |
| 240 | PiuViewDrawTexture(view, texture, x + dx - dr, y, u + du - dr, v, dr, dv); |
| 241 | } |
| 242 | } |
| 243 | else { |
| 244 | if (flags & piuRepeatY) { |
| 245 | switch (horizontal & piuLeftRight) { |
| 246 | case piuLeft: break; |
| 247 | case piuRight: x += dx - du; break; |
| 248 | #ifdef piuPC |
| 249 | default: x += ((dx - du) / 2); break; |
| 250 | #else |
| 251 | default: x += ((dx - du + 1) >> 1); break; |
| 252 | #endif |
| 253 | } |
| 254 | PiuViewDrawTexture(view, texture, x, y, u, v, du, dt); |
| 255 | PiuViewFillTexture(view, texture, x, y + dt, du, dy - dt - db, u, v + dt, du, dv - dt - db); |
| 256 | PiuViewDrawTexture(view, texture, x, y + dy - db, u, v + dv - db, du, db); |
| 257 | } |
no test coverage detected