customdrawnws: Mode debug info and fixes an issue in the win32 backend painting, still missing something however

git-svn-id: trunk@33670 -
This commit is contained in:
sekelsenmat 2011-11-21 16:27:17 +00:00
parent 65165e6ebb
commit d8e9ca3b05
3 changed files with 28 additions and 25 deletions

View File

@ -64,7 +64,7 @@ begin
Result := IsValidDC(DC);
if Result then
QPainter_drawChord(TQtDeviceContext(DC).Widget, x1, y1, x2, y2, Angle1, Angle2);
end;
end;*)
{------------------------------------------------------------------------------
Function: BeginPaint
@ -74,15 +74,14 @@ end;
This function is Called:
- Once on every OnPaint event
------------------------------------------------------------------------------}
function TQtWidgetSet.BeginPaint(Handle: hWnd; Var PS : TPaintStruct): hdc;
function TCDWidgetSet.BeginPaint(Handle: hWnd; Var PS : TPaintStruct): hdc;
var
Widget: TQtWidget;
DC: TQtDeviceContext;
DC: TLazCanvas;
begin
{$ifdef VerboseQtWinAPI}
WriteLn('Trace:> [WinAPI BeginPaint] Handle=', dbghex(Handle));
{$ifdef VerboseCDWinAPI}
DebugLn('Trace:> [WinAPI BeginPaint] Handle=', dbghex(Handle));
{$endif}
Widget := TQtWidget(Handle);
(* Widget := TQtWidget(Handle);
if Widget <> nil then
DC := TQtDeviceContext.Create(Widget.PaintData.PaintWidget, True)
else
@ -113,9 +112,9 @@ begin
{$ifdef VerboseQtWinAPI}
WriteLn('Trace:< [WinAPI BeginPaint] Result=', dbghex(Result));
{$endif}
{$endif}*)
end;
(*
function TQtWidgetSet.BitBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Rop: DWORD): Boolean;
begin
{$ifdef VerboseQtWinAPI}
@ -482,7 +481,7 @@ function TQtWidgetSet.CreateCaret(Handle: HWND; Bitmap: hBitmap; Width, Height:
begin
Result := (Handle <> 0) and
QtCaret.CreateCaret(TQtWidget(Handle), Bitmap, Width, Height);
end;
end;*)
{------------------------------------------------------------------------------
Function: CreateCompatibleDC
@ -491,14 +490,14 @@ end;
Creates a memory device context (DC) compatible with the specified device.
------------------------------------------------------------------------------}
function TQtWidgetSet.CreateCompatibleDC(DC: HDC): HDC;
function TCDWidgetSet.CreateCompatibleDC(DC: HDC): HDC;
begin
{$ifdef VerboseQtWinAPI}
{$ifdef VerboseCDWinAPI}
WriteLn('[WinAPI CreateCompatibleDC] DC: ', dbghex(DC));
{$endif}
Result := HDC(TQtDeviceContext.Create(nil, True));
Result := 0;//HDC(TQtDeviceContext.Create(nil, True));
end;
(*
{------------------------------------------------------------------------------
Function: CreateEllipticRgn
Params: p1 - X position of the top-left corner

View File

@ -28,10 +28,10 @@
//##apiwiz##sps## // Do not remove, no wizard declaration before this line
(*
function Arc(DC: HDC; Left,Top,Right,Bottom,angle1,angle2 : Integer): Boolean; override;
function AngleChord(DC: HDC; x1, y1, x2, y2, angle1, angle2: Integer): Boolean; override;
function AngleChord(DC: HDC; x1, y1, x2, y2, angle1, angle2: Integer): Boolean; override;*)
function BeginPaint(Handle: hWnd; Var PS : TPaintStruct) : hdc; override;
function BitBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Rop: DWORD): Boolean; override;
(*function BitBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Rop: DWORD): Boolean; override;
function CallNextHookEx(hHk: HHOOK; ncode : Integer; wParam: WParam; lParam : LParam) : Integer; override;
function CallWindowProc(lpPrevWndFunc : TFarProc; Handle : HWND; Msg : UINT; wParam: WParam; lParam : lParam) : Integer; override;
@ -52,9 +52,9 @@ function CombineRgn(Dest, Src1, Src2: HRGN; fnCombineMode: Longint): Longint; o
function CreateBitmap(Width, Height: Integer; Planes, BitCount: Longint; BitmapBits: Pointer): HBITMAP; override;
function CreateBrushIndirect(const LogBrush: TLogBrush): HBRUSH; override;
function CreateCaret(Handle : HWND; Bitmap : hBitmap; Width, Height : Integer) : Boolean; override;
function CreateCompatibleBitmap(DC: HDC; Width, Height: Integer): HBITMAP; override;
function CreateCompatibleBitmap(DC: HDC; Width, Height: Integer): HBITMAP; override;*)
function CreateCompatibleDC(DC: HDC): HDC; override;
function CreateEllipticRgn(p1, p2, p3, p4: Integer): HRGN; override;
(*function CreateEllipticRgn(p1, p2, p3, p4: Integer): HRGN; override;
function CreateFontIndirect(const LogFont: TLogFont): HFONT; override;
function CreateFontIndirectEx(const LogFont: TLogFont; const LongFontName: string): HFONT; override;
function CreateIconIndirect(IconInfo: PIconInfo): HICON; override;

View File

@ -260,6 +260,10 @@ Var
end;
if (WindowInfo^.Canvas = nil) then WindowInfo^.Canvas := TLazCanvas.Create(WindowInfo^.Image);
{$ifdef VerboseCDWinAPI}
DebugLn(Format('[SendPaintMessage] WindowInfo^.Canvas=%s', [dbghex(PtrInt(WindowInfo^.Canvas))]));
{$endif}
// main processing
WinProcess := false;
try
@ -277,32 +281,32 @@ Var
GetLCLClientBoundsOffset(lWinControl, ORect);
PaintMsg.Msg := LM_PAINT;
PaintMsg.PaintStruct := @PS;
PaintMsg.DC := DC;
PaintMsg.DC := HDC(WindowInfo^.Canvas);
if not needParentPaint then
begin
// send through message to allow message override, moreover use SendMessage
// to allow subclass window proc override this message too
Include(TWinControlAccess(lWinControl).FWinControlFlags, wcfEraseBackground);
Windows.SendMessageW(lWinControl.Handle, WM_ERASEBKGND, Windows.WPARAM(PaintMsg.DC), 0);
Windows.SendMessageW(lWinControl.Handle, WM_ERASEBKGND, Windows.WPARAM(DC), 0);
Exclude(TWinControlAccess(lWinControl).FWinControlFlags, wcfEraseBackground);
end;
if (ControlDC = 0) or not needParentPaint then
begin
DCIndex := Windows.SaveDC(PaintMsg.DC);
DCIndex := Windows.SaveDC(DC);
{$ifdef DEBUG_WINDOW_ORG}
LCLIntf.GetWindowOrgEx(PaintMsg.DC, @WindowOrg);
LCLIntf.GetWindowOrgEx(DC, @WindowOrg);
DebugLn(
Format(':> [SendPaintMessage 2] Control=%s DC=%d Moving WindowOrg from %d,%d by DX=%d DY=%d',
[lWinControl.Name, PaintMsg.DC, WindowOrg.X, WindowOrg.Y, -parLeft, -parTop]));
{$endif}
MoveWindowOrgEx(PaintMsg.DC, ORect.Left, ORect.Top);
MoveWindowOrgEx(DC, ORect.Left, ORect.Top);
DeliverMessage(lWinControl, PaintMsg);
Windows.RestoreDC(PaintMsg.DC, DCIndex);
Windows.RestoreDC(DC, DCIndex);
{$ifdef DEBUG_WINDOW_ORG}
LCLIntf.GetWindowOrgEx(PaintMsg.DC, @WindowOrg);
LCLIntf.GetWindowOrgEx(DC, @WindowOrg);
DebugLn(
Format(':> [SendPaintMessage 3] Control=%s DC=%d WindowOrg=%d,%d',
[lWinControl.Name, PaintMsg.DC, WindowOrg.X, WindowOrg.Y]));