{-# OPTIONS_HADDOCK hide #-}
--------------------------------------------------------------------------------
-- |
-- Module      :  Graphics.Rendering.OpenGL.GL.PixelRectangles.Sink
-- Copyright   :  (c) Sven Panne 2002-2019
-- License     :  BSD3
-- 
-- Maintainer  :  Sven Panne <svenpanne@gmail.com>
-- Stability   :  stable
-- Portability :  portable
--
-- This is a purely internal module for (un-)marshaling Sink.
--
--------------------------------------------------------------------------------

module Graphics.Rendering.OpenGL.GL.PixelRectangles.Sink (
   Sink(..), marshalSink, unmarshalSink
) where

import Graphics.Rendering.OpenGL.GL.GLboolean
import Graphics.GL

--------------------------------------------------------------------------------

data Sink =
     PassThrough
   | Sink
   deriving ( Sink -> Sink -> Bool
(Sink -> Sink -> Bool) -> (Sink -> Sink -> Bool) -> Eq Sink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Sink -> Sink -> Bool
== :: Sink -> Sink -> Bool
$c/= :: Sink -> Sink -> Bool
/= :: Sink -> Sink -> Bool
Eq, Eq Sink
Eq Sink =>
(Sink -> Sink -> Ordering)
-> (Sink -> Sink -> Bool)
-> (Sink -> Sink -> Bool)
-> (Sink -> Sink -> Bool)
-> (Sink -> Sink -> Bool)
-> (Sink -> Sink -> Sink)
-> (Sink -> Sink -> Sink)
-> Ord Sink
Sink -> Sink -> Bool
Sink -> Sink -> Ordering
Sink -> Sink -> Sink
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Sink -> Sink -> Ordering
compare :: Sink -> Sink -> Ordering
$c< :: Sink -> Sink -> Bool
< :: Sink -> Sink -> Bool
$c<= :: Sink -> Sink -> Bool
<= :: Sink -> Sink -> Bool
$c> :: Sink -> Sink -> Bool
> :: Sink -> Sink -> Bool
$c>= :: Sink -> Sink -> Bool
>= :: Sink -> Sink -> Bool
$cmax :: Sink -> Sink -> Sink
max :: Sink -> Sink -> Sink
$cmin :: Sink -> Sink -> Sink
min :: Sink -> Sink -> Sink
Ord, Int -> Sink -> ShowS
[Sink] -> ShowS
Sink -> String
(Int -> Sink -> ShowS)
-> (Sink -> String) -> ([Sink] -> ShowS) -> Show Sink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Sink -> ShowS
showsPrec :: Int -> Sink -> ShowS
$cshow :: Sink -> String
show :: Sink -> String
$cshowList :: [Sink] -> ShowS
showList :: [Sink] -> ShowS
Show )

marshalSink :: Sink -> GLboolean
marshalSink :: Sink -> GLboolean
marshalSink Sink
x = Bool -> GLboolean
forall a. Num a => Bool -> a
marshalGLboolean (Sink
x Sink -> Sink -> Bool
forall a. Eq a => a -> a -> Bool
== Sink
Sink)

unmarshalSink :: GLint -> Sink
unmarshalSink :: GLint -> Sink
unmarshalSink GLint
s = if GLint -> Bool
forall a. (Eq a, Num a) => a -> Bool
unmarshalGLboolean GLint
s then Sink
Sink else Sink
PassThrough