Ver código fonte

Fix positioning & scale of video files

Ivan Savenko 1 ano atrás
pai
commit
f75a25e369
1 arquivos alterados com 4 adições e 3 exclusões
  1. 4 3
      client/media/CVideoHandler.cpp

+ 4 - 3
client/media/CVideoHandler.cpp

@@ -19,6 +19,7 @@
 #include "../eventsSDL/InputHandler.h"
 #include "../gui/CGuiHandler.h"
 #include "../render/Canvas.h"
+#include "../render/IScreenHandler.h"
 #include "../renderSDL/SDL_Extensions.h"
 
 #include "../../lib/filesystem/CInputStream.h"
@@ -207,9 +208,9 @@ void CVideoInstance::prepareOutput(bool scaleToScreenSize, bool useTextureOutput
 	}
 	else
 	{
-		surface = CSDL_Ext::newSurface(dimensions);
+		surface = CSDL_Ext::newSurface(dimensions * GH.screenHandler().getScalingFactor());
 		sws = sws_getContext(getCodecContext()->width, getCodecContext()->height, getCodecContext()->pix_fmt,
-							 dimensions.x, dimensions.y, AV_PIX_FMT_RGB32,
+							 surface->w, surface->h, AV_PIX_FMT_RGB32,
 							 SWS_BICUBIC, nullptr, nullptr, nullptr);
 	}
 
@@ -362,7 +363,7 @@ void CVideoInstance::show(const Point & position, Canvas & canvas)
 	if(sws == nullptr)
 		throw std::runtime_error("No video to show!");
 
-	CSDL_Ext::blitSurface(surface, canvas.getInternalSurface(), position);
+	CSDL_Ext::blitSurface(surface, canvas.getInternalSurface(), position * GH.screenHandler().getScalingFactor());
 }
 
 double FFMpegStream::getCurrentFrameEndTime() const