gpu: Clarify a function

It does functionally the same now, but it makes it mroe clear how it
works.

As a bonus, it will now trigger for -Wswitch-enum, too.
This commit is contained in:
Benjamin Otte 2024-09-11 08:32:33 +02:00
parent a8748598b6
commit d320373262

View File

@ -309,13 +309,27 @@ gsk_gpu_clip_get_shader_clip (const GskGpuClip *self,
const graphene_point_t *offset,
const graphene_rect_t *rect)
{
if (self->type == GSK_GPU_CLIP_NONE ||
self->type == GSK_GPU_CLIP_CONTAINED ||
gsk_gpu_clip_contains_rect (self, offset, rect))
return GSK_GPU_SHADER_CLIP_NONE;
else if (self->type == GSK_GPU_CLIP_RECT)
return GSK_GPU_SHADER_CLIP_RECT;
else
return GSK_GPU_SHADER_CLIP_ROUNDED;
switch (self->type)
{
case GSK_GPU_CLIP_NONE:
case GSK_GPU_CLIP_CONTAINED:
return GSK_GPU_SHADER_CLIP_NONE;
case GSK_GPU_CLIP_RECT:
if (gsk_gpu_clip_contains_rect (self, offset, rect))
return GSK_GPU_SHADER_CLIP_NONE;
else
return GSK_GPU_SHADER_CLIP_RECT;
case GSK_GPU_CLIP_ROUNDED:
if (gsk_gpu_clip_contains_rect (self, offset, rect))
return GSK_GPU_SHADER_CLIP_NONE;
else
return GSK_GPU_SHADER_CLIP_ROUNDED;
case GSK_GPU_CLIP_ALL_CLIPPED:
default:
g_return_val_if_reached (GSK_GPU_SHADER_CLIP_NONE);
}
}