View Issue Details

IDProjectCategoryView StatusLast Update
0028015LazarusWidgetsetpublic2015-05-02 17:45
ReporterFelipe Monteiro de CarvalhoAssigned ToFelipe Monteiro de Carvalho 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionProduct Build 
Target VersionFixed in Version1.5 (SVN) 
Summary0028015: DrawText with clip on results in subsequent paint operations failing
DescriptionAfter many hours debugging I found that apparently the Cocoa function to save/restore DC doesn't save/restore the clip region, and subsequent paint operations outside the text area will fail.

Minimal test case to reproduce:

procedure TForm1.FormCreate(Sender: TObject);
begin
  F_TreeListView := TBitmap.Create;
  F_TreeListView.SetSize(400, 400);
end;

procedure TForm1.FormPaint(Sender: TObject);
var
  F_StripedOddColor, F_StripedEvenColor: TColor;
  temp: TRect;
  flags: longint;
  lStr: string = '10 - 0 = 10';
begin
  F_StripedOddColor := clWindow;
  F_StripedEvenColor := $00E0FFFF;

  F_TreeListView.canvas.Brush.Color := F_StripedEvenColor;
  F_TreeListView.Canvas.FillRect(rect(0,20,F_TreeListView.width,40));

  flags := DT_NOPREFIX or DT_SINGLELINE or DT_VCENTER or DT_END_ELLIPSIS or DT_LEFT;
  temp := Rect(170, 18, 270, 34);
  LCLIntf.DrawText(F_TreeListView.canvas.Handle, PChar(lStr), length(lStr), temp, flags);

  // The operations bellow will not paint
  F_TreeListView.canvas.Brush.Color := F_StripedOddColor;
  F_TreeListView.Canvas.FillRect(rect(0,40,F_TreeListView.width,60));

  F_TreeListView.canvas.Brush.Color := F_StripedEvenColor;
  F_TreeListView.Canvas.FillRect(rect(0,60,F_TreeListView.width,80));

  Canvas.Draw(0, 0, F_TreeListView);
end;

This appeared in TreeListView as only the first line being painted.
TagsNo tags attached.
Fixed in Revision48917
LazTarget-
WidgetsetCocoa
Attached Files

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2015-05-02 17:38 Felipe Monteiro de Carvalho New Issue
2015-05-02 17:38 Felipe Monteiro de Carvalho Assigned To => Felipe Monteiro de Carvalho
2015-05-02 17:38 Felipe Monteiro de Carvalho Status new => assigned
2015-05-02 17:45 Felipe Monteiro de Carvalho Fixed in Revision => 48917
2015-05-02 17:45 Felipe Monteiro de Carvalho Status assigned => resolved
2015-05-02 17:45 Felipe Monteiro de Carvalho Fixed in Version => 1.5 (SVN)
2015-05-02 17:45 Felipe Monteiro de Carvalho Resolution open => fixed