LCOV - code coverage report
Current view: top level - pencil/include/geometry - geometry_h_align.inl (source / functions) Coverage Total Hit
Test: crystal-facet-uml_v1.63.2_covts Lines: 100.0 % 13 13
Test Date: 2025-05-01 10:10:14 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /* File: geometry_h_align.inl; Copyright and License: see below */
       2              : 
       3              : #include "u8/u8_trace.h"
       4              : #include "u8/u8_log.h"
       5              : #include <assert.h>
       6              : 
       7          645 : static inline double geometry_h_align_get_left ( const geometry_h_align_t *this_, double width, double reference_left, double reference_width )
       8              : {
       9          645 :     assert( ( *this_ == GEOMETRY_H_ALIGN_LEFT )||( *this_ == GEOMETRY_H_ALIGN_CENTER )||( *this_ == GEOMETRY_H_ALIGN_RIGHT ) );
      10              :     double left;
      11              : 
      12          645 :     switch ( *this_ )
      13              :     {
      14            3 :         case GEOMETRY_H_ALIGN_LEFT:
      15              :         {
      16            3 :             left = reference_left;
      17              :         }
      18            3 :         break;
      19              : 
      20          641 :         case GEOMETRY_H_ALIGN_CENTER:
      21              :         {
      22          641 :             left = reference_left + 0.5 * ( reference_width - width );
      23              :         }
      24          641 :         break;
      25              : 
      26            1 :         default:
      27              :         case GEOMETRY_H_ALIGN_RIGHT:
      28              :         {
      29            1 :             left = reference_left + reference_width - width;
      30              :         }
      31            1 :         break;
      32              :     }
      33              : 
      34          645 :     return left;
      35              : }
      36              : 
      37              : 
      38              : /*
      39              : Copyright 2017-2025 Andreas Warnke
      40              : 
      41              : Licensed under the Apache License, Version 2.0 (the "License");
      42              : you may not use this file except in compliance with the License.
      43              : You may obtain a copy of the License at
      44              : 
      45              :     http://www.apache.org/licenses/LICENSE-2.0
      46              : 
      47              : Unless required by applicable law or agreed to in writing, software
      48              : distributed under the License is distributed on an "AS IS" BASIS,
      49              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      50              : See the License for the specific language governing permissions and
      51              : limitations under the License.
      52              : */
        

Generated by: LCOV version 2.0-1