From 028c4243a87e41e3b7e2c51eb752d4b089b30680 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 21 Aug 2011 05:38:37 +0200 Subject: Use CacheArrow for rendering Extremely hacky at the moment, for now the caching isn't used at all... --- lib/Phi/Widgets/AlphaBox.hs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'lib/Phi/Widgets/AlphaBox.hs') diff --git a/lib/Phi/Widgets/AlphaBox.hs b/lib/Phi/Widgets/AlphaBox.hs index dd4bfba..2db17f4 100644 --- a/lib/Phi/Widgets/AlphaBox.hs +++ b/lib/Phi/Widgets/AlphaBox.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE MultiParamTypeClasses #-} module Phi.Widgets.AlphaBox ( alphaBox ) where @@ -11,13 +11,12 @@ import Control.Monad import Graphics.Rendering.Cairo -data AlphaBoxState = AlphaBoxState ![WidgetState] deriving Show +data AlphaBoxState = AlphaBoxState ![WidgetState] deriving Eq -data AlphaBox = AlphaBox !Double ![Widget] deriving Show +data AlphaBox = AlphaBox !Double ![Widget] deriving (Show, Eq) -instance WidgetClass AlphaBox where - type WidgetData AlphaBox = AlphaBoxState +instance WidgetClass AlphaBox AlphaBoxState where initWidget (AlphaBox _ widgets) phi disp = liftM AlphaBoxState $ mapM (createWidgetState phi disp) widgets minSize (AlphaBox _ _) (AlphaBoxState widgetStates) height screen = @@ -27,10 +26,10 @@ instance WidgetClass AlphaBox where layout (AlphaBox _ _) (AlphaBoxState widgetStates) width height screen = AlphaBoxState $ layoutWidgets widgetStates 0 0 width height screen - render (AlphaBox alpha _) (AlphaBoxState widgetStates) w h screen = do + render (AlphaBox alpha _) (AlphaBoxState widgetStates) x y w h screen = do renderWithSimilarSurface ContentColorAlpha w h $ \surface -> do renderWith surface $ do - renderWidgets widgetStates screen + renderWidgets widgetStates screen x y setOperator OperatorDestIn setSourceRGBA 0 0 0 alpha -- cgit v1.2.3