GUI: Implemented more modes to autoscale

This commit is contained in:
Eugene Sandulenko 2014-05-05 21:36:16 +03:00 committed by Alexander Tkachev
parent 4474ccf814
commit ec7312ac13
5 changed files with 32 additions and 11 deletions

View file

@ -886,13 +886,25 @@ blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) {
template<typename PixelType>
void VectorRendererSpec<PixelType>::
blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, bool autoscale) {
if (autoscale)
blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, Graphics::DrawStep::AutoScaleMode autoscale) {
if (autoscale == Graphics::DrawStep::kAutoScaleStretch) {
source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE,
nullptr, TS_ARGB(255, 255, 255, 255),
r.width(), r.height());
else
} else if (autoscale == Graphics::DrawStep::kAutoScaleFit) {
double ratio = (double)r.width() / source->w;
double ratio2 = (double)r.height() / source->h;
if (ratio2 < ratio)
ratio = ratio2;
source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE,
nullptr, TS_ARGB(255, 255, 255, 255),
(int)(source->w * ratio), (int)(source->h * ratio));
} else {
source->blit(*_activeSurface, r.left, r.top);
}
}
template<typename PixelType>