[Lazarus] Slow pointer assignments
Leonardo M. Ramé
l.rame at griensu.com
Thu Apr 18 19:53:45 CEST 2013
On 2013-04-18 12:49:07 -0300, Leonardo M. Ramé wrote:
> On 2013-04-18 08:48:11 -0700, leledumbo wrote:
> > Assign all the RGBA value in one go, that would reduce the inner loop by 4
> > times. i.e.:
> >
> > var
> > PixelPtr: PLongWord;
> > PixelRowPtr: PByte;
> > begin
> > PixelRowPtr := Fbmp.RawImage.Data;
> > for Y := 0 to Self.Height - 1 do
> > begin
> > PixelPtr := PLongWord(PixelRowPtr);
> > for X := 0 to (Self.Width - 1) div 4 do
> > begin
> > PixelPtr^ := (lRed shl 24) or (lGreen shl 16) or (lBlue shl 8) or 255;
> > Inc(PixelPtr);
> > end;
> > Inc(PixelRowPtr, FBmp.RawImage.Description.BytesPerLine);
> > end;
> > end;
> >
>
> Great!, I'll try it.
>
Well, it's speed improved, but the image is blue... Do you know why?.
--
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the Lazarus
mailing list