diff --git a/src/Affection/Draw.hs b/src/Affection/Draw.hs index 975ee30..1d3de88 100644 --- a/src/Affection/Draw.hs +++ b/src/Affection/Draw.hs @@ -12,7 +12,7 @@ module Affection.Draw import Affection.Types -import Foreign.Ptr (Ptr, plusPtr) +import Foreign.Ptr (Ptr, plusPtr, nullPtr) import Foreign.C.Types import Control.Monad.State (get, put) @@ -55,7 +55,7 @@ drawRect buf node color (Line size) rect@G.GeglRectangle{..} = do -- { drawStack = (DrawRequest node rect) : drawStack -- } --- | force a blit of a specified area +-- | force a blit of a specified area. Do not use often as it slows down the program present :: G.GeglNode -- ^ Node to blit -> G.GeglBuffer -- ^ BUffer to draw @@ -67,6 +67,19 @@ present node buf rect pers = do put $ ad { drawStack = (DrawRequest node rect buf pers) : drawStack } + ad <- get + format <- liftIO $ B.babl_format $ B.PixelFormat B.RGBA B.CFu8 + liftIO $ SDL.lockSurface $ drawSurface ad + liftIO $ G.gegl_node_blit + node + 1 + rect + format + nullPtr + 0 + [G.GeglBlitDefault] + liftIO $ SDL.unlockSurface $ drawSurface ad + liftIO $ SDL.updateWindowSurface $ drawWindow ad -- | function for handling 'DrawRequest's and updating the output handleDrawRequest @@ -87,7 +100,7 @@ handleDrawRequest pixels format stride cpp dr@DrawRequest{..} = do format (pixels `plusPtr` (rectangleX requestArea * cpp + rectangleY requestArea * stride)) - 0 + stride [G.GeglBlitDefault] liftIO $ SDL.unlockSurface surf liftIO $ SDL.updateWindowSurface $ drawWindow ad @@ -117,7 +130,7 @@ invalidateDrawRequest pixels format stride cpp dr@DrawRequest{..} = do format (pixels `plusPtr` (rectangleX requestArea * cpp + rectangleY requestArea * stride)) - 0 + stride [G.GeglBlitDefault] liftIO $ SDL.unlockSurface surf liftIO $ SDL.updateWindowSurface $ drawWindow ad