mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-22 20:19:09 +02:00
git-svn-id: trunk@45346 -
This commit is contained in:
parent
d8609cf93a
commit
208579db61
@ -1844,14 +1844,15 @@ begin
|
|||||||
S := GetSize;
|
S := GetSize;
|
||||||
if (X < 0) or (Y < 0) or (X > S.X - 1) or (Y > S.Y - 1) then Exit;
|
if (X < 0) or (Y < 0) or (X > S.X - 1) or (Y > S.Y - 1) then Exit;
|
||||||
|
|
||||||
R := Classes.Rect(X, Y, 1, 1);
|
R := Classes.Bounds(X, Y, 1, 1);
|
||||||
if not RawImage_FromBitmap(RawImage, HBITMAP(Bitmap), 0, @R) then Exit;
|
if not RawImage_FromBitmap(RawImage, HBITMAP(Bitmap), 0, @R) then Exit;
|
||||||
IntfImage := TLazIntfImage.Create(RawImage, True);
|
IntfImage := TLazIntfImage.Create(RawImage, True);
|
||||||
try
|
try
|
||||||
Result := IntfImage.TColors[X, Y];
|
Result := IntfImage.TColors[0, 0];
|
||||||
finally
|
finally
|
||||||
IntfImage.Free;
|
IntfImage.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -906,6 +906,7 @@ var Width, Height: Integer;
|
|||||||
WorkData: PByte = nil;
|
WorkData: PByte = nil;
|
||||||
MaskData: PByte = nil;
|
MaskData: PByte = nil;
|
||||||
MaskDataSize, WorkDataSize: PtrUInt;
|
MaskDataSize, WorkDataSize: PtrUInt;
|
||||||
|
Ptr: PByte;
|
||||||
|
|
||||||
function CreateSub(ARect: TRect; ABmp: TCarbonBitMap; BitsPerPixel: Integer; var ImageDataSize: PtrUInt): PByte;
|
function CreateSub(ARect: TRect; ABmp: TCarbonBitMap; BitsPerPixel: Integer; var ImageDataSize: PtrUInt): PByte;
|
||||||
var FullImageData, BytePtr: PByte;
|
var FullImageData, BytePtr: PByte;
|
||||||
@ -969,9 +970,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
WorkData := CreateSub(R, ABitmap, ARawImage.Description.BitsPerPixel, WorkDataSize);
|
// TODO: fix CreateSub which is broken at least for one pixel (@ 32bpp)
|
||||||
|
// In the mean time, here is a shortcut which should be also
|
||||||
|
// faster than CreateSub.
|
||||||
|
// Only tested with bitmaps at 32 bits per pixel. See bug #23112
|
||||||
|
if (Width=1) and (Height=1) and (AMask=nil) then
|
||||||
|
begin
|
||||||
|
WorkDataSize := (ARawImage.Description.BitsPerPixel + 7) div 8;
|
||||||
|
WorkData := System.GetMem(WorkDataSize);
|
||||||
|
Ptr := ABitmap.Data;
|
||||||
|
inc(Ptr, ARawImage.Description.BytesPerLine * R.Top);
|
||||||
|
Inc(Ptr, WorkDataSize * R.Left);
|
||||||
|
System.Move(Ptr^, WorkData^, WorkDataSize);
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
WorkData := CreateSub(R, ABitmap, ARawImage.Description.BitsPerPixel, WorkDataSize);
|
||||||
if AMask <> nil then
|
if AMask <> nil then
|
||||||
MaskData := CreateSub(R, AMask, 1, MaskDataSize);
|
MaskData := CreateSub(R, AMask, 1, MaskDataSize);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ARawImage.Description.Width := Width;
|
ARawImage.Description.Width := Width;
|
||||||
|
Loading…
Reference in New Issue
Block a user