mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-27 03:29:12 +02:00
Qt5,Qt6: Small optimization by avoid deep copy when using QImage::bits(), better use const overload QImage::constBits().
This commit is contained in:
parent
674d4ebae9
commit
92b006ccaa
@ -757,7 +757,7 @@ var
|
||||
begin
|
||||
ARawImage.DataSize := QImage_numBytes(AImage);
|
||||
ARawImage.Data := GetMem(ARawImage.DataSize);
|
||||
Move(QImage_bits(AImage)^, ARawImage.Data^, ARawImage.DataSize);
|
||||
Move(QImage_constBits(AImage)^, ARawImage.Data^, ARawImage.DataSize);
|
||||
ARawImage.Mask := nil;
|
||||
end;
|
||||
|
||||
|
@ -1430,7 +1430,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtImage.bits: PByte;
|
||||
begin
|
||||
Result := QImage_bits(FHandle);
|
||||
Result := QImage_constBits(FHandle);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -2499,7 +2499,7 @@ begin
|
||||
if Count < Result then
|
||||
Result := Count;
|
||||
if Result > 0 then
|
||||
Move(QImage_bits(Image)^, Bits^, Result);
|
||||
Move(QImage_constBits(Image)^, Bits^, Result);
|
||||
finally
|
||||
QImage_destroy(Image);
|
||||
end;
|
||||
|
@ -778,7 +778,7 @@ var
|
||||
begin
|
||||
ARawImage.DataSize := QImage_numBytes(AImage);
|
||||
ARawImage.Data := GetMem(ARawImage.DataSize);
|
||||
Move(QImage_bits(AImage)^, ARawImage.Data^, ARawImage.DataSize);
|
||||
Move(QImage_constBits(AImage)^, ARawImage.Data^, ARawImage.DataSize);
|
||||
ARawImage.Mask := nil;
|
||||
end;
|
||||
|
||||
|
@ -1466,7 +1466,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TQtImage.bits: PByte;
|
||||
begin
|
||||
Result := QImage_bits(FHandle);
|
||||
Result := QImage_constBits(FHandle);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -2496,7 +2496,7 @@ begin
|
||||
if Count < Result then
|
||||
Result := Count;
|
||||
if Result > 0 then
|
||||
Move(QImage_bits(Image)^, Bits^, Result);
|
||||
Move(QImage_constBits(Image)^, Bits^, Result);
|
||||
finally
|
||||
QImage_destroy(Image);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user