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

A user interface toolkit mainly for audio plug-ins (VST, AudioUnit, etc).
f.berti
Posts: 18
Joined: Thu Nov 02, 2017 5:50 pm

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

Postby f.berti » Tue Oct 23, 2018 10:59 am

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:

Code: Select all

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:

Code: Select all

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?
Last edited by f.berti on Tue Oct 30, 2018 8:54 am, edited 1 time in total.

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

Re: [HiDPI] CFrame always returns scale factor 1

Postby Arne Scheffler » Tue Oct 23, 2018 12:18 pm

Hi,
first of all, you have to setup your bitmaps as I described to you here: https://sdk.steinberg.net/viewtopic.php?f=5&t=594.
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

f.berti
Posts: 18
Joined: Thu Nov 02, 2017 5:50 pm

Re: [HiDPI] CFrame always returns scale factor 1

Postby f.berti » Tue Oct 23, 2018 12:55 pm

Thanks for the quick reply!

Arne Scheffler wrote:first of all, you have to setup your bitmaps as I described to you here: https://sdk.steinberg.net/viewtopic.php?f=5&t=594.

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!

Arne Scheffler wrote:By the way, way are you not using the VST3Editor class with its WYSIWYG editor ?

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.

f.berti
Posts: 18
Joined: Thu Nov 02, 2017 5:50 pm

Re: [HiDPI] CFrame always returns scale factor 1

Postby f.berti » Tue Oct 30, 2018 8:54 am

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

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

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

Postby Arne Scheffler » Mon Nov 05, 2018 5:03 pm

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


Return to “VSTGUI”

Who is online

Users browsing this forum: No registered users and 1 guest