after patch the "memleak+newcontrols.patch", display resolution is broken..

Jul 29, 2010 at 4:27 AM

happend the memory leak...

so i find the patch and patch the fluid control class..

but display is broken..

it's look like display resolution be 120*160 ( my display reolution is 480 * 800 )

so only show left top area of full screen..

plz i need another help...

Jul 29, 2010 at 7:12 AM

Hello,

I think this is due to the fact that I changed the way Fluid controls handle scaling (i.e. how to increase/decrease size when screen resolution changes). I did this because I'm working on several devices with different resolutions (actually 240x320, 320x240, 240x400, 400x240, 480x640, 640x480, 480x800, 800x480) and thus I had to find a coordinate system that works with every resolution without having to rely on Anchors (as I found they don't work too well with Fluid) and without having to have converters or code to update sizes and positions on resize.

The solution I found was to use the minimun supported resolution (240x320) as a base resolution (which would become the scale factor 1:1) and specify all my measures as if the final screen resolution will be 240x320 and then let the scaling mechanism already in place in Fluid do the conversions using a calculated scale factor. In Fluid's original release Tom69 was using the ScaleFactor returned by the Operating System but I found some display bugs while using it (I don't remember which as it was several months [almost a year] ago; maybe when dpi change from the original 96dpi for 240x320 resolution).

So in your case you have two choice (three in fact, but I don't think you want to rollback the patch :)):

1 - Consider 240x320 as being the base resolution and thus modify all your measures to be based on a 240x320 resolution (i.e. modify each 'new Rectangle(x, y, w, h)' and 'new Size(w, h)' and 'new Point(x, y)' by dividing x and w by 2 and y and h by 2.5): This would be a long task

2 - Consider 480x800 as your base resolution and thus modify the scaling calculator to use this as a base: This would mean that if your application is run on a lower resolution some controls may be too small or outside of the screen. The modification has to be done like this (very simple):

Open Fluid\Native\NativeMethods.cs.

Into this file there is a class named MiniHAL, replace the values 240 and 320 with 480 and 800 into ScreenWidth, ScreenHeight and ScaleFactor.

Save and re-compile your project.

 

If this doesn't solve your issue please send me a screenshot (you can use www.mymobiler.com to take a screenshot) and the code used to build the screenshot so I can take a look and correct my patch or your code if I find the issue into them.

 

Best regards,

Jul 30, 2010 at 7:08 AM
Edited Jul 30, 2010 at 7:09 AM

Thank you for your kindness..

I choice 2 in your solution..

I changed some code...

1. NativeMethods.cs

 -  width : 240 -> 480

 - height : 320 -> 800

2. control.cs

public Rectangle Scale(Rectangle r)
{
                    double xFactor, yFactor;
                    //return r;
                    xFactor = MiniHAL.ScreenWidth / 480.0;
                    yFactor = MiniHAL.ScreenHeight / 800.0;
                    if (r.X <= 480) r.X = (int)Math.Min(r.X * xFactor, MiniHAL.ScreenWidth);
                    if (r.Y <= 800) r.Y = (int)Math.Min(r.Y * yFactor, MiniHAL.ScreenHeight);
                    if (r.Width <= 480) r.Width = (int)Math.Min(r.Width * xFactor, MiniHAL.ScreenWidth);
                    if (r.Height <= 800) r.Height = (int)Math.Min(r.Height * yFactor, MiniHAL.ScreenHeight);
                    if (r.Right > MiniHAL.ScreenWidth) r.X = MiniHAL.ScreenWidth - r.Width;
                    if (r.Bottom > MiniHAL.ScreenHeight) r.Y = MiniHAL.ScreenHeight - r.Height;
                    return r;
}
public Point Scale(Point p)
{
                    double xFactor, yFactor;
                    //return p;
                    xFactor = MiniHAL.ScreenWidth / 480.0;
                    yFactor = MiniHAL.ScreenHeight / 800.0;
                    if (p.X < 480 && p.X != int.MinValue) p.X = (int)Math.Min(p.X * xFactor, MiniHAL.ScreenWidth);
                    if (p.Y < 800 && p.X != int.MinValue) p.Y = (int)Math.Min(p.Y * yFactor, MiniHAL.ScreenHeight);
                    return p;
    }

 - before code is xFactor set  < int > but.. resolution scale is not int resolution... so... i fixed like this..

 

thank you for your genius. ;)