#include <revolution/gx.h>
f32 GXGetYScaleFactor( u16 efbHeight, u16 xfbHeight );
| efbHeight | Height of embedded frame buffer (EFB). Range from 2 to 528 Should be multiples of two. |
xfbHeight |
Height of the external frame buffer (XFB) requested. Ranges from 2 to 1024. This needs to be equal to or greater than efbHeight. |
Returns a Y scale factor that can be used as an argument in the GXSetDispCopyYScale function.
This function calculates an appropriate Y scale factor value for GXSetDispCopyYScale based on the height of embedded frame buffer (EFB) and the height of external framebuffer (XFB) you intend to use.
This scale factor can be roughly calculated by the following equation:
yscale = (f32)xfbHeight / (f32)efbHeight;
which sometimes causes rounding error when the value is sent to the hardware register and you may not get the intended number of lines copied. So you should use this function to calculate accurate Y scale factors.
Note: It's still possible that you can't get the number of actual XFB lines you desired because of the hardware restriction. (For example, you can't get scaled 528 lines XFB from 480 lines EFB.) For such cases, this API returns a scale factor which makes the number of actual lines closer to the original xfbHeight argument. However, the number will never be greater than the original height. If you try 480 to 528 scaling, the number of actual lines becomes 527.
The number of actual lines copied is obtained as the return value of GXSetDispCopyYScale. Or you can use GXGetNumXfbLines as well.
GXSetDispCopyYScale
GXGetNumXfbLines
03/01/2006 Initial version