    {-# OPTIONS_HADDOCK hide #-}
    --------------------------------------------------------------------------------
    -- |
    -- Module      :  Graphics.Rendering.OpenGL.GL.EdgeFlag
    -- 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 EdgeFlag.
    --
    --------------------------------------------------------------------------------

    module Graphics.Rendering.OpenGL.GL.EdgeFlag (
       EdgeFlag(..), marshalEdgeFlag, unmarshalEdgeFlag
    ) where

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

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

    -- | A vertex can begin an edge which lies in the interior of its polygon or on
    -- the polygon\'s boundary.

    data EdgeFlag = BeginsInteriorEdge | BeginsBoundaryEdge
       deriving ( EdgeFlag -> EdgeFlag -> Bool
    (EdgeFlag -> EdgeFlag -> Bool)
    -> (EdgeFlag -> EdgeFlag -> Bool) -> Eq EdgeFlag
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: EdgeFlag -> EdgeFlag -> Bool
    == :: EdgeFlag -> EdgeFlag -> Bool
    $c/= :: EdgeFlag -> EdgeFlag -> Bool
    /= :: EdgeFlag -> EdgeFlag -> Bool
    Eq, Eq EdgeFlag
    Eq EdgeFlag =>
    (EdgeFlag -> EdgeFlag -> Ordering)
    -> (EdgeFlag -> EdgeFlag -> Bool)
    -> (EdgeFlag -> EdgeFlag -> Bool)
    -> (EdgeFlag -> EdgeFlag -> Bool)
    -> (EdgeFlag -> EdgeFlag -> Bool)
    -> (EdgeFlag -> EdgeFlag -> EdgeFlag)
    -> (EdgeFlag -> EdgeFlag -> EdgeFlag)
    -> Ord EdgeFlag
    EdgeFlag -> EdgeFlag -> Bool
    EdgeFlag -> EdgeFlag -> Ordering
    EdgeFlag -> EdgeFlag -> EdgeFlag
    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 :: EdgeFlag -> EdgeFlag -> Ordering
    compare :: EdgeFlag -> EdgeFlag -> Ordering
    $c< :: EdgeFlag -> EdgeFlag -> Bool
    < :: EdgeFlag -> EdgeFlag -> Bool
    $c<= :: EdgeFlag -> EdgeFlag -> Bool
    <= :: EdgeFlag -> EdgeFlag -> Bool
    $c> :: EdgeFlag -> EdgeFlag -> Bool
    > :: EdgeFlag -> EdgeFlag -> Bool
    $c>= :: EdgeFlag -> EdgeFlag -> Bool
    >= :: EdgeFlag -> EdgeFlag -> Bool
    $cmax :: EdgeFlag -> EdgeFlag -> EdgeFlag
    max :: EdgeFlag -> EdgeFlag -> EdgeFlag
    $cmin :: EdgeFlag -> EdgeFlag -> EdgeFlag
    min :: EdgeFlag -> EdgeFlag -> EdgeFlag
    Ord, Int -> EdgeFlag -> ShowS
    [EdgeFlag] -> ShowS
    EdgeFlag -> String
    (Int -> EdgeFlag -> ShowS)
    -> (EdgeFlag -> String) -> ([EdgeFlag] -> ShowS) -> Show EdgeFlag
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> EdgeFlag -> ShowS
    showsPrec :: Int -> EdgeFlag -> ShowS
    $cshow :: EdgeFlag -> String
    show :: EdgeFlag -> String
    $cshowList :: [EdgeFlag] -> ShowS
    showList :: [EdgeFlag] -> ShowS
    Show )

    marshalEdgeFlag :: EdgeFlag -> GLboolean
    marshalEdgeFlag :: EdgeFlag -> GLboolean
    marshalEdgeFlag = Bool -> GLboolean
    forall a. Num a => Bool -> a
    marshalGLboolean (Bool -> GLboolean) -> (EdgeFlag -> Bool) -> EdgeFlag -> GLboolean
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (EdgeFlag
    BeginsBoundaryEdge EdgeFlag -> EdgeFlag -> Bool
    forall a. Eq a => a -> a -> Bool
    ==)

    unmarshalEdgeFlag :: GLboolean -> EdgeFlag
    unmarshalEdgeFlag :: GLboolean -> EdgeFlag
    unmarshalEdgeFlag GLboolean
    f =
       if GLboolean -> Bool
    forall a. (Eq a, Num a) => a -> Bool
    unmarshalGLboolean GLboolean
    f then EdgeFlag
    BeginsBoundaryEdge else EdgeFlag
    BeginsInteriorEdge