20 lines
602 B
Lua
20 lines
602 B
Lua
function calculateTextureScale(textureScaleU, textureScaleV, fitToFrame, widgetWidth, widgetHeight, imageWidth, imageHeight)
|
|
if fitToFrame then
|
|
scaleX = widgetWidth / imageWidth
|
|
scaleY = widgetHeight / imageHeight
|
|
|
|
scale = math.min(scaleX, scaleY)
|
|
|
|
return scale, scale
|
|
|
|
else
|
|
return textureScaleU, textureScaleV
|
|
end
|
|
end
|
|
|
|
function calculateVideoReplacementScale(textureScaleU, textureScaleV, fitToFrame, widgetWidth, widgetHeight, imageWidth, imageHeight)
|
|
scaleX = widgetWidth / imageWidth
|
|
scaleY = 1 --widgetHeight / imageHeight
|
|
|
|
return scaleX, scaleY
|
|
end |