I was just doing a little research into the fasted way to render a custom generated picture (not an embedded resource) into a HiDPI enabled project to share over OSX and Windows. My test was to create 2 pictures at 200x200, one generated using the window.BitmapForCaching(200,200) function and one generated with a 400x400 pixel image to be scaled at render.
Code for generating my two images are
[code]p1 = BitmapForCaching(200,200)
p1.Graphics.DrawPicture(TFS_LtGraySofa_S1763_4935,0,0,200,200,0,0,400,400)
p2 = new Picture(400,400,32)
p2.Graphics.DrawPicture(TFS_LtGraySofa_S1763_4935,0,0)[/code]
Where the source picture is 400x400 in size.
In a canvas’s paint event i did the following
[code]dim t as Integer = Ticks
dim d1,d2 as integer
dim i as integer
for i = 1 to 20000
g.DrawPicture(p1,50,50)
next i
d1 = Ticks - t
t = Ticks
for i = 1 to 20000
g.DrawPicture(p2,50,300,200,200,0,0,400,400)
next i
d2 = Ticks - t
g.FillRect(0,0,100,30)
g.ForeColor = &cFFFFFF
g.DrawString(str(d1) + " " + str(d2), 5, 25)
[/code]
This basically draws the pictures on top of each other 20000 times and looks how long it takes in ticks, rendering this result to the screen.
The output results are rather confusing to me.
OSX 64 Non Rentina screen
d1 = 23
d2 = 34
OSX 64 Retina Screen
d1 = 900 (40x slower)
d2 = 416 (12.5x slower)
Win 32 Surface Pro 4 HiDPI
d1 = 577
d2 = 562
The confusing part is the huge difference in time to render on a retina screen, 4 times dpi, but with 40x slower rendering.
The other odd part is that on a retina screen it is slower to use a pre cached bitmap.
I tested this on Xojo 2018r1.1 as well as 2017r2.1. (Mac is a iMac (Retina 5K, 27-inch, Late 2015))
Does anyone have any idea what is going on here and how i can get better rendering speeds on a retina screen.
I would of expected 4 -5 times slower rendering on retina but factors of 40 seems a little odd to me.