GUI: Avoid useless surface copy before scaling

By using the const rawSurface function instead of the surfacePtr one,
there is no need to create a copy of the const argument.

(cherry picked from commit d21b42950a)
This commit is contained in:
Le Philousophe 2022-08-25 17:47:44 +02:00
parent c6adcbc1dc
commit 7dca536b26

View file

@ -594,12 +594,7 @@ const Graphics::ManagedSurface *scaleGfx(const Graphics::ManagedSurface *gfx, in
w = nw;
h = nh;
Graphics::ManagedSurface tmp(*gfx);
const Graphics::ManagedSurface *tmp2 = new Graphics::ManagedSurface(tmp.surfacePtr()->scale(w, h, filtering));
tmp.free();
return tmp2;
return new Graphics::ManagedSurface(gfx->rawSurface().scale(w, h, filtering));
}
PicButtonWidget::PicButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Common::U32String &tooltip, uint32 cmd, uint8 hotkey)