From: Øyvind Kolås Date: Wed, 11 Jul 2018 21:23:08 +0000 (+0200) Subject: babl: make babl_model_with_space able to take format/model for space X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~15^2~16^2~18 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e8653d0da6bb1402478853a4c1f87e668fadc644;p=babl.git babl: make babl_model_with_space able to take format/model for space --- diff --git a/babl/babl-model.c b/babl/babl-model.c index 2156059..d3471ed 100644 --- a/babl/babl-model.c +++ b/babl/babl-model.c @@ -374,6 +374,20 @@ babl_remodel_with_space (const Babl *model, const Babl *space) int i; assert (BABL_IS_BABL (model)); + if (!space) space = babl_space ("sRGB"); + if (space->class_type == BABL_FORMAT) + { + space = space->format.space; + } + else if (space->class_type == BABL_MODEL) + { + space = space->model.space; + } + else if (space->class_type != BABL_SPACE) + { + return NULL; + } + if (model->model.space == space) return (void*)model;