more toying
This commit is contained in:
parent
9d1b26d633
commit
0bbf86e7f8
1 changed files with 17 additions and 4 deletions
|
@ -12,7 +12,7 @@ module Affection.Draw
|
||||||
|
|
||||||
import Affection.Types
|
import Affection.Types
|
||||||
|
|
||||||
import Foreign.Ptr (Ptr, plusPtr)
|
import Foreign.Ptr (Ptr, plusPtr, nullPtr)
|
||||||
import Foreign.C.Types
|
import Foreign.C.Types
|
||||||
|
|
||||||
import Control.Monad.State (get, put)
|
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
|
-- { 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
|
present
|
||||||
:: G.GeglNode -- ^ Node to blit
|
:: G.GeglNode -- ^ Node to blit
|
||||||
-> G.GeglBuffer -- ^ BUffer to draw
|
-> G.GeglBuffer -- ^ BUffer to draw
|
||||||
|
@ -67,6 +67,19 @@ present node buf rect pers = do
|
||||||
put $ ad
|
put $ ad
|
||||||
{ drawStack = (DrawRequest node rect buf pers) : drawStack
|
{ 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
|
-- | function for handling 'DrawRequest's and updating the output
|
||||||
handleDrawRequest
|
handleDrawRequest
|
||||||
|
@ -87,7 +100,7 @@ handleDrawRequest pixels format stride cpp dr@DrawRequest{..} = do
|
||||||
format
|
format
|
||||||
(pixels `plusPtr`
|
(pixels `plusPtr`
|
||||||
(rectangleX requestArea * cpp + rectangleY requestArea * stride))
|
(rectangleX requestArea * cpp + rectangleY requestArea * stride))
|
||||||
0
|
stride
|
||||||
[G.GeglBlitDefault]
|
[G.GeglBlitDefault]
|
||||||
liftIO $ SDL.unlockSurface surf
|
liftIO $ SDL.unlockSurface surf
|
||||||
liftIO $ SDL.updateWindowSurface $ drawWindow ad
|
liftIO $ SDL.updateWindowSurface $ drawWindow ad
|
||||||
|
@ -117,7 +130,7 @@ invalidateDrawRequest pixels format stride cpp dr@DrawRequest{..} = do
|
||||||
format
|
format
|
||||||
(pixels `plusPtr`
|
(pixels `plusPtr`
|
||||||
(rectangleX requestArea * cpp + rectangleY requestArea * stride))
|
(rectangleX requestArea * cpp + rectangleY requestArea * stride))
|
||||||
0
|
stride
|
||||||
[G.GeglBlitDefault]
|
[G.GeglBlitDefault]
|
||||||
liftIO $ SDL.unlockSurface surf
|
liftIO $ SDL.unlockSurface surf
|
||||||
liftIO $ SDL.updateWindowSurface $ drawWindow ad
|
liftIO $ SDL.updateWindowSurface $ drawWindow ad
|
||||||
|
|
Loading…
Reference in a new issue