This commit is contained in:
Astro 2017-03-16 20:21:04 +01:00
parent 4882350095
commit a7c33a7413
2 changed files with 10 additions and 5 deletions

View file

@ -86,11 +86,8 @@ load _ = do
draw :: Affection UserData () draw :: Affection UserData ()
draw = do draw = do
traceM "drawing" traceM "drawing"
ad <- get
UserData{..} <- getAffection UserData{..} <- getAffection
SDL.V2 (CInt rw) (CInt rh) <- SDL.surfaceDimensions $ drawSurface ad clear foreground
let (w, h) = (fromIntegral rw, fromIntegral rh)
liftIO $ clearArea foreground (GeglRectangle 0 0 w h)
maybe (return ()) (\(x, y) -> maybe (return ()) (\(x, y) ->
drawRect drawRect
(nodeGraph M.! "nop") (nodeGraph M.! "nop")

View file

@ -3,7 +3,7 @@
-- | Module for drawing primitives -- | Module for drawing primitives
module Affection.Draw module Affection.Draw
( drawRect ( drawRect
-- , clear , clear
, handleDrawRequest , handleDrawRequest
, invalidateDrawRequest , invalidateDrawRequest
, present , present
@ -186,3 +186,11 @@ clearArea
-> G.GeglRectangle -- ^ Area to clear -> G.GeglRectangle -- ^ Area to clear
-> IO () -> IO ()
clearArea = G.gegl_buffer_clear clearArea = G.gegl_buffer_clear
-- | Clear the whole drawing area
clear :: G.GeglBuffer -> Affection us ()
clear buffer = do
ad <- get
SDL.V2 (CInt rw) (CInt rh) <- SDL.surfaceDimensions $ drawSurface ad
let (w, h) = (fromIntegral rw, fromIntegral rh)
liftIO $ clearArea buffer (GeglRectangle 0 0 w h)