h2pas: added tool to convert c function types to pointers

git-svn-id: trunk@11953 -
This commit is contained in:
mattias 2007-09-07 10:34:35 +00:00
parent 655e3ccb20
commit ca365cd4ff
12 changed files with 338 additions and 44 deletions

View File

@ -1632,7 +1632,7 @@ var
FuncName:=GetAtom;
ReadNextAtom;
if CurPos.Flag=cafRoundBracketOpen then begin
// skip empty parameter list ()
// skip optional empty parameter list ()
ReadNextAtom;
if CurPos.Flag<>cafRoundBracketClose then exit;
ReadNextAtom;
@ -1668,7 +1668,7 @@ var
if Node=nil then exit;
end;
if Node.Desc<>ctnBeginBlock then exit;
//DebugLn(['CheckProcNode has begin block']);
// check begin block is only a single assignment
@ -1717,9 +1717,11 @@ begin
TreeOfCodeTreeNodeExt:=nil;
try
BuildTree(false);
// first step: find all unit identifiers (excluding implementation section)
if not GatherUnitDefinitions(Definitions,true,true) then exit;
// now check all functions
Node:=Tree.Root;
while Node<>nil do begin
@ -1964,6 +1966,8 @@ begin
Result:=false;
TreeOfCodeTreeNodeExt:=nil;
try
BuildTree(false);
// first step: find all unit identifiers (excluding implementation section)
if not GatherUnitDefinitions(Definitions,true,true) then exit;
@ -2290,7 +2294,7 @@ begin
try
// move the pointer types to the same type sections
if not MovePointerTypesToTargetSections then exit;
if not BuildUnitDefinitionGraph(Definitions,Graph,false) then exit;
if not BuildUnitDefinitionGraph(Definitions,Graph,true) then exit;
finally
NodeExtMemManager.DisposeAVLTree(Definitions);
@ -2318,13 +2322,18 @@ function TCodeCompletionCodeTool.GatherUnitDefinitions(out
begin
NodeText:=GetRedefinitionNodeText(Node);
NodeExt:=FindCodeTreeNodeExt(TreeOfCodeTreeNodeExt,NodeText);
if NodeExt=nil then begin
NodeExt:=NodeExtMemManager.NewNode;
NodeExt.Txt:=NodeText;
TreeOfCodeTreeNodeExt.Add(NodeExt);
end else if ExceptionOnRedefinition then begin
RaiseRedefinition(NodeExt.Node,Node);
if NodeExt<>nil then begin
if NodeIsForwardProc(NodeExt.Node)
and (not NodeIsForwardProc(Node)) then begin
// this is the procedure body of the forward definition -> skip
exit;
end;
if ExceptionOnRedefinition then
RaiseRedefinition(NodeExt.Node,Node);
end;
NodeExt:=NodeExtMemManager.NewNode;
NodeExt.Txt:=NodeText;
TreeOfCodeTreeNodeExt.Add(NodeExt);
NodeExt.Node:=Node;
end;
@ -2395,8 +2404,8 @@ function TCodeCompletionCodeTool.BuildUnitDefinitionGraph(out
if NodeExt<>nil then begin
if Graph=nil then
Graph:=TCodeGraph.Create;
if Graph.GetEdge(Node,NodeExt.Node,false)=nil then
DebugLn(['CheckRange AddEdge: ',GetRedefinitionNodeText(Node),' uses ',GetRedefinitionNodeText(NodeExt.Node)]);
//if Graph.GetEdge(Node,NodeExt.Node,false)=nil then
// DebugLn(['CheckRange AddEdge: ',GetRedefinitionNodeText(Node),' uses ',GetRedefinitionNodeText(NodeExt.Node)]);
Graph.AddEdge(Node,NodeExt.Node);
end;
end;

View File

@ -104,6 +104,7 @@ type
function NodeIsMethodBody(ProcNode: TCodeTreeNode): boolean;
function NodeIsFunction(ProcNode: TCodeTreeNode): boolean;
function NodeIsConstructor(ProcNode: TCodeTreeNode): boolean;
function NodeIsForwardProc(ProcNode: TCodeTreeNode): boolean;
// classes
function ExtractClassName(ClassNode: TCodeTreeNode;
@ -1445,6 +1446,18 @@ begin
Result:=UpAtomIs('CONSTRUCTOR');
end;
function TPascalReaderTool.NodeIsForwardProc(ProcNode: TCodeTreeNode): boolean;
begin
Result:=false;
// check if procedure
if (ProcNode=nil) or (ProcNode.Desc<>ctnProcedure) then exit;
// check if in interface
if (ProcNode.Parent<>nil) and (ProcNode.Parent.Desc=ctnInterface) then
exit(true);
// check if has forward
if (ctnsForwardDeclaration and ProcNode.SubDesc)>0 then exit(true);
end;
function TPascalReaderTool.NodeIsPartOfTypeDefinition(ANode: TCodeTreeNode
): boolean;
begin

View File

@ -33,7 +33,8 @@ uses
type
{ TRemoveCPlusPlusExternCTool - Remove C++ 'extern "C"' lines }
{ TRemoveCPlusPlusExternCTool (for C header files)
Remove C++ 'extern "C"' lines }
TRemoveCPlusPlusExternCTool = class(TCustomTextConverterTool)
public
@ -42,7 +43,8 @@ type
end;
{ TRemoveEmptyCMacrosTool - Remove empty C macros}
{ TRemoveEmptyCMacrosTool (for C header files)
Remove empty C macros}
TRemoveEmptyCMacrosTool = class(TCustomTextConverterTool)
public
@ -51,7 +53,8 @@ type
end;
{ TReplaceEdgedBracketPairWithStar - Replace [] with * }
{ TReplaceEdgedBracketPairWithStar (for C header files)
Replace [] with * }
TReplaceEdgedBracketPairWithStar = class(TCustomTextReplaceTool)
public
@ -60,7 +63,7 @@ type
end;
{ TReplaceMacro0PointerWithNULL -
{ TReplaceMacro0PointerWithNULL (for C header files)
Replace macro values 0 pointer like (char *)0 with NULL }
TReplaceMacro0PointerWithNULL = class(TCustomTextConverterTool)
@ -69,7 +72,17 @@ type
function Execute(aText: TIDETextConverter): TModalResult; override;
end;
{ TConvertFunctionTypesToPointers (for C header files)
Replace function types with pointer to function type }
TConvertFunctionTypesToPointers = class(TCustomTextConverterTool)
public
class function ClassDescription: string; override;
function Execute(aText: TIDETextConverter): TModalResult; override;
end;
{ TReplaceUnitFilenameWithUnitName -
Replace "unit filename;" with "unit name;" }
@ -235,6 +248,14 @@ type
function Execute(aText: TIDETextConverter): TModalResult; override;
end;
{ TFixForwardDefinitions - reorder definitions }
TFixForwardDefinitions = class(TCustomTextConverterTool)
public
class function ClassDescription: string; override;
function Execute(aText: TIDETextConverter): TModalResult; override;
end;
type
{ TPretH2PasTools - Combines the common tools. }
@ -242,7 +263,8 @@ type
phRemoveCPlusPlusExternCTool, // Remove C++ 'extern "C"' lines
phRemoveEmptyCMacrosTool, // Remove empty C macros
phReplaceEdgedBracketPairWithStar, // Replace [] with *
phReplaceMacro0PointerWithNULL // Replace macro values 0 pointer like (char *)0
phReplaceMacro0PointerWithNULL, // Replace macro values 0 pointer like (char *)0
phConvertFunctionTypesToPointers // Convert function types to pointers
);
TPreH2PasToolsOptions = set of TPreH2PasToolsOption;
const
@ -278,7 +300,8 @@ type
phRemoveRedefinitionsInUnit, // Removes redefinitions of types, variables, constants and resourcestrings
phFixAliasDefinitionsInUnit, // fix section type of alias definitions
phReplaceConstFunctionsInUnit, // replace simple assignment functions with constants
phReplaceTypeCastFunctionsInUnit // replace simple type cast functions with types
phReplaceTypeCastFunctionsInUnit, // replace simple type cast functions with types
phFixForwardDefinitions // fix forward definitions by reordering
);
TPostH2PasToolsOptions = set of TPostH2PasToolsOption;
const
@ -2431,10 +2454,10 @@ begin
PChar(TImplicitType(Type2).Name));
end;
function CompareImplicitTypeStringAndName(ASCIIZ,
function CompareImplicitTypeStringAndName(Identifier,
ImplicitType: Pointer): integer;
begin
Result:=CompareIdentifiers(PChar(ASCIIZ),
Result:=CompareIdentifiers(PChar(Identifier),
PChar(TImplicitType(ImplicitType).Name));
end;
@ -3404,7 +3427,8 @@ begin
+'phRemoveCPlusPlusExternCTool - Remove C++ ''extern "C"'' lines'#13
+'phRemoveEmptyCMacrosTool - Remove empty C macros'#13
+'phReplaceEdgedBracketPairWithStar - Replace [] with *'#13
+'phReplace0PointerWithNULL - Replace macro values 0 pointer like (char *)0'#13;
+'phReplace0PointerWithNULL - Replace macro values 0 pointer like (char *)0'#13
+'phConvertFunctionTypesToPointers - Convert function types to pointers'#13;
end;
function TPreH2PasTools.Execute(aText: TIDETextConverter): TModalResult;
@ -3451,6 +3475,16 @@ begin
end;
end;
if phConvertFunctionTypesToPointers in Options then begin
Tool:=TConvertFunctionTypesToPointers.Create(nil);
try
Result:=Tool.Execute(aText);
if Result<>mrOk then exit;
finally
Tool.Free;
end;
end;
Result:=mrOk;
end;
@ -3498,7 +3532,8 @@ begin
+'phRemoveRedefinitionsInUnit - Removes redefinitions of types, variables, constants and resourcestrings'#13
+'phFixAliasDefinitionsInUnit - fix section type of alias definitions'#13
+'phReplaceConstFunctionsInUnit - replace simple assignment functions with constants'#13
+'phReplaceTypeCastFunctionsInUnit - replace simple type cast functions with types'#13;
+'phReplaceTypeCastFunctionsInUnit - replace simple type cast functions with types'#13
+'phFixForwardDefinitions - fix forward definitions by reordering'#13;
end;
function TPostH2PasTools.Execute(aText: TIDETextConverter): TModalResult;
@ -3636,6 +3671,10 @@ begin
if not FixAliasDefinitions(Changed,Result) then exit;
if not ConvertSimpleFunctions(Changed,Result) then exit;
until Changed=false;
// fix forward definitions
if not Run(phFixForwardDefinitions,
TFixForwardDefinitions,Result) then exit;
end;
{ TRemoveIncludeDirectives }
@ -3653,4 +3692,155 @@ begin
Options:=Options+[trtRegExpr];
end;
{ TConvertFunctionTypesToPointers }
class function TConvertFunctionTypesToPointers.ClassDescription: string;
begin
Result:='Convert function types to pointers';
end;
function TConvertFunctionTypesToPointers.Execute(aText: TIDETextConverter
): TModalResult;
var
Src: String;
SrcLen: Integer;
FuncTypes: TAvgLvlTree; // tree of TImplicitType
procedure CheckTypeDef(var p: integer);
// Check if it is: typedef identifier ( funcname ) (
var
StartPos: LongInt;
EndPos: LongInt;
NewType: TImplicitType;
begin
// typedef found
inc(p,length('typedef'));
// skip space
while (p<SrcLen) and IsSpaceChar[Src[p]] do inc(p);
// skip identifier
if not IsIdentStartChar[Src[p]] then exit;
while (p<SrcLen) and IsIdentChar[Src[p]] do inc(p);
// skip space
while (p<SrcLen) and IsSpaceChar[Src[p]] do inc(p);
// skip (
if Src[p]<>'(' then exit;
inc(p);
// skip space
while (p<SrcLen) and IsSpaceChar[Src[p]] do inc(p);
if p>=SrcLen then exit;
// read name of function type
StartPos:=p;
if not IsIdentStartChar[Src[p]] then exit;
while (p<SrcLen) and IsIdentChar[Src[p]] do inc(p);
EndPos:=p;
// skip space
while (p<SrcLen) and IsSpaceChar[Src[p]] do inc(p);
if p>=SrcLen then exit;
// skip )
if Src[p]<>')' then exit;
inc(p);
// skip space
while (p<SrcLen) and IsSpaceChar[Src[p]] do inc(p);
if p>=SrcLen then exit;
// skip (
if Src[p]<>'(' then exit;
// function type found
NewType:=TImplicitType.Create;
NewType.Name:=copy(Src,StartPos,EndPos-StartPos);
writeln('TConvertFunctionTypesToPointers.Execute.CheckType function type found Name=',NewType.Name);
if FuncTypes=nil then
FuncTypes:=TAvgLvlTree.Create(@CompareImplicitTypeNames);
FuncTypes.Add(NewType);
// add * in front of name
System.Insert('*',Src,StartPos);
SrcLen:=length(Src);
end;
procedure CheckIdentifier(var p: integer);
var
IdentPos: LongInt;
IdentEnd: LongInt;
begin
IdentPos:=p;
// skip identifier
while (p<=SrcLen) and IsIdentChar[Src[p]] do inc(p);
if FuncTypes.FindKey(@Src[IdentPos],@CompareImplicitTypeStringAndName)=nil
then
exit;
// this identifier is a function type
IdentEnd:=p;
// skip space
while (p<SrcLen) and IsSpaceChar[Src[p]] do inc(p);
if p>=SrcLen then exit;
// remove * behind identifier
if Src[p]<>'*' then exit;
writeln('TConvertFunctionTypesToPointers.Execute.CheckIdentifier removing * behind reference to ',GetIdentifier(@Src[IdentPos]));
System.Delete(Src,IdentEnd,p-IdentEnd+1);
SrcLen:=length(Src);
p:=IdentEnd;
end;
var
p: Integer;
begin
Result:=mrCancel;
if aText=nil then exit;
FuncTypes:=nil;
try
Src:=aText.Source;
SrcLen:=length(Src);
// Search all typedef identifier ( funcname ) (
// and insert a * in front of the funcname
p:=1;
while (p<SrcLen) do begin
if (Src[p]='t') and ((p=1) or (not IsIdentChar[Src[p-1]]))
and (CompareIdentifiers('typedef',@Src[p])=0) then begin
CheckTypeDef(p);
end else
inc(p);
end;
if FuncTypes<>nil then begin
// remove the * behind all references
p:=1;
while (p<SrcLen) do begin
if (IsIdentStartChar[Src[p]]) and ((p=1) or (not IsIdentChar[Src[p-1]]))
then begin
CheckIdentifier(p);
end else
inc(p);
end;
end;
finally
if FuncTypes<>nil then begin
FuncTypes.FreeAndClear;
FuncTypes.Free;
aText.Source:=Src;
end;
end;
Result:=mrOk;
end;
{ TFixForwardDefinitions }
class function TFixForwardDefinitions.ClassDescription: string;
begin
Result:='Fix forward definitions by reordering';
end;
function TFixForwardDefinitions.Execute(aText: TIDETextConverter
): TModalResult;
begin
Result:=mrCancel;
if (not FilenameIsPascalUnit(aText.Filename)) then begin
DebugLn(['TFixForwardDefinitions.Execute file is not pascal: ',aText.Filename]);
exit(mrOk);// ignore
end;
if not CodeToolBoss.FixForwardDefinitions(TCodeBuffer(aText.CodeBuffer)) then begin
DebugLn(['TFixForwardDefinitions.Execute failed ',CodeToolBoss.ErrorMessage]);
exit;
end;
Result:=mrOk;
end;
end.

View File

@ -214,6 +214,7 @@ begin
TextConverterToolClasses.RegisterClass(TRemoveEmptyCMacrosTool);
TextConverterToolClasses.RegisterClass(TReplaceEdgedBracketPairWithStar);
TextConverterToolClasses.RegisterClass(TReplaceMacro0PointerWithNULL);
TextConverterToolClasses.RegisterClass(TConvertFunctionTypesToPointers);
TextConverterToolClasses.RegisterClass(TPostH2PasTools);
TextConverterToolClasses.RegisterClass(TReplaceUnitFilenameWithUnitName);
TextConverterToolClasses.RegisterClass(TRemoveSystemTypes);
@ -224,8 +225,10 @@ begin
TextConverterToolClasses.RegisterClass(TReplaceImplicitTypes);
TextConverterToolClasses.RegisterClass(TFixArrayOfParameterType);
TextConverterToolClasses.RegisterClass(TRemoveRedefinitionsInUnit);
TextConverterToolClasses.RegisterClass(TFixAliasDefinitionsInUnit);
TextConverterToolClasses.RegisterClass(TReplaceConstFunctionsInUnit);
TextConverterToolClasses.RegisterClass(TReplaceTypeCastFunctionsInUnit);
TextConverterToolClasses.RegisterClass(TFixForwardDefinitions);
end;
{ TH2PasDialog }

View File

@ -41,7 +41,7 @@ interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
Buttons, ExtCtrls, Spin, MaskEdit, ComCtrls, LCLType,
Buttons, ExtCtrls, Spin, ComCtrls, LCLType,
Printers, OsPrinters, CUPSDyn;
type

View File

@ -25,19 +25,19 @@
</RunParams>
<RequiredPackages Count="4">
<Item1>
<PackageName Value="SimpleIDEIntf"/>
<MinVersion Valid="True"/>
<PackageName Value="CodeTools"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
<MinVersion Major="1" Valid="True"/>
</Item2>
<Item3>
<PackageName Value="H2PasWizard"/>
<MinVersion Valid="True"/>
</Item2>
<Item3>
<PackageName Value="LCL"/>
<MinVersion Major="1" Valid="True"/>
</Item3>
<Item4>
<PackageName Value="CodeTools"/>
<PackageName Value="SimpleIDEIntf"/>
<MinVersion Valid="True"/>
</Item4>
</RequiredPackages>
<Units Count="1">

View File

@ -53,6 +53,19 @@ begin
end;
end;
procedure TestTConvertFunctionTypesToPointers(Converter: TIDETextConverter);
var
Tool: TConvertFunctionTypesToPointers;
begin
Tool:=nil;
try
Tool:=TConvertFunctionTypesToPointers.Create(nil);
Tool.Execute(Converter);
finally
Tool.Free;
end;
end;
var
Filename: String;
Converter: TIDETextConverter;
@ -75,7 +88,8 @@ begin
// test
TestTReplaceImplicitTypes(Converter);
TestTFixArrayOfParameterType(Converter);
TestTConvertFunctionTypesToPointers(Converter);
// write result
writeln(Converter.Source);
finally

View File

@ -34,9 +34,23 @@ type
TLazyTextConverterToolClasses = class(TTextConverterToolClasses)
protected
function SupportsType(aTextType: TTextConverterType): boolean; override;
function GetTempFilename: string; override;
function LoadFromFile(Converter: TIDETextConverter; const AFilename: string;
UpdateFromDisk, Revert: Boolean): Boolean; override;
function SaveCodeBufferToFile(Converter: TIDETextConverter;
const AFilename: string): Boolean; override;
function GetCodeBufferSource(Converter: TIDETextConverter;
out Source: string): boolean; override;
function CreateCodeBuffer(Converter: TIDETextConverter;
const Filename, NewSource: string;
out CodeBuffer: Pointer): boolean; override;
function LoadCodeBufferFromFile(Converter: TIDETextConverter;
const Filename: string;
UpdateFromDisk, Revert: Boolean;
out CodeBuffer: Pointer): boolean; override;
end;
procedure SetupTextConverters;
@ -123,6 +137,12 @@ end;
{ TLazyTextConverterToolClasses }
function TLazyTextConverterToolClasses.SupportsType(
aTextType: TTextConverterType): boolean;
begin
Result:=aTextType in [tctSource,tctFile,tctStrings];
end;
function TLazyTextConverterToolClasses.GetTempFilename: string;
var
BaseDir: String;
@ -138,6 +158,43 @@ begin
Result:=Converter.LoadFromFile(AFilename,false,UpdateFromDisk,Revert);
end;
function TLazyTextConverterToolClasses.SaveCodeBufferToFile(
Converter: TIDETextConverter; const AFilename: string): Boolean;
begin
raise Exception.Create('SaveCodeBufferToFile not supported');
if (Converter=nil) and (aFilename='') then;
Result:=false;
end;
function TLazyTextConverterToolClasses.GetCodeBufferSource(
Converter: TIDETextConverter; out Source: string): boolean;
begin
raise Exception.Create('GetCodeBufferSource not supported');
Source:='';
if Converter=nil then;
Result:=false;
end;
function TLazyTextConverterToolClasses.CreateCodeBuffer(
Converter: TIDETextConverter; const Filename, NewSource: string; out
CodeBuffer: Pointer): boolean;
begin
raise Exception.Create('CreateCodeBuffer not supported');
CodeBuffer:=nil;
if (Converter=nil) and (Filename='') and (NewSource='') then;
Result:=false;
end;
function TLazyTextConverterToolClasses.LoadCodeBufferFromFile(
Converter: TIDETextConverter; const Filename: string; UpdateFromDisk,
Revert: Boolean; out CodeBuffer: Pointer): boolean;
begin
raise Exception.Create('LoadCodeBufferFromFile not supported');
CodeBuffer:=nil;
if (Converter=nil) and (Filename='') and UpdateFromDisk and Revert then;
Result:=false;
end;
initialization
REException:=ERegExpr;
REMatchesFunction:=@SynREMatches;

View File

@ -1223,7 +1223,7 @@ begin
Size := GetBitsPerLine(Width, BitsPerPixel, LineEnd);
Size := (Size * Description.Height) shr 3;
if Size <= High(DataSize)
if Size < High(DataSize)
then DataSize := Size
else DataSize := High(DataSize);
@ -1240,7 +1240,7 @@ begin
Size := GetBitsPerLine(Width, MaskBitsPerPixel, MaskLineEnd);
Size := (Size * Description.Height) shr 3;
if Size <= High(MaskSize)
if Size < High(MaskSize)
then MaskSize := Size
else MaskSize := High(MaskSize);

View File

@ -468,8 +468,10 @@ end;
Deletes the image identified by Index. An index of -1 deletes all
------------------------------------------------------------------------------}
procedure TCustomImageList.Delete(AIndex: Integer);
{$ifdef IMGLIST_OLDSTYLE}
var
Obj : TObject;
{$ENDIF}
begin
if AIndex = -1
then begin
@ -510,8 +512,10 @@ end;
Destructor for the class.
------------------------------------------------------------------------------}
destructor TCustomImageList.Destroy;
{$ifdef IMGLIST_OLDSTYLE}
var
i: integer;
{$ENDIF}
begin
{$ifdef IMGLIST_OLDSTYLE}
FBitmap.Free;
@ -542,8 +546,10 @@ end;
------------------------------------------------------------------------------}
procedure TCustomImageList.Draw(ACanvas: TCanvas; AX, AY, AIndex: Integer;
AEnabled: Boolean);
{$ifdef IMGLIST_OLDSTYLE}
var
aBitmap: TBitmap;
{$ENDIF}
begin
if (FCount = 0) or (AIndex >= FCount) then Exit;
@ -1062,8 +1068,10 @@ end;
------------------------------------------------------------------------------}
procedure TCustomImageList.WriteData(AStream: TStream);
var
{$ifdef IMGLIST_OLDSTYLE}
CurImage: TBitMap;
i: Integer;
{$ENDIF}
Signature: TImageListSignature;
begin
//Write signature
@ -1546,7 +1554,10 @@ end;
procedure TCustomImageList.StretchDraw(Canvas: TCanvas; Index: Integer; ARect: TRect; Enabled: Boolean);
var
bmp, msk: TBitmap;
bmp: TBitmap;
{$ifdef IMGLIST_OLDSTYLE}
msk: TBitmap;
{$ENDIF}
begin
if (FCount = 0) or (Index >= FCount) then Exit;

View File

@ -146,7 +146,7 @@ var
ImgDepth: Byte absolute ARawImage.Description.Depth;
ImgDataSize: PtrUInt absolute ARawImage.DataSize;
Drawable: PGdkDrawable;
Bitmap, Inverse: PGdkBitmap;
Bitmap: PGdkBitmap;
Pixbuf: PGdkPixbuf;
GC: PGdkGC;
Visual: PGdkVisual;
@ -292,11 +292,11 @@ begin
GdkImage := gdk_image_new(GDK_IMAGE_FASTEST, Visual, ImgWidth, ImgHeight);
{$ifdef VerboseRawImage}
{DebugLn('TGtkWidgetSet.CreateBitmapFromRawImage GdkImage: ',
' BytesPerLine=',dbgs(GdkImage^.bpl),
' BitsPerPixel=',dbgs(GetPGdkImageBitsPerPixel(GdkImage)),
' ByteOrder=',dbgs({$ifdef Gtk1}GdkImage^.byte_order{$else}ord(GdkImage^.byte_order){$endif}),
'');}
//DebugLn('TGtkWidgetSet.CreateBitmapFromRawImage GdkImage: ',
// ' BytesPerLine=',dbgs(GdkImage^.bpl),
// ' BitsPerPixel=',dbgs(GetPGdkImageBitsPerPixel(GdkImage)),
// ' ByteOrder=',dbgs({$ifdef Gtk1}GdkImage^.byte_order{$else}ord(GdkImage^.byte_order){$endif}),
// '');
{$endif}
if ARawImage.Description.BitsPerPixel <> GetGdkImageBitsPerPixel(GdkImage)

View File

@ -2504,9 +2504,6 @@ var
var
Width, Height, H, W, D: cardinal;
Image: PGdkImage;
BytesPerLine: Integer;
SrcPtr, DstPtr: PByte;
Mask: QWord;
begin
Result := False;