LCOV - code coverage report
Current view: top level - gui/include/sketch - gui_sketch_card_painter.inl (source / functions) Coverage Total Hit
Test: crystal-facet-uml_v1.63.2_covts Lines: 0.0 % 38 0
Test Date: 2025-05-01 10:10:14 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /* File: gui_sketch_card_painter.inl; Copyright and License: see below */
       2              : 
       3              : #include "u8/u8_log.h"
       4              : #include "u8/u8_trace.h"
       5              : #include "u8/u8_f64.h"
       6              : #include <assert.h>
       7              : 
       8            0 : static inline void gui_sketch_card_painter_private_draw_rect ( const gui_sketch_card_painter_t *this_,
       9              :                                                                const geometry_rectangle_t *rect,
      10              :                                                                cairo_t *cr )
      11              : {
      12            0 :     assert( rect != NULL );
      13            0 :     assert( cr != NULL );
      14              : 
      15              :     static const double WHITE_R = 1.0;
      16              :     static const double WHITE_G = 1.0;
      17              :     static const double WHITE_B = 1.0;
      18              :     static const double WHITE_A = 1.0;
      19            0 :     cairo_set_source_rgba( cr, WHITE_R, WHITE_G, WHITE_B, WHITE_A );
      20            0 :     cairo_rectangle( cr,
      21              :                      geometry_rectangle_get_left( rect ),
      22              :                      geometry_rectangle_get_top( rect ),
      23              :                      geometry_rectangle_get_width( rect ),
      24              :                      geometry_rectangle_get_height( rect )
      25              :                    );
      26            0 :     cairo_fill (cr);
      27            0 : }
      28              : 
      29            0 : static inline void gui_sketch_card_painter_private_draw_border ( const gui_sketch_card_painter_t *this_,
      30              :                                                                  const geometry_rectangle_t *border,
      31              :                                                                  const geometry_rectangle_t *space,
      32              :                                                                  cairo_t *cr )
      33              : {
      34            0 :     assert( border != NULL );
      35            0 :     assert( space != NULL );
      36            0 :     assert( cr != NULL );
      37              : 
      38              :     /* prepare draw */
      39              :     static const double WHITE_R = 1.0;
      40              :     static const double WHITE_G = 1.0;
      41              :     static const double WHITE_B = 1.0;
      42              :     static const double WHITE_A = 1.0;
      43            0 :     cairo_set_source_rgba( cr, WHITE_R, WHITE_G, WHITE_B, WHITE_A );
      44              : 
      45              :     /* plan to draw */
      46              :     {
      47            0 :         const double bold_left = geometry_rectangle_get_left( border );
      48            0 :         const double bold_top = geometry_rectangle_get_top( border );
      49            0 :         const double bold_width = geometry_rectangle_get_width( border );
      50            0 :         const double bold_height = geometry_rectangle_get_height( border );
      51            0 :         const double bold_right = bold_left + bold_width;
      52            0 :         const double bold_bottom = bold_top + bold_height;
      53            0 :         const double void_left = geometry_rectangle_get_left( space );
      54            0 :         const double void_top = geometry_rectangle_get_top( space );
      55            0 :         const double void_width = geometry_rectangle_get_width( space );
      56            0 :         const double void_height = geometry_rectangle_get_height( space );
      57            0 :         const double void_right = void_left + void_width;
      58            0 :         const double void_bottom = void_top + void_height;
      59              :         /* fit the empty space into the hightlight space, round to make parts fit together and to not have negative widths/heights */
      60            0 :         const double void_left_adjusted = floor( u8_f64_min2( u8_f64_max2( void_left, bold_left ), bold_right ) );
      61            0 :         const double void_top_adjusted = floor( u8_f64_min2( u8_f64_max2( void_top, bold_top ), bold_bottom ) );
      62            0 :         const double void_right_adjusted = ceil( u8_f64_max2( u8_f64_min2( void_right, bold_right ), bold_left ) );
      63            0 :         const double void_bottom_adjusted = ceil( u8_f64_max2( u8_f64_min2( void_bottom, bold_bottom ), bold_top ) );
      64              :         /* draw top region */
      65            0 :         if ( bold_top < void_top )
      66              :         {
      67            0 :             cairo_rectangle( cr, bold_left, bold_top, bold_width, void_top_adjusted - bold_top );
      68              :         }
      69              :         /* draw left region */
      70            0 :         if ( bold_left < void_left )
      71              :         {
      72            0 :             cairo_rectangle( cr, bold_left, void_top_adjusted, void_left_adjusted - bold_left, void_bottom_adjusted - void_top_adjusted );
      73              :         }
      74              :         /* draw right region */
      75            0 :         if ( bold_right > void_right )
      76              :         {
      77            0 :             cairo_rectangle( cr, void_right_adjusted, void_top_adjusted, bold_right - void_right_adjusted, void_bottom_adjusted - void_top_adjusted );
      78              :         }
      79              :         /* draw bottom region */
      80            0 :         if ( bold_bottom > void_bottom )
      81              :         {
      82            0 :             cairo_rectangle( cr, bold_left, void_bottom_adjusted, bold_width, bold_bottom - void_bottom_adjusted );
      83              :         }
      84              :     }
      85              : 
      86              :     /* perform draw */
      87            0 :     cairo_fill (cr);
      88            0 : }
      89              : 
      90              : 
      91              : /*
      92              : Copyright 2016-2025 Andreas Warnke
      93              : 
      94              : Licensed under the Apache License, Version 2.0 (the "License");
      95              : you may not use this file except in compliance with the License.
      96              : You may obtain a copy of the License at
      97              : 
      98              :     http://www.apache.org/licenses/LICENSE-2.0
      99              : 
     100              : Unless required by applicable law or agreed to in writing, software
     101              : distributed under the License is distributed on an "AS IS" BASIS,
     102              : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     103              : See the License for the specific language governing permissions and
     104              : limitations under the License.
     105              : */
        

Generated by: LCOV version 2.0-1