{"action":"created","issue":{"url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/395","labels_url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/395/labels{/name}","comments_url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/395/comments","events_url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/395/events","html_url":"https://github.com/Virtual-TreeView/Virtual-TreeView/issues/395","id":55021933,"number":395,"title":"Incorrect ClipCanvas behavior in PaintTree().","user":{"login":"vincentparrett","id":1037262,"avatar_url":"https://avatars.githubusercontent.com/u/1037262?v=3","gravatar_id":"","url":"https://api.github.com/users/vincentparrett","html_url":"https://github.com/vincentparrett","followers_url":"https://api.github.com/users/vincentparrett/followers","following_url":"https://api.github.com/users/vincentparrett/following{/other_user}","gists_url":"https://api.github.com/users/vincentparrett/gists{/gist_id}","starred_url":"https://api.github.com/users/vincentparrett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincentparrett/subscriptions","organizations_url":"https://api.github.com/users/vincentparrett/orgs","repos_url":"https://api.github.com/users/vincentparrett/repos","events_url":"https://api.github.com/users/vincentparrett/events{/privacy}","received_events_url":"https://api.github.com/users/vincentparrett/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/labels/imported","name":"imported","color":"FFFFFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-21T13:59:51Z","updated_at":"2015-01-21T14:00:06Z","closed_at":null,"body":"_From [goobit....@gmail.com](https://code.google.com/u/102550060985554663110/) on November 30, 2013 00:20:51_\n\nThe problem occurs when poUnbuffered is set in PaintOptions. This code (line 31914 in r576 ):\r\n\r\n  . . .\r\n  else\r\n  begin\r\n    SetCanvasOrigin(PaintInfo.Canvas, -TargetRect.Left + Window.Left, -TargetRect.Top);\r\n    ClipCanvas(PaintInfo.Canvas, Rect(TargetRect.Left, TargetRect.Top, TargetRect.Right,\r\n    Min(TargetRect.Bottom, MaximumBottom)));\r\n  end;\r\n\r\nProblem that SetCanvasOrigin() calls before ClipCanvas(), which uses coordinates without taking into account previously changed canvas origin. \r\n\r\nSimplest way to fix it is just swap this lines: \r\n\r\n  . . .\r\n  else\r\n  begin\r\n    ClipCanvas(PaintInfo.Canvas, Rect(TargetRect.Left, TargetRect.Top, TargetRect.Right,\r\n    SetCanvasOrigin(PaintInfo.Canvas, -TargetRect.Left + Window.Left, -TargetRect.Top);\r\n    Min(TargetRect.Bottom, MaximumBottom)));\r\n  end;\n\n_Original issue: http://code.google.com/p/virtual-treeview/issues/detail?id=395_"},"comment":{"url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/comments/70841196","html_url":"https://github.com/Virtual-TreeView/Virtual-TreeView/issues/395#issuecomment-70841196","issue_url":"https://api.github.com/repos/Virtual-TreeView/Virtual-TreeView/issues/395","id":70841196,"user":{"login":"vincentparrett","id":1037262,"avatar_url":"https://avatars.githubusercontent.com/u/1037262?v=3","gravatar_id":"","url":"https://api.github.com/users/vincentparrett","html_url":"https://github.com/vincentparrett","followers_url":"https://api.github.com/users/vincentparrett/followers","following_url":"https://api.github.com/users/vincentparrett/following{/other_user}","gists_url":"https://api.github.com/users/vincentparrett/gists{/gist_id}","starred_url":"https://api.github.com/users/vincentparrett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincentparrett/subscriptions","organizations_url":"https://api.github.com/users/vincentparrett/orgs","repos_url":"https://api.github.com/users/vincentparrett/repos","events_url":"https://api.github.com/users/vincentparrett/events{/privacy}","received_events_url":"https://api.github.com/users/vincentparrett/received_events","type":"User","site_admin":false},"created_at":"2015-01-21T14:00:05Z","updated_at":"2015-01-21T14:00:05Z","body":"_From [joachim....@gmail.com](https://code.google.com/u/109917800154443778416/) on December 12, 2013 13:37:46_\n\nIs it sufficient to set toUnbuffered in PAintOptions to reproduce this bug?\r\nMay I ask why you use toUnbuffered?"}}