=========================================================================== Clips the copy area for CopyPixelData functions ===========================================================================
| 236 | // |
| 237 | //=========================================================================== |
| 238 | bool ClipCopyPixelRect(const FClipRect *cr, int &originx, int &originy, |
| 239 | const uint8_t *&patch, int &srcwidth, int &srcheight, |
| 240 | int &pstep_x, int &pstep_y, int rotate) |
| 241 | { |
| 242 | int pixxoffset; |
| 243 | int pixyoffset; |
| 244 | |
| 245 | int step_x; |
| 246 | int step_y; |
| 247 | |
| 248 | assert(cr != NULL); |
| 249 | // First adjust the settings for the intended rotation |
| 250 | switch (rotate) |
| 251 | { |
| 252 | default: |
| 253 | case 0: // normal |
| 254 | pixxoffset = 0; |
| 255 | pixyoffset = 0; |
| 256 | step_x = pstep_x; |
| 257 | step_y = pstep_y; |
| 258 | break; |
| 259 | |
| 260 | case 1: // rotate 90° right |
| 261 | pixxoffset = 0; |
| 262 | pixyoffset = srcheight - 1; |
| 263 | step_x = -pstep_y; |
| 264 | step_y = pstep_x; |
| 265 | break; |
| 266 | |
| 267 | case 2: // rotate 180° |
| 268 | pixxoffset = srcwidth - 1; |
| 269 | pixyoffset = srcheight - 1; |
| 270 | step_x = -pstep_x; |
| 271 | step_y = -pstep_y; |
| 272 | break; |
| 273 | |
| 274 | case 3: // rotate 90° left |
| 275 | pixxoffset = srcwidth - 1; |
| 276 | pixyoffset = 0; |
| 277 | step_x = pstep_y; |
| 278 | step_y = -pstep_x; |
| 279 | break; |
| 280 | |
| 281 | case 4: // flip horizontally |
| 282 | pixxoffset = srcwidth - 1; |
| 283 | pixyoffset = 0; |
| 284 | step_x = -pstep_x; |
| 285 | step_y = pstep_y; |
| 286 | break; |
| 287 | |
| 288 | case 5: // flip horizontally and rotate 90° right |
| 289 | pixxoffset = srcwidth - 1; |
| 290 | pixyoffset = srcheight - 1; |
| 291 | step_x = -pstep_y; |
| 292 | step_y = -pstep_x; |
| 293 | break; |
| 294 | |
| 295 | case 6: // flip vertically |
no outgoing calls
no test coverage detected