MG: accelerated GDIColor allocating

git-svn-id: trunk@1075 -
This commit is contained in:
lazarus 2002-02-09 01:47:47 +00:00
parent 76cf856886
commit 2ed90c3bbc

View File

@ -356,16 +356,27 @@ end;
Procedure FreeGDIColor(var GDIColor : TGDIColor);
begin
If (GDIColor.Color.Pixel <> -1) and (GDIColor.Colormap <> nil) then
if (cfColorAllocated in GDIColor.ColorFlags) then begin
if (GDIColor.Colormap <> nil) then
gdk_colormap_free_colors(GDIColor.Colormap,@GDIColor.Color, 1);
GDIColor.Color.Pixel := -1;
Exclude(GDIColor.ColorFlags,cfColorAllocated);
end;
end;
procedure SetGDIColorRef(var GDIColor : TGDIColor; NewColorRef: TColorRef);
begin
if GDIColor.ColorRef=NewColorRef then exit;
FreeGDIColor(GDIColor);
GDIColor.ColorRef:=NewColorRef;
end;
Procedure AllocGDIColor(DC : hDC; var GDIColor : TGDIColor);
var
RGBColor : Longint;
begin
if not (cfColorAllocated in GDIColor.ColorFlags) then begin
FreeGDIColor(GDIColor);
Case GDIColor.ColorRef of
@ -389,6 +400,8 @@ begin
GDIColor.Colormap := GDK_Colormap_get_system;
gdk_colormap_alloc_color(GDIColor.Colormap, @GDIColor.Color,True,True);
Include(GDIColor.ColorFlags,cfColorAllocated);
end;
end;
Procedure EnsureGCColor(DC: hDC; GC: PGDKGC; var GDIColor: TGDIColor;
@ -3506,6 +3519,9 @@ end;
{ =============================================================================
$Log$
Revision 1.116 2002/10/08 10:08:47 lazarus
MG: accelerated GDIColor allocating
Revision 1.115 2002/10/07 20:50:59 lazarus
MG: accelerated SelectGDKPenProps