Skip to content

cogl: return correct enum type

Thomas H.P. Andersen requested to merge phomes/mutter:return-correct-enum into master

cogl_pipeline_get_front_face_winding() is supposed to return a CoglWinding. It takes a CoglPipeline as argument and does the following input validation:

g_return_val_if_fail (cogl_is_pipeline (pipeline), COGL_PIPELINE_CULL_FACE_MODE_NONE);

The returned COGL_PIPELINE_CULL_FACE_MODE_NONE is not a winding.

The function was added with this check 8 years ago in 5369b3c6

I do not see any of the two options in the CoglWinding as particularly good choice for a return value on bad input, but let's go with COGL_WINDING_CLOCKWISE as that is equivalent with the behavior for all these years.

Definitions of the two enums:

typedef enum
{
  COGL_WINDING_CLOCKWISE,
  COGL_WINDING_COUNTER_CLOCKWISE
} CoglWinding;

typedef enum
{
  COGL_PIPELINE_CULL_FACE_MODE_NONE,
  COGL_PIPELINE_CULL_FACE_MODE_FRONT,
  COGL_PIPELINE_CULL_FACE_MODE_BACK,
  COGL_PIPELINE_CULL_FACE_MODE_BOTH
} CoglPipelineCullFaceMode;
Edited by Thomas H.P. Andersen

Merge request reports