diff --git a/UOLib/UMultiMap.pas b/UOLib/UMultiMap.pas index f3874cb..6111eea 100644 --- a/UOLib/UMultiMap.pas +++ b/UOLib/UMultiMap.pas @@ -120,6 +120,7 @@ var height, width, x, y: Integer; run: Byte; state, newState: Boolean; + row: PByte; procedure DoWrite; var @@ -136,13 +137,16 @@ begin Data.Write(width, SizeOf(Integer)); Data.Write(height, SizeOf(Integer)); run := 0; - state := not (FGraphic.Canvas.Pixels[0,0] = clWhite); + state := True; + if (width > 0) and (height > 0) then + state := (PByte(FGraphic.ScanLine[0])[0] and $80) = 0; if Assigned(FOnProgress) then FOnProgress(0, 0); for y := 0 to height - 1 do begin + row := FGraphic.ScanLine[y]; for x := 0 to width - 1 do begin - newState := not (FGraphic.Canvas.Pixels[x,y] = clWhite); + newState := (row[x shr 3] and ($80 shr (x and 7))) = 0; if (state = newState) and (run < $7F) then begin inc(run);