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 = do
traceM "drawing"
ad <- get
UserData{..} <- getAffection
SDL.V2 (CInt rw) (CInt rh) <- SDL.surfaceDimensions $ drawSurface ad
let (w, h) = (fromIntegral rw, fromIntegral rh)
liftIO $ clearArea foreground (GeglRectangle 0 0 w h)
clear foreground
maybe (return ()) (\(x, y) ->
drawRect
(nodeGraph M.! "nop")

View File

@ -3,7 +3,7 @@
-- | Module for drawing primitives
module Affection.Draw
( drawRect
-- , clear
, clear
, handleDrawRequest
, invalidateDrawRequest
, present
@ -186,3 +186,11 @@ clearArea
-> G.GeglRectangle -- ^ Area to clear
-> IO ()
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)