mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-09-14 13:56:48 +08:00
Added zoom fill
This commit is contained in:
parent
f6bff679ca
commit
4212095335
@ -225,11 +225,12 @@ void CWallpaper::setTextureUVs(const glm::ivec4& viewport, const bool vflip, con
|
|||||||
if(!scale){
|
if(!scale){
|
||||||
uint32_t projectionWidth = this->getWidth ();
|
uint32_t projectionWidth = this->getWidth ();
|
||||||
uint32_t projectionHeight = this->getHeight ();
|
uint32_t projectionHeight = this->getHeight ();
|
||||||
|
const float m1 = float(viewport.z) / projectionWidth;
|
||||||
if (
|
const float m2 = float(viewport.w) / projectionHeight;
|
||||||
(viewport.w > viewport.z && projectionWidth >= projectionHeight) ||
|
const float m = std::max(m1,m2);
|
||||||
(viewport.z > viewport.w && projectionHeight > projectionWidth)
|
projectionWidth*=m;
|
||||||
)
|
projectionHeight*=m;
|
||||||
|
if (projectionWidth!=viewport.z)
|
||||||
{
|
{
|
||||||
int newWidth = viewport.w / (float) projectionHeight * projectionWidth;
|
int newWidth = viewport.w / (float) projectionHeight * projectionWidth;
|
||||||
float newCenter = newWidth / 2.0f;
|
float newCenter = newWidth / 2.0f;
|
||||||
@ -242,10 +243,7 @@ void CWallpaper::setTextureUVs(const glm::ivec4& viewport, const bool vflip, con
|
|||||||
uend = right / newWidth;
|
uend = right / newWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (projectionHeight!=viewport.w)
|
||||||
(viewport.z > viewport.w && projectionWidth >= projectionHeight) ||
|
|
||||||
(viewport.w > viewport.z && projectionHeight > projectionWidth)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
int newHeight = viewport.z / (float) projectionWidth * projectionHeight;
|
int newHeight = viewport.z / (float) projectionWidth * projectionHeight;
|
||||||
float newCenter = newHeight / 2.0f;
|
float newCenter = newHeight / 2.0f;
|
||||||
|
Loading…
Reference in New Issue
Block a user