mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
Update ImageOverlay to take texture rescaling into account
This commit is contained in:
parent
1f6932bdcb
commit
d27a26967f
1 changed files with 8 additions and 0 deletions
|
@ -93,6 +93,14 @@ void ImageOverlay::render(RenderArgs* args) {
|
||||||
QRect fromImage;
|
QRect fromImage;
|
||||||
if (_wantClipFromImage) {
|
if (_wantClipFromImage) {
|
||||||
fromImage = _fromImage;
|
fromImage = _fromImage;
|
||||||
|
float originalWidth = _texture->getOriginalWidth();
|
||||||
|
float originalHeight = _texture->getOriginalHeight();
|
||||||
|
float scaleX = imageWidth / originalWidth;
|
||||||
|
float scaleY = imageHeight / originalHeight;
|
||||||
|
fromImage.setX(scaleX * _fromImage.x());
|
||||||
|
fromImage.setY(scaleY * _fromImage.y());
|
||||||
|
fromImage.setWidth(scaleX * _fromImage.width());
|
||||||
|
fromImage.setHeight(scaleY * _fromImage.height());
|
||||||
} else {
|
} else {
|
||||||
fromImage.setX(0);
|
fromImage.setX(0);
|
||||||
fromImage.setY(0);
|
fromImage.setY(0);
|
||||||
|
|
Loading…
Reference in a new issue