Skip to content

Commit

Permalink
Fix working with OpenGL images.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Jun 3, 2021
1 parent 0df1579 commit 45c476d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ui/gl/gl_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void Image::bind(QOpenGLFunctions &f, QSize subimage) {
&& subimage.height() <= _image.height());

_textures.ensureCreated(f);
if (subimage.isNull()) {
if (!subimage.isValid()) {
subimage = _image.size();
}
if (subimage.isEmpty()) {
Expand Down Expand Up @@ -127,6 +127,12 @@ TexturedRect Image::texturedRect(
const auto visible = clip.isNull()
? 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 yFactor = texture.height() / geometry.height();
const auto usedTexture = QRect(
Expand Down

0 comments on commit 45c476d

Please sign in to comment.