[Solved][HiDPI] CFrame always returns scale factor 1

Hello,

I’ve finally got some time to experiment with HiDPI support, but I can’t seem to be able to make it work…
I have a laptop with 1.5 scaling factor, I’ve created all my images with that scale factor in mind.

In VSTGUI I create the CBitmap* and then call:

myBitmap->getPlatformBitmap()->setScaleFactor(1.5);

The plug-in GUI has the right dimensions, the images are sized correctly too, but they still look blurred, exactly like they were scaled from 1x to 1.5x.

I did some debugging and noticed that the call to CFrame:

const double scaleFactor = myFrame->getScaleFactor();

always returns 1 instead of 1.5. Is this normal? I guess not…

I’m testing the plug-in in Bitwig studio on Windows, which has HiDPI support. In fact, if I open another plug-in I developed with JUCE using images sized for retina support, the GUI looks perfect as it should.
VSTGUI version is 4.6, the one bundled inside the VSTSDK 3.6.10 zip.

Am I missing something?

Hi,
first of all, you have to setup your bitmaps as I described to you here: Supporting HiDPI programmatically (no UIDescription) - VSTGUI - Steinberg Forums.
Next, if you do not use the VST3Editor class, you have to set the CFrame scale factor yourself, by listening to calls to IPlugViewContentScaleSupport::setContentScaleFactor (…).

By the way, way are you not using the VST3Editor class with its WYSIWYG editor ?

Cheers,
Arne

Thanks for the quick reply!

I know, but I just want to test the functionality, so I’m just using a single image version sized for 1.5x support and declaring its scale factor as 1.5x.
The images in the plug-in appear to be correct in size, so I guess it’s fine to do this for a test (if I omit to set the image as 1.5x scaled, my background goes beyond the GUI bounds, which is correct in this case).
Am I wrong?

Next, if you do not use the VST3Editor class, you have to set the CFrame scale factor yourself, by listening to calls to IPlugViewContentScaleSupport::setContentScaleFactor (…).

Ok, I’ll look into this, thanks!

Good question…
The thing is, I’ve built a lot of stuff in my framework on top of VSTGUI in the latest years, so I guess I cannot simply switch to VST3Editor as I’ll probably need to adapt my code, but I’ll check it out.

Got it to work, btw…

On OSX it worked straight out of the box by setting the bitmap scale factor, while on Windows I just had to check if the process was HiDPI aware and then set the zoom factor and adjust the main window size according to the OS settings.

One thing I’ve noticed though, is that the CFrame::getCurrentMouseLocation(…) returns the position with the zoom applied, while the view size of the attached components doesn’t take that into account, causing wrong results upon CView::hitTest(…) and CRect::pointInside(…) calls.

I solved this by rescaling the mouse location to the non-zoomed value, but I was wondering if this CFrame::getCurrentMouseLocation(…) behavior is by design or not.
Maybe add a method that takes zoom into account would help?

Regards,
Federico

Why do you use CFrame::getCurrentMouseLocation() at all ? Normally you should rely on the coordinates passed to the onMouseDown/Moved/Up methods.