From 7d2edf69f9d9fc45ba8dcf054f32d48d6f1044b4 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sat, 27 May 2017 10:11:56 +0000 Subject: [PATCH] tvplanit: Fix Linux qt not painting internal tasklist icon. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5904 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../tvplanit/source/vptasklistpainter.pas | 61 ++++--------------- 1 file changed, 12 insertions(+), 49 deletions(-) diff --git a/components/tvplanit/source/vptasklistpainter.pas b/components/tvplanit/source/vptasklistpainter.pas index 214727819..e83496a9a 100644 --- a/components/tvplanit/source/vptasklistpainter.pas +++ b/components/tvplanit/source/vptasklistpainter.pas @@ -230,9 +230,8 @@ var GlyphRect: TRect; HeadStr: string; delta: Integer; - w, h, h0: Integer; + w, h: Integer; bmp: TBitmap; - png: TPortableNetworkGraphic; begin RenderCanvas.Brush.Color := TaskHeadAttrColor; RenderCanvas.Font.Assign(FTaskList.TaskHeadAttributes.Font); @@ -267,53 +266,18 @@ begin { Draw the glyph } if FTaskList.ShowIcon then begin - {$IFDEF NEW_ICONS} - h0 := HeightOf(HeadRect) - 2; - if h0 >= 32 then - png := CreatePngFromRCDATA('VPTASKS32') - else if h0 >= 24 then - png := CreatePngFromRCDATA('VPTASKS24') - else - png := CreatePngFromRCDATA('VPTASKS16'); - try - if png.Height > 0 then begin - bmp := TBitmap.Create; - try - bmp.PixelFormat := pf32Bit; - bmp.Width := png.Width; - bmp.Height := png.Height; - bmp.Canvas.Brush.color := clWhite; - bmp.Canvas.FillRect(Rect(0, 0, bmp.Width, bmp.Height)); - bmp.Canvas.Draw(0, 0, png); - - w := Round(bmp.Width * Scale); - h := Round(bmp.Height * Scale); - - GlyphRect.TopLeft := Point(HeadRect.Left + TextMargin, (Headrect.Top + HeadRect.Bottom - h) div 2); - GlyphRect.BottomRight := Point(GlyphRect.Left + w, GlyphRect.Top + h); - - {$IFDEF FPC} - RotateBitmap(Bmp, Angle); - {$ENDIF} - - TPSStretchDraw(RenderCanvas, Angle, RenderIn, GlyphRect, Bmp); - - HeadRect.Left := HeadRect.Left + w + TextMargin; - finally - bmp.Free; - end; - end; - finally - png.Free; - end; - {$ELSE} - Bmp := Graphics.TBitmap.Create; + bmp := TBitmap.Create; try + {$IFDEF NEW_ICONS} + LoadGlyphFromRCDATA(bmp, 'VPTASKS', 16, 24, 32); + {$ELSE} Bmp.LoadFromResourceName(HINSTANCE, 'VPCHECKPAD'); //soner changed: Bmp.Handle := LoadBaseBitmap('VPCHECKPAD'); - if Bmp.Height > 0 then begin - w := Round(Bmp.Width * Scale); - h := Round(Bmp.Height * Scale); - GlyphRect.TopLeft := Point(HeadRect.Left + TextMargin, HeadRect.Top + TextMargin); + {$ENDIF} + if bmp.Height > 0 then + begin + w := Round(bmp.Width * Scale); + h := Round(bmp.Height * Scale); + GlyphRect.TopLeft := Point(HeadRect.Left + TextMargin, (Headrect.Top + HeadRect.Bottom - h) div 2); GlyphRect.BottomRight := Point(GlyphRect.Left + w, GlyphRect.Top + h); {$IFDEF FPC} RotateBitmap(Bmp, Angle); @@ -322,9 +286,8 @@ begin HeadRect.Left := HeadRect.Left + w + TextMargin; end; finally - Bmp.Free; + bmp.Free; end; - {$ENDIF} end; { draw the text }