Doh. Well spotted. 

Looking back in SS in my original version I had dataPtr = ((u1*)bmPtr +
sizeof(BitmapType)); but I moved the cast when I cut and pasted :(

cheers again,
        Idries

> -----Original Message-----
> From: Ben Combee [mailto:[EMAIL PROTECTED]]
> Sent: 30 May 2002 13:54
> To: Palm Developer Forum
> Subject: RE: Drawing performance (was Access screen with Palm OS 4.0)
> 
> 
> In article <87618@palm-dev-forum>, [EMAIL PROTECTED] says...
> > One more problem that I am having, is accessing bitmap data 
> on pre OS 3.5.
> > On 3.5 I can use BmpGetBits (and I was never doing that 
> every frame :) and
> > on pre 3.5 I am using just incrementing my BitmapPtr by 
> sizeof(BitmapType)
> > because the documentation says that the bitmap data is 
> stored just after the
> > BitmapType struct. My bitmaps do not have colour tables, 
> but getting a
> > pointer via this method just gives me garbage, anyone know 
> where I'm going
> > wrong?
> > 
> >     u1* dataPtr;
> >     BitmapPtr bmPtr;
> > 
> >     dataPtr = (u1*)(bmPtr + sizeof(BitmapType));
> 
> Write
> 
>       dataPtr = (u1*)(bmPtr + 1);
> 
> or
> 
>       dataPtr = (u1*)((char *)bmPtr + sizeof(BitmapType));
> 
> Remember that adding 1 to a pointer increments it by the size 
> of what it 
> points to.  You were effectively incrementing your pointer by sizeof
> (BitmapType) squared.
> 
> -- 
> Ben Combee <[EMAIL PROTECTED]>
> CodeWarrior for Palm OS technical lead
> Get help at http://palmoswerks.com/
> 
> -- 
> For information on using the Palm Developer Forums, or to 
> unsubscribe, please see http://www.palmos.com/dev/support/forums/
> 

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

Reply via email to