* Wrapper around various software and OpenGL screen buffer pushing functions which zoom. * Basically called just from Screen::flip() * * @param src The surface to zoom (input). * @param dst The zoomed surface (output). * @param topBlackBand Size of top black band in pixels (letterboxing). * @param bottomBlackBand Size of bottom black band in pixels (letterboxing). * @param leftBlackBand Siz
| 640 | * @param glOut OpenGL output. |
| 641 | */ |
| 642 | void Zoom::flipWithZoom(SDL_Surface *src, SDL_Surface *dst, int topBlackBand, int bottomBlackBand, int leftBlackBand, int rightBlackBand, OpenGL *glOut) |
| 643 | { |
| 644 | if (Screen::isOpenGLEnabled()) |
| 645 | { |
| 646 | #ifndef __NO_OPENGL |
| 647 | if (glOut->buffer_surface) |
| 648 | { |
| 649 | SDL_BlitSurface(src, 0, glOut->buffer_surface->getSurface(), 0); // TODO; this is less than ideal... |
| 650 | |
| 651 | glOut->refresh(glOut->linear, glOut->iwidth, glOut->iheight, dst->w, dst->h, topBlackBand, bottomBlackBand, leftBlackBand, rightBlackBand); |
| 652 | SDL_GL_SwapBuffers(); |
| 653 | } |
| 654 | #endif |
| 655 | } |
| 656 | else if (topBlackBand <= 0 && bottomBlackBand <= 0 && leftBlackBand <= 0 && rightBlackBand <= 0) |
| 657 | { |
| 658 | _zoomSurfaceY(src, dst, 0, 0); |
| 659 | } |
| 660 | else if (dst->w - leftBlackBand - rightBlackBand == src->w && dst->h - topBlackBand - bottomBlackBand == src->h) |
| 661 | { |
| 662 | SDL_Rect dstrect = {(Sint16)leftBlackBand, (Sint16)topBlackBand, (Uint16)src->w, (Uint16)src->h}; |
| 663 | SDL_BlitSurface(src, NULL, dst, &dstrect); |
| 664 | } |
| 665 | else |
| 666 | { |
| 667 | SDL_Surface *tmp = SDL_CreateRGBSurface(dst->flags, dst->w - leftBlackBand - rightBlackBand, dst->h - topBlackBand - bottomBlackBand, dst->format->BitsPerPixel, 0, 0, 0, 0); |
| 668 | _zoomSurfaceY(src, tmp, 0, 0); |
| 669 | if (src->format->palette != NULL) |
| 670 | { |
| 671 | SDL_SetPalette(tmp, SDL_LOGPAL|SDL_PHYSPAL, src->format->palette->colors, 0, src->format->palette->ncolors); |
| 672 | } |
| 673 | SDL_Rect dstrect = {(Sint16)leftBlackBand, (Sint16)topBlackBand, (Uint16)tmp->w, (Uint16)tmp->h}; |
| 674 | SDL_BlitSurface(tmp, NULL, dst, &dstrect); |
| 675 | SDL_FreeSurface(tmp); |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | |
| 680 | /** |
nothing calls this directly
no test coverage detected