mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 02:10:08 +02:00
added simple heuristic for the meaning of PGdkImage^.bpp
git-svn-id: trunk@8075 -
This commit is contained in:
parent
c33f18f1a2
commit
efd9f8762c
@ -2303,7 +2303,7 @@ begin
|
||||
end;
|
||||
try
|
||||
// the minimum alignment we can detect is bpp
|
||||
// that is no problem since a line consists of n x bpp pixels
|
||||
// that is no problem since a line consists of n x bytesperpixel bytes
|
||||
case Image^.bpl of
|
||||
1: Desc^.LineEnd:=rileByteBoundary;
|
||||
2: Desc^.LineEnd:=rileWordBoundary;
|
||||
@ -2412,7 +2412,8 @@ begin
|
||||
// consistency checks
|
||||
if NewRawImage.Description.Depth<>AnImage^.Depth then
|
||||
RaiseGDBException('NewRawImage.Description.Depth<>AnImage^.Depth '+IntToStr(NewRawImage.Description.Depth)+'<>'+IntToStr(AnImage^.Depth));
|
||||
if NewRawImage.Description.BitsPerPixel<>AnImage^.bpp then
|
||||
//debugln('TGtkWidgetSet.GetRawImageFromGdkWindow NewRawImage.Description.BitsPerPixel=',dbgs(NewRawImage.Description.BitsPerPixel),' AnImage^.bpp=',dbgs(AnImage^.bpp),' GetPGdkImageBitsPerPixel(AnImage)=',dbgs(GetPGdkImageBitsPerPixel(AnImage)));
|
||||
if NewRawImage.Description.BitsPerPixel<>GetPGdkImageBitsPerPixel(AnImage) then
|
||||
RaiseGDBException('NewRawImage.Description.BitsPerPixel<>AnImage^.bpp');
|
||||
|
||||
NewRawImage.DataSize:=AnImage^.bpl * AnImage^.Height;
|
||||
@ -2496,7 +2497,7 @@ begin
|
||||
end;
|
||||
try
|
||||
{$IFDEF VerboseRawImage}
|
||||
DebugLn('TGTKWidgetSet.GetRawImageMaskFromGdkBitmap A BytesPerLine=',dbgs(AnImage^.bpl),' theType=',dbgs(AnImage^.thetype),' depth=',dbgs(AnImage^.depth),' BitsPerpixel=',dbgs(AnImage^.bpp));
|
||||
DebugLn('TGTKWidgetSet.GetRawImageMaskFromGdkBitmap A BytesPerLine=',dbgs(AnImage^.bpl),' theType=',dbgs(AnImage^.thetype),' depth=',dbgs(AnImage^.depth),' AnImage^.bpp=',dbgs(AnImage^.bpp));
|
||||
DebugLn('RawImage=',RawImageDescriptionAsString(@RawImage));
|
||||
{$ENDIF}
|
||||
|
||||
@ -2507,7 +2508,7 @@ begin
|
||||
9..32: RawImage.Description.AlphaLineEnd:=rileDWordBoundary;// X does not seem to use Word boundaries
|
||||
else RawImage.Description.AlphaLineEnd:=rileQWordBoundary;
|
||||
end;}
|
||||
RawImage.Description.AlphaBitsPerPixel:=AnImage^.bpp;
|
||||
RawImage.Description.AlphaBitsPerPixel:=GetPGdkImageBitsPerPixel(AnImage);
|
||||
|
||||
// consistency checks
|
||||
if RawImage.Description.AlphaBitsPerPixel<>AnImage^.Depth then
|
||||
|
@ -1362,6 +1362,13 @@ begin
|
||||
ReleaseDC(HDC(DestWidget),DestDC);
|
||||
end;
|
||||
|
||||
function GetPGdkImageBitsPerPixel(Image: PGdkImage): cardinal;
|
||||
begin
|
||||
Result:=Image^.bpp;
|
||||
if Result<Image^.Depth then
|
||||
Result:=Result*8;
|
||||
end;
|
||||
|
||||
function CreateGdkBitmap(Window: PGdkWindow;
|
||||
Width, Height: integer): PGdkBitmap;
|
||||
var
|
||||
|
@ -662,6 +662,7 @@ procedure DrawImageListIconOnWidget(ImgList: TCustomImageList;
|
||||
Index: integer; DestWidget: PGTKWidget;
|
||||
CenterHorizontally, CenterVertically: boolean;
|
||||
DestLeft, DestTop: integer);
|
||||
function GetPGdkImageBitsPerPixel(Image: PGdkImage): cardinal;
|
||||
{$IfDef Win32}
|
||||
Procedure gdk_window_copy_area(Dest: PGDKWindow; GC: PGDKGC;
|
||||
DestX, DestY: Longint; SRC: PGDKWindow; XSRC, YSRC, Width, Height: Longint);
|
||||
|
@ -1000,11 +1000,11 @@ begin
|
||||
{$IFDEF VerboseRawImage}
|
||||
DebugLn('TGtkWidgetSet.CreateBitmapFromRawImage GdkImage: ',
|
||||
' BytesPerLine=',dbgs(GdkImage^.bpl),
|
||||
' BytesPerPixel=',dbgs(GdkImage^.bpp),
|
||||
' BitsPerPixel=',dbgs(GetPGdkImageBitsPerPixel(GdkImage)),
|
||||
' ByteOrder=',dbgs(GdkImage^.byte_order),
|
||||
'');
|
||||
{$ENDIF}
|
||||
if (RawImage.Description.BitsPerPixel<>(cardinal(GdkImage^.bpp) shl 3))
|
||||
if (RawImage.Description.BitsPerPixel<>GetPGdkImageBitsPerPixel(GdkImage))
|
||||
then begin
|
||||
RaiseGDBException('TGtkWidgetSet.CreateBitmapFromRawImage Incompatible BitsPerPixel');
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user