mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 04:41:25 +02:00
MG: accelerated GDIColor allocating
git-svn-id: trunk@1075 -
This commit is contained in:
parent
76cf856886
commit
2ed90c3bbc
@ -356,16 +356,27 @@ end;
|
|||||||
|
|
||||||
Procedure FreeGDIColor(var GDIColor : TGDIColor);
|
Procedure FreeGDIColor(var GDIColor : TGDIColor);
|
||||||
begin
|
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);
|
gdk_colormap_free_colors(GDIColor.Colormap,@GDIColor.Color, 1);
|
||||||
|
|
||||||
GDIColor.Color.Pixel := -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;
|
end;
|
||||||
|
|
||||||
Procedure AllocGDIColor(DC : hDC; var GDIColor : TGDIColor);
|
Procedure AllocGDIColor(DC : hDC; var GDIColor : TGDIColor);
|
||||||
var
|
var
|
||||||
RGBColor : Longint;
|
RGBColor : Longint;
|
||||||
begin
|
begin
|
||||||
|
if not (cfColorAllocated in GDIColor.ColorFlags) then begin
|
||||||
FreeGDIColor(GDIColor);
|
FreeGDIColor(GDIColor);
|
||||||
|
|
||||||
Case GDIColor.ColorRef of
|
Case GDIColor.ColorRef of
|
||||||
@ -389,6 +400,8 @@ begin
|
|||||||
GDIColor.Colormap := GDK_Colormap_get_system;
|
GDIColor.Colormap := GDK_Colormap_get_system;
|
||||||
|
|
||||||
gdk_colormap_alloc_color(GDIColor.Colormap, @GDIColor.Color,True,True);
|
gdk_colormap_alloc_color(GDIColor.Colormap, @GDIColor.Color,True,True);
|
||||||
|
Include(GDIColor.ColorFlags,cfColorAllocated);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Procedure EnsureGCColor(DC: hDC; GC: PGDKGC; var GDIColor: TGDIColor;
|
Procedure EnsureGCColor(DC: hDC; GC: PGDKGC; var GDIColor: TGDIColor;
|
||||||
@ -3506,6 +3519,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$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
|
Revision 1.115 2002/10/07 20:50:59 lazarus
|
||||||
MG: accelerated SelectGDKPenProps
|
MG: accelerated SelectGDKPenProps
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user