mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 04:07:11 +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;
|
||||
if (_wantClipFromImage) {
|
||||
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 {
|
||||
fromImage.setX(0);
|
||||
fromImage.setY(0);
|
||||
|
|
Loading…
Reference in a new issue