GUI glitches with fractional zoom-factors

A user interface toolkit mainly for audio plug-ins (VST, AudioUnit, etc).
Post Reply
MarkusK
Posts: 53
Joined: Thu Oct 22, 2020 9:11 am

GUI glitches with fractional zoom-factors

Post by MarkusK »

reproducible in:

VST SDK 3.7 with VSTGUI 4.9:
VST SDK 3.6.9 with VSTGUI 4.6:

setZoomFactor:

When a fractional factor like 1.5 or 1.75 is used wrong pixels can appear around the borders of a CAnimKnob

MarkusK
Posts: 53
Joined: Thu Oct 22, 2020 9:11 am

Re: GUI glitches with fractional zoom-factors

Post by MarkusK »

I am not the only one who experienced this. This hack of the VSTGUI did fix it for me

https://gitmemory.com/issue/steinbergme ... /648696050
diff --git a/vstgui/lib/cframe.cpp b/vstgui/lib/cframe.cpp
index 1448f527..faf8d37a 100644
--- a/vstgui/lib/cframe.cpp
+++ b/vstgui/lib/cframe.cpp
@@ -1410,7 +1410,7 @@ void CFrame::invalidRect (const CRect& rect)

CRect _rect (rect);
getTransform ().transform (_rect);
- _rect.makeIntegral ();
+ _rect.makeIntegralOnlyExpanding ();
if (pImpl->collectInvalidRects)
pImpl->collectInvalidRects->addRect (_rect);
else
diff --git a/vstgui/lib/crect.h b/vstgui/lib/crect.h
index 333751eb..33568aee 100644
--- a/vstgui/lib/crect.h
+++ b/vstgui/lib/crect.h
@@ -68,6 +68,7 @@ struct CRect
/** moves this rect to the center of r */
inline CRect& centerInside (const CRect& r);
inline CRect& makeIntegral ();
+ inline CRect& makeIntegralOnlyExpanding ();

CCoord left {0.};
CCoord top {0.};
@@ -272,6 +273,17 @@ inline CRect& CRect::makeIntegral ()
return *this;
}

+// this will give you a rectangle which is integral, but also is outside the given input
+inline CRect& CRect::makeIntegralOnlyExpanding()
+{
+ left = std::floor (left);
+ right = std::ceil (right);
+ top = std::floor (top);
+ bottom = std::ceil (bottom);
+ return *this;
+}
+
+

Arne Scheffler
Posts: 417
Joined: Mon Jun 20, 2016 7:53 am

Re: GUI glitches with fractional zoom-factors

Post by Arne Scheffler »

and already fixed on the develop branch of vstgui:
https://github.com/steinbergmedia/vstgu ... 29cc16256c

MarkusK
Posts: 53
Joined: Thu Oct 22, 2020 9:11 am

Re: GUI glitches with fractional zoom-factors

Post by MarkusK »

Thank you Arne. I assumed that the VST SDK 3.7 (August 2020) would have already included the fixes from the older VSTGUI 4.9 (December 2019).

Editing crect.h in your way did fix the problem.

inline CRect& CRect::makeIntegral ()
{
left = std::floor (left);
right = std::ceil (right);
top = std::floor (top);
bottom = std::ceil (bottom);
return *this;
}

Post Reply