From 89c374f1980541f20659191a2b4342916f04a713 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sat, 23 Jan 2016 16:10:38 +0000 Subject: [PATCH] fpspreadsheet: Fix clip rect error when painting TsWorksheet fixed cells. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4461 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/fpspreadsheetgrid.pas | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/components/fpspreadsheet/fpspreadsheetgrid.pas b/components/fpspreadsheet/fpspreadsheetgrid.pas index 6fd9e7d5b..2765b7d4d 100644 --- a/components/fpspreadsheet/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/fpspreadsheetgrid.pas @@ -2077,7 +2077,7 @@ begin fixed_rct := Rect(0, 0, 0, 0); if HeaderCount > 0 then - ColRowToOffset(true, false, 0, fixed_rct.Left, fixed_rct.Right); + ColRowToOffset(true, true, 0, fixed_rct.Left, fixed_rct.Right); // is this row within the ClipRect? clipArea := Canvas.ClipRect; @@ -2238,24 +2238,18 @@ begin rct.Top := temp_rct.Top; rct.Bottom := temp_rct.Bottom; - { - if IsRightToLeft then - begin - ColRowToOffset(true, true, gc, tmp, rct.Right); - ColRowToOffset(true, true, gcNext-1, rct.Left, tmp); - end else - begin - ColRowToOffset(true, true, gc, rct.Left, tmp); - ColRowToOffset(true, true, gcNext-1, tmp, rct.Right); - end; - } - if (rct.Left < rct.Right) and HorizontalIntersect(rct, clipArea) then begin gds := GetGridDrawState(gc, gr); temp_rct := rct; // Avoid painting into the fixed cells - if temp_rct.Left < fixed_rct.Right then temp_rct.Left := fixed_rct.Right; + if IsRightToLeft then + begin + if temp_rct.Right > fixed_rct.Left then temp_rct.Right := fixed_rct.Left + end else + begin + if temp_rct.Left < fixed_rct.Right then temp_rct.Left := fixed_rct.Right; + end; // Draw cell DoDrawCell(gc, gr, temp_rct, rct); // Draw comment marker