Преглед на файлове

fix LoadThumbnailFromStream error in windows

KngStr преди 4 години
родител
ревизия
112de1f080
променени са 1 файла, в които са добавени 6 реда и са изтрити 3 реда
  1. 6 3
      Source/ksBitmapHelper.pas

+ 6 - 3
Source/ksBitmapHelper.pas

@@ -1930,7 +1930,7 @@ begin
         Frame.GetSize(Width, Height);
 
         Clipper := nil;
-        if (not ASrc.IsEmpty) and (ASrc.Width < Width) and (ASrc.Height < Height) then begin
+        if (not ASrc.IsEmpty) and ((ASrc.Width < Width) or (ASrc.Height < Height)) then begin
           WRect.X := Trunc(ASrc.Left);
           WRect.Y := Trunc(ASrc.Top);
           WRect.Width := Trunc(ASrc.Width);
@@ -1942,9 +1942,12 @@ begin
             Clipper := nil;
         end;
 
-        LResult := S_FALSE;
         // 缩放
-        ImagingFactory.CreateBitmapScaler(Scaler);
+        LResult := ImagingFactory.CreateBitmapScaler(Scaler);
+        if not Succeeded(LResult) then
+          Exit;
+
+        LResult := E_FAIL;
         if (Clipper <> nil) then
           LResult := Scaler.Initialize(Clipper, Trunc(ADest.Width), Trunc(ADest.Height), WICBitmapInterpolationModeLinear);
         if not Succeeded(LResult) then