* Renders the buffer's contents onto the screen, applying * any necessary filters or conversions in the process. * If the scaling factor is bigger than 1, the entire contents * of the buffer are resized by that factor (eg. 2 = doubled) * before being put on screen. */
| 182 | * before being put on screen. |
| 183 | */ |
| 184 | void Screen::flip() |
| 185 | { |
| 186 | if (getWidth() != _baseWidth || getHeight() != _baseHeight || isOpenGLEnabled()) |
| 187 | { |
| 188 | Zoom::flipWithZoom(_surface->getSurface(), _screen, _topBlackBand, _bottomBlackBand, _leftBlackBand, _rightBlackBand, &glOutput); |
| 189 | } |
| 190 | else |
| 191 | { |
| 192 | SDL_BlitSurface(_surface->getSurface(), 0, _screen, 0); |
| 193 | } |
| 194 | |
| 195 | // perform any requested palette update |
| 196 | if (_pushPalette && _numColors && _screen->format->BitsPerPixel == 8) |
| 197 | { |
| 198 | if (_screen->format->BitsPerPixel == 8 && SDL_SetColors(_screen, &(deferredPalette[_firstColor]), _firstColor, _numColors) == 0) |
| 199 | { |
| 200 | Log(LOG_DEBUG) << "Display palette doesn't match requested palette"; |
| 201 | } |
| 202 | _numColors = 0; |
| 203 | _pushPalette = false; |
| 204 | } |
| 205 | |
| 206 | |
| 207 | |
| 208 | if (SDL_Flip(_screen) == -1) |
| 209 | { |
| 210 | throw Exception(SDL_GetError()); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Clears all the contents out of the internal buffer. |