Disable hashing for now.

This commit is contained in:
David Himmelstrup 2020-09-08 19:09:03 +08:00
commit e369dbec36

View file

@ -64,20 +64,15 @@ renderSvgs :: FilePath -> Int -> Bool -> Animation -> IO ()
renderSvgs folder offset _prettyPrint ani = do
print frameCount
lock <- newMVar ()
hashedFrames <- newMVar M.empty
handle errHandler $ concurrentForM_ (frameOrder rate frameCount) $ \nth' -> do
let nth = (nth'+offset) `mod` frameCount
now = (duration ani / (fromIntegral frameCount - 1)) * fromIntegral nth
frame = frameAt (if frameCount <= 1 then 0 else now) ani
path = folder </> show nth <.> "svg"
cachedFrame <- M.lookup frame <$> readMVar hashedFrames
~svg = renderSvg Nothing Nothing frame
idempotentFile path $
case cachedFrame of
Nothing -> do
let svg = renderSvg Nothing Nothing frame
writeFile path svg
modifyMVar_ hashedFrames $ \hm -> pure $ M.insert frame path hm
Just frameFile -> copyFile frameFile path
writeFile path svg
withMVar lock $ \_ -> do
print nth
hFlush stdout