Fix working with OpenGL images.
This commit is contained in:
parent
0df1579d4a
commit
45c476da3a
1 changed files with 7 additions and 1 deletions
|
|
@ -69,7 +69,7 @@ void Image::bind(QOpenGLFunctions &f, QSize subimage) {
|
||||||
&& subimage.height() <= _image.height());
|
&& subimage.height() <= _image.height());
|
||||||
|
|
||||||
_textures.ensureCreated(f);
|
_textures.ensureCreated(f);
|
||||||
if (subimage.isNull()) {
|
if (!subimage.isValid()) {
|
||||||
subimage = _image.size();
|
subimage = _image.size();
|
||||||
}
|
}
|
||||||
if (subimage.isEmpty()) {
|
if (subimage.isEmpty()) {
|
||||||
|
|
@ -127,6 +127,12 @@ TexturedRect Image::texturedRect(
|
||||||
const auto visible = clip.isNull()
|
const auto visible = clip.isNull()
|
||||||
? geometry
|
? geometry
|
||||||
: clip.intersected(geometry);
|
: clip.intersected(geometry);
|
||||||
|
if (visible.isEmpty()) {
|
||||||
|
return TexturedRect{
|
||||||
|
.geometry = Rect(visible),
|
||||||
|
.texture = Rect(0., 0., 0., 0.),
|
||||||
|
};
|
||||||
|
}
|
||||||
const auto xFactor = texture.width() / geometry.width();
|
const auto xFactor = texture.width() / geometry.width();
|
||||||
const auto yFactor = texture.height() / geometry.height();
|
const auto yFactor = texture.height() / geometry.height();
|
||||||
const auto usedTexture = QRect(
|
const auto usedTexture = QRect(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue