Retina and Offscreen bitmaps


#1

Jules, you warned about using offscreen bitmaps unless "you know what you are doing".

Well, it looks like I'm running into an issue as far as drawing on IPhone retina devices. They look blurry. I'm guessing its drawing to a much smaller bitmap than what these devices can handle. I've only tried in the simulator, but not sure why the actual device might differ. I'm not sure how to ask for a bitmap that would match the resolution properly I guess.

Oddly the splash screen also shows up wonky on these simulated device, its not drawn centered, and its large as well. However, IPad retina works fine(??!), but the simulator also draws it in a really big window.

Anyway, I can post a pic if it helps, but just wondered if I'm running into known issues (not necessarily juce, but generally speaking).


#2

Switching to Drawing directly instead of offscreen bitmaps does fix this bluriness problem. Which is unfortunate because it sped things up nicely.

However, I think juce has a bug with the SplashScreen on IPhone retina displays. It probably needs to compensate appropriately.


#3

The splash screen class is about 50 lines of trivial code that does a very simple job: You give it an image, and it creates a window the same size as that image, and draws the image inside it.

If you give it a double-resolution "retina" image, it has no way to know that you're giving it a high-DPI image and that you expect it to set its size to half the image's pixel size. If you want it to do that, you'd need to set its size or affine transform manually to compensate.


#4

And re: buffering to bitmaps, yes, like I warned, it's non-trivial. The Component::CachedComponentImage stuff handles display DPIs automatically, but if you're trying to do it manually, you're going to have to deal with scaling, which has some nasty edge-cases.

And although you think that you got a speed-up by buffering, remember that by using a low-res bitmap, you're drawing only 1/4 of the pixels. If you actually use a buffer with the same resolution as the display, it's probably going to be slower than just drawing directly because of the extra overhead.


#5

I'm surprised it draws it in the left/bottom corner though rather than centered, even with hard coded dimensions. I would think it should still be centered? My impression SplashScreen thinks its drawing it in portrait mode, when its in landscape on retina.

I'm sorry I guess I'm being dense, but I'm not understanding how to fix this based on dpi.


#6

Don't know - that sounds like a different issue to me, maybe the orientation changes after the window has been created, in which case if you don't explicitly reposition the window yourself, it'll get shifted around to whatever position fits on the screen, which might not be what you wanted.

TBH if I was doing an iOS app, I wouldn't use the splashscreen class - it's really designed for desktop stuff. On mobile, it probably makes more sense to have only one full-screen window, and put your own startup image inside that if needed, rather than having a separate window for it.


#7

FWIW, on IPhone retina, SplashScreen consistently makes its component 320x480, whereas IPad (and desktop), make the component 480x320. (This is using a 480x320 image.)

I find this bizarre as the SplashScreen sets its width/height explicitly to that of the image.