diff --git a/lcl/graphtype.pp b/lcl/graphtype.pp index 820922ab4d..a05be26d45 100644 --- a/lcl/graphtype.pp +++ b/lcl/graphtype.pp @@ -319,7 +319,7 @@ begin if H < 0 then Exit; // calc destination rowstride - RS := (W * ABPP) shr 3; + RS := (W * ABPP + 7) shr 3; x := RS and SIZEMAP[ADestinationEnd]; if x <> 0 then Inc(RS, 1 + SIZEMAP[ADestinationEnd] - x); diff --git a/lcl/interfaces/win32/win32wsimglist.pp b/lcl/interfaces/win32/win32wsimglist.pp index 0f99e51a39..88fe3592d6 100644 --- a/lcl/interfaces/win32/win32wsimglist.pp +++ b/lcl/interfaces/win32/win32wsimglist.pp @@ -192,6 +192,9 @@ class procedure TWin32WSCustomImageList.AddData(AListHandle: TLCLIntfHandle; ACo else P^ := P^ shl 1; Inc(AData); end; + // finish mask shifting + if (AWidth and $7) <> 0 then + P^ := P^ shl (7 - (AWidth mod 8)); Inc(LinePtr, MaskStride); end;