Hi
Is it much slower when using pointer to the function insted of function it self?
for example :
class Engine2D
{
private:
void DrawLine16bit(long x0, long y0, long x1, long y1,D3DCOLOR color);
void DrawLine32bit(long x0, long y0, long x1, long y1,D3DCOLOR color);
void inline PlotPixel16bit(long x,long y,D3DCOLOR col);
void inline PlotPixel32bit(long x,long y,D3DCOLOR col);
public:
void (Engine2D::*DrawLine)(long , long , long , long ,D3DCOLOR );
void (Engine2D::*PlotPixel)(long x,long y,D3DCOLOR col);
};
When im initializing my 2D engine i'm testing depth and based on it
pick right function to plot pixels and draw line but i'm not sure if it's better (faster) then simply make one function like this
PlotPixel(long x,long y,D3DCOLOR col)
{
if(bbp=32)
{
// plotpixel
}
else
{
// plotpixel
}
}
it's one "if" per pixel, but it's inline! When using pointers compiler won't be able to inline anything (even though PlotPixel16/32bit are marked as inline)! So the question is which way would be faster?