mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 19:16:12 +02:00
MG: accelerated GDIColor allocating
git-svn-id: trunk@1075 -
This commit is contained in:
parent
76cf856886
commit
2ed90c3bbc
@ -356,39 +356,52 @@ 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
|
||||||
gdk_colormap_free_colors(GDIColor.Colormap,@GDIColor.Color, 1);
|
if (GDIColor.Colormap <> nil) then
|
||||||
|
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
|
||||||
FreeGDIColor(GDIColor);
|
if not (cfColorAllocated in GDIColor.ColorFlags) then begin
|
||||||
|
FreeGDIColor(GDIColor);
|
||||||
Case GDIColor.ColorRef of
|
|
||||||
clScrollbar..clEndColors:
|
|
||||||
RGBColor := GetSysColor(GDIColor.ColorRef and $FF);
|
|
||||||
else
|
|
||||||
RGBColor := GDIColor.ColorRef and $FFFFFF;
|
|
||||||
end;
|
|
||||||
|
|
||||||
With GDIColor.Color do begin
|
|
||||||
Red := RGB(0,GetRValue(RGBColor),0);
|
|
||||||
Green := RGB(0,GetGValue(RGBColor),0);
|
|
||||||
Blue := RGB(0,GetBValue(RGBColor),0);
|
|
||||||
Pixel := 0;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{with TDeviceContext(DC) do
|
Case GDIColor.ColorRef of
|
||||||
If CurrentPalette <> nil then
|
clScrollbar..clEndColors:
|
||||||
GDIColor.Colormap := CurrentPalette^.PaletteColormap
|
RGBColor := GetSysColor(GDIColor.ColorRef and $FF);
|
||||||
else}
|
else
|
||||||
GDIColor.Colormap := GDK_Colormap_get_system;
|
RGBColor := GDIColor.ColorRef and $FFFFFF;
|
||||||
|
end;
|
||||||
|
|
||||||
gdk_colormap_alloc_color(GDIColor.Colormap, @GDIColor.Color,True,True);
|
With GDIColor.Color do begin
|
||||||
|
Red := RGB(0,GetRValue(RGBColor),0);
|
||||||
|
Green := RGB(0,GetGValue(RGBColor),0);
|
||||||
|
Blue := RGB(0,GetBValue(RGBColor),0);
|
||||||
|
Pixel := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{with TDeviceContext(DC) do
|
||||||
|
If CurrentPalette <> nil then
|
||||||
|
GDIColor.Colormap := CurrentPalette^.PaletteColormap
|
||||||
|
else}
|
||||||
|
GDIColor.Colormap := GDK_Colormap_get_system;
|
||||||
|
|
||||||
|
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