Pavel wrote:
Hi.

Using CW 9.3
Linker : Palm OS 68k

Trying to do some drawing without PalmOS API.

template< U8 bpp > void SurfaceDid<bpp>::Fill ( COLOR col ) { PixelType c = (PixelType)col;
U8 *l=PixelPtr( 0, 0 ), *p=l;
for ( S16 y = 0; y < Height(); y++,NextY( l ), p=l ) // Height,NextY inlined for ( S16 x =0; x < Width(); x++,NextX( p ) ) // Width,NextX inlined
SetBitmapPixel( p, x, c ); // inlined
}


On device Tungsten|T PalmOS 5.0 performace is not acceptable : moving this
code to ArmLet will slove the problem ?
What will be ratio between this code and analogous realized with PalmOS API
 on earlyer devices ?

First of all, using comma-expressions in your for-loop incrementor is a bad idea. Optimizers do some tricky stuff with loops, and doing anything weird may cause it to fall back to safe (but slow) methods.


Second of all, you haven't shown the implementations of NextX, NextY, or SetBitmapPixel, and you don't seem to use bpp anywhere. This makes it very hard to figure out where your performance problem is, since it's not even apparent what many of your variables are; for instance, what is p? Is bpp in units of bits or bytes, and where is it even used? Is SetBitmapPixel an assignment, or does it involve reading and bit manipulations? And for that matter, what about Width() and Height()? Those should be evaluated once, not every iteration. You're asking the compiler to do too much to those little loops - it can't catch everything.


-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to