diff options
author | drewski207 <drewski207@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-09 00:08:05 +0000 |
---|---|---|
committer | drewski207 <drewski207@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-08-09 00:08:05 +0000 |
commit | 4e85bd67c3e3e65dd66c2f44594394d86d204d72 (patch) | |
tree | 2df6d55dfc08c52d7f04a61ddf1af37872d4f02a /src/corelib/x11 | |
parent | 7c683a4453a56e2b27a9d9a450e5078cb3d243c8 (diff) | |
download | fpGUI-4e85bd67c3e3e65dd66c2f44594394d86d204d72.tar.xz |
* Added a property to TfpgCanvasImpl(x11) FastDoubleBuffer
* Fixed painting of ListView Column
* Misc Listview painting changes
* Added OnColumnPaint to ListView
The new property FastDoubleBuffer will probably be moved to TfpgCanvaseBase also perhaps this can be set with an application
property since it doesn't free the backbuffer until the Canvas is freed which will result in some increase in memory usage.
The listview can have double buffering disabled now and it won't flicker sonce the painting is done with no overlapping rects.
Diffstat (limited to 'src/corelib/x11')
-rw-r--r-- | src/corelib/x11/gfx_x11.pas | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas index 55362421..e26550c3 100644 --- a/src/corelib/x11/gfx_x11.pas +++ b/src/corelib/x11/gfx_x11.pas @@ -80,12 +80,15 @@ type end; + { TfpgCanvasImpl } + TfpgCanvasImpl = class(TfpgCanvasBase) private FDrawing: boolean; FDrawWindow: TfpgWindowImpl; FBufferPixmap: TPixmap; FDrawHandle: TXID; + FFastDoubleBuffer: Boolean; Fgc: TfpgGContext; FCurFontRes: TfpgFontResourceImpl; FClipRect: TfpgRect; @@ -94,6 +97,9 @@ type FXftDrawBuffer: PXftDraw; FColorTextXft: TXftColor; FClipRegion: TRegion; + FPixHeight, + FPixWidth: Integer; + procedure TryFreePixmap; protected procedure DoSetFontRes(fntres: TfpgFontResourceBase); override; procedure DoSetTextColor(cl: TfpgColor); override; @@ -121,6 +127,7 @@ type public constructor Create; override; destructor Destroy; override; + property FastDoubleBuffer: Boolean read FFastDoubleBuffer write FFastDoubleBuffer; end; @@ -1243,12 +1250,14 @@ begin Fgc := nil; FXftDraw := nil; FClipRegion := nil; + FFastDoubleBuffer := True; end; destructor TfpgCanvasImpl.Destroy; begin if FDrawing then DoEndDraw; + TryFreePixmap; inherited Destroy; end; @@ -1282,15 +1291,21 @@ begin if buffered then begin - FBufferPixmap := XCreatePixmap(xapplication.display, FDrawWindow.FWinHandle, w, h, xapplication.DisplayDepth); + if (FastDoubleBuffer = False) or (FBufferPixmap = 0) or (w <> FPixWidth) or (h <> FPixHeight) then + begin + TryFreePixmap; + FBufferPixmap := XCreatePixmap(xapplication.display, FDrawWindow.FWinHandle, w, h, xapplication.DisplayDepth); + end; + FPixHeight := h; + FPixWidth := w; FDrawHandle := FBufferPixmap; end else begin - FBufferPixmap := 0; + TryFreePixmap; FDrawHandle := FDrawWindow.FWinHandle; end; - + Fgc := XCreateGc(xapplication.display, FDrawHandle, 0, @GcValues); // CapNotLast is so we get the same behavior as Windows. See documentation for more details. XSetLineAttributes(xapplication.display, Fgc, 0, LineSolid, CapNotLast, JoinMiter); @@ -1300,6 +1315,7 @@ begin XDefaultColormap(xapplication.display, xapplication.DefaultScreen)); FClipRegion := XCreateRegion; + end; FDrawing := True; @@ -1326,9 +1342,8 @@ begin XftDrawDestroy(FXftDraw); XFreeGc(xapplication.display, Fgc); - if FBufferPixmap > 0 then - XFreePixmap(xapplication.Display, FBufferPixmap); - FBufferPixmap := 0; + if FastDoubleBuffer = False then + TryFreePixmap; FDrawing := False; FDrawWindow := nil; @@ -1382,6 +1397,13 @@ begin Trunc(64 * a1), Trunc(64 * a2)); end; +procedure TfpgCanvasImpl.TryFreePixmap; +begin + if FBufferPixmap > 0 then + XFreePixmap(xapplication.Display, FBufferPixmap); + FBufferPixmap := 0; +end; + procedure TfpgCanvasImpl.DoSetFontRes(fntres: TfpgFontResourceBase); begin if fntres = nil then |