reducing blits per rectangle
This commit is contained in:
parent
4219355090
commit
9d50f8a7e0
1 changed files with 20 additions and 10 deletions
|
@ -46,14 +46,24 @@ drawRect buf node color (Fill) rect@G.GeglRectangle{..} = do
|
|||
{ drawStack = (DrawRequest node rect buf False) : drawStack
|
||||
}
|
||||
drawRect buf node color (Line size) rect@G.GeglRectangle{..} = do
|
||||
drawRect buf node color Fill (G.GeglRectangle rectangleX rectangleY rectangleWidth size)
|
||||
drawRect buf node color Fill (G.GeglRectangle rectangleX rectangleY size rectangleHeight)
|
||||
drawRect buf node color Fill (G.GeglRectangle (rectangleX + rectangleWidth - size) rectangleY size rectangleHeight)
|
||||
drawRect buf node color Fill (G.GeglRectangle rectangleX (rectangleY + rectangleHeight - size) rectangleWidth size)
|
||||
-- ad@AffectionData{..} <- get
|
||||
-- put $ ad
|
||||
-- { drawStack = (DrawRequest node rect) : drawStack
|
||||
-- }
|
||||
liftIO $ G.pixelPoke buf rect (B.PixelFormat B.RGBA B.CFdouble) G.GeglAccessReadWrite G.GeglAbyssNone $
|
||||
(\(x, y) ->
|
||||
let col = unsafeColorize color
|
||||
in if not ((x >= rectangleX + size && x < rectangleX + rectangleWidth - size) &&
|
||||
(y >= rectangleY + size && y < rectangleY + rectangleHeight - size))
|
||||
then
|
||||
G.Pixel x y col
|
||||
else
|
||||
G.Pixel x y $ unsafeColorize $ G.RGBA 0 0 0 0
|
||||
)
|
||||
ad@AffectionData{..} <- get
|
||||
put $ ad
|
||||
{ drawStack = (DrawRequest node rect buf False) : drawStack
|
||||
}
|
||||
-- drawRect buf node color Fill (G.GeglRectangle rectangleX rectangleY rectangleWidth size)
|
||||
-- drawRect buf node color Fill (G.GeglRectangle rectangleX rectangleY size rectangleHeight)
|
||||
-- drawRect buf node color Fill (G.GeglRectangle (rectangleX + rectangleWidth - size) rectangleY size rectangleHeight)
|
||||
-- drawRect buf node color Fill (G.GeglRectangle rectangleX (rectangleY + rectangleHeight - size) rectangleWidth size)
|
||||
|
||||
-- | force a blit of a specified area. Do not use often as it slows down the program
|
||||
present
|
||||
|
@ -63,9 +73,9 @@ present
|
|||
-> Bool -- ^ Shall the drawing be cleared in the next run?
|
||||
-> Affection us ()
|
||||
present node buf rect pers = do
|
||||
ad@AffectionData{..} <- get
|
||||
ad <- get
|
||||
put $ ad
|
||||
{ drawStack = (DrawRequest node rect buf pers) : drawStack
|
||||
{ drawStack = (DrawRequest node rect buf pers) : drawStack ad
|
||||
}
|
||||
ad <- get
|
||||
format <- liftIO $ B.babl_format $ B.PixelFormat B.RGBA B.CFu8
|
||||
|
|
Loading…
Reference in a new issue