solstice-solver

Solver library of the solstice app
git clone git://git.meso-star.com/solstice-solver.git
Log | Files | Refs | README | LICENSE

commit d4f53f5690703ec5b7f80bfe67c5267211270abb
parent cd1144b9f90db28fe655b1caccb2d3da368d2d97
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 14 Dec 2016 14:29:39 +0100

Make public the ssol_sizeof_pixel_format function

Diffstat:
Msrc/ssol.h | 9+++++++++
Msrc/ssol_image.c | 4++--
Msrc/ssol_image_c.h | 9---------
3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/ssol.h b/src/ssol.h @@ -254,6 +254,15 @@ typedef res_T const enum ssol_pixel_format fmt, /* Format of the submitted pixel */ const void* pixels); /* List of row ordered pixels */ +static FINLINE size_t +ssol_sizeof_pixel_format(const enum ssol_pixel_format format) +{ + switch(format) { + case SSOL_PIXEL_DOUBLE3: return sizeof(double[3]); + default: FATAL("Unreachable code.\n"); + } +} + /* * All the ssol structures are ref counted. Once created with the appropriated * `ssol_<TYPE>_create' function, the caller implicitly owns the created data, diff --git a/src/ssol_image.c b/src/ssol_image.c @@ -106,7 +106,7 @@ ssol_image_setup return RES_BAD_ARG; } - pitch = width * sizeof_pixel_format(fmt); + pitch = width * ssol_sizeof_pixel_format(fmt); mem = MEM_ALLOC_ALIGNED(img->dev->allocator, pitch*height, 16); if(!mem) return RES_MEM_ERR; @@ -175,7 +175,7 @@ ssol_image_write if(UNLIKELY((origin[1] + size[1]) > img->size[1])) return RES_BAD_ARG; - Bpp = sizeof_pixel_format(img->format); + Bpp = ssol_sizeof_pixel_format(img->format); src_pitch = size[0] * Bpp; src_ix = origin[0] * Bpp; diff --git a/src/ssol_image_c.h b/src/ssol_image_c.h @@ -28,14 +28,5 @@ struct ssol_image { ref_T ref; }; -static INLINE size_t -sizeof_pixel_format(const enum ssol_pixel_format format) -{ - switch(format) { - case SSOL_PIXEL_DOUBLE3: return sizeof(double[3]); - default: FATAL("Unreachable code.\n"); - } -} - #endif /* SSOL_IMAGE_C_H */