IconFinder: Fix failure to display BMP icons.

This commit is contained in:
wp_xyz 2024-11-08 18:51:51 +01:00
parent a153126d5a
commit b5e2e98d35
2 changed files with 10 additions and 2 deletions

View File

@ -18,8 +18,8 @@ unit IconThumbNails;
interface interface
uses uses
Classes, SysUtils, fgl, contnrs, FPImage, StrUtils, LazLoggerBase, Classes, SysUtils, fgl, contnrs, FPImage, FPReadBMP, StrUtils, LazLoggerBase,
laz2_dom, laz2_xmlread, laz2_xmlwrite, laz2_dom, laz2_xmlread, laz2_xmlwrite, IntfGraphics,
FileUtil, LazFileUtils, Graphics, Controls, Dialogs, Menus, Forms, FileUtil, LazFileUtils, Graphics, Controls, Dialogs, Menus, Forms,
IconFinderStrConsts, BasicThumbnails; IconFinderStrConsts, BasicThumbnails;
@ -267,6 +267,8 @@ begin
begin begin
x := (Viewer.ThumbnailWidth - pic.Width) div 2; x := (Viewer.ThumbnailWidth - pic.Width) div 2;
y := (Viewer.ThumbnailHeight - pic.Height) div 2; y := (Viewer.ThumbnailHeight - pic.Height) div 2;
if Assigned(pic.Bitmap) then
pic.Bitmap.Transparent := true;
ACanvas.Draw(ARect.Left + x, ARect.Top + y, pic.Bitmap); ACanvas.Draw(ARect.Left + x, ARect.Top + y, pic.Bitmap);
end; end;
end; end;
@ -1149,6 +1151,11 @@ begin
reader := TFPCustomImage.FindReaderFromStream(stream); reader := TFPCustomImage.FindReaderFromStream(stream);
if reader <> nil then if reader <> nil then
begin begin
{$if FPC_FullVersion < 30301}
// Workaround for FPReaderBMP not implementing "ImageSize"
if reader = TFPReaderBMP then
reader := TLazReaderBMP;
{$ifend}
stream.Position := 0; stream.Position := 0;
with reader.ImageSize(stream) do with reader.ImageSize(stream) do
begin begin

View File

@ -5091,6 +5091,7 @@ begin
end; end;
{$IF FPC_FullVersion < 30301} {$IF FPC_FullVersion < 30301}
{ Workaround for TFPReaderBMP not implementing InternalSize in FPC before 3.3.1}
class function TLazReaderBMP.InternalSize (Stream: TStream): TPoint; class function TLazReaderBMP.InternalSize (Stream: TStream): TPoint;
var var
fileHdr: TBitmapFileHeader; fileHdr: TBitmapFileHeader;