reducing blits per rectangle

This commit is contained in:
nek0 2016-12-18 19:01:18 +01:00
parent 4219355090
commit 9d50f8a7e0

View file

@ -46,14 +46,24 @@ drawRect buf node color (Fill) rect@G.GeglRectangle{..} = do
{ drawStack = (DrawRequest node rect buf False) : drawStack { drawStack = (DrawRequest node rect buf False) : drawStack
} }
drawRect buf node color (Line size) rect@G.GeglRectangle{..} = do drawRect buf node color (Line size) rect@G.GeglRectangle{..} = do
drawRect buf node color Fill (G.GeglRectangle rectangleX rectangleY rectangleWidth size) liftIO $ G.pixelPoke buf rect (B.PixelFormat B.RGBA B.CFdouble) G.GeglAccessReadWrite G.GeglAbyssNone $
drawRect buf node color Fill (G.GeglRectangle rectangleX rectangleY size rectangleHeight) (\(x, y) ->
drawRect buf node color Fill (G.GeglRectangle (rectangleX + rectangleWidth - size) rectangleY size rectangleHeight) let col = unsafeColorize color
drawRect buf node color Fill (G.GeglRectangle rectangleX (rectangleY + rectangleHeight - size) rectangleWidth size) in if not ((x >= rectangleX + size && x < rectangleX + rectangleWidth - size) &&
-- ad@AffectionData{..} <- get (y >= rectangleY + size && y < rectangleY + rectangleHeight - size))
-- put $ ad then
-- { drawStack = (DrawRequest node rect) : drawStack 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 -- | force a blit of a specified area. Do not use often as it slows down the program
present present
@ -63,9 +73,9 @@ present
-> Bool -- ^ Shall the drawing be cleared in the next run? -> Bool -- ^ Shall the drawing be cleared in the next run?
-> Affection us () -> Affection us ()
present node buf rect pers = do present node buf rect pers = do
ad@AffectionData{..} <- get ad <- get
put $ ad put $ ad
{ drawStack = (DrawRequest node rect buf pers) : drawStack { drawStack = (DrawRequest node rect buf pers) : drawStack ad
} }
ad <- get ad <- get
format <- liftIO $ B.babl_format $ B.PixelFormat B.RGBA B.CFu8 format <- liftIO $ B.babl_format $ B.PixelFormat B.RGBA B.CFu8