LCOV - code coverage report
Current view: top level - addons/primitives - point_soft.c (source / functions) Hit Total Coverage
Test: allegro_auto.info Lines: 0 34 0.0 %
Date: 2013-01-02 Functions: 0 2 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 36 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*         ______   ___    ___
       2                 :            :  *        /\  _  \ /\_ \  /\_ \
       3                 :            :  *        \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___
       4                 :            :  *         \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
       5                 :            :  *          \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
       6                 :            :  *           \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
       7                 :            :  *            \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
       8                 :            :  *                                           /\____/
       9                 :            :  *                                           \_/__/
      10                 :            :  *
      11                 :            :  *      Software point implementation functions.
      12                 :            :  *
      13                 :            :  *
      14                 :            :  *      By Pavel Sountsov.
      15                 :            :  *
      16                 :            :  *      See readme.txt for copyright information.
      17                 :            :  */
      18                 :            : 
      19                 :            : 
      20                 :            : #define _AL_NO_BLEND_INLINE_FUNC
      21                 :            : 
      22                 :            : #include "allegro5/allegro.h"
      23                 :            : #include "allegro5/allegro_primitives.h"
      24                 :            : #include "allegro5/internal/aintern_blend.h"
      25                 :            : #include "allegro5/internal/aintern_prim.h"
      26                 :            : #include "allegro5/internal/aintern_prim_soft.h"
      27                 :            : #include <math.h>
      28                 :            : 
      29                 :          0 : static int fix_var(float var, int max_var)
      30                 :            : {
      31                 :          0 :    const int ivar = (int)floorf(var);
      32                 :          0 :    const int ret = ivar % max_var;
      33         [ #  # ]:          0 :    if(ret >= 0)
      34                 :            :       return ret;
      35                 :            :    else
      36                 :          0 :       return ret + max_var;
      37                 :            : }
      38                 :            : 
      39                 :          0 : void _al_point_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v)
      40                 :            : {
      41                 :          0 :    int shade = 1;
      42                 :            :    int op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha;
      43                 :            :    ALLEGRO_COLOR vc;
      44                 :            :    int clip_min_x, clip_min_y, clip_max_x, clip_max_y;
      45                 :          0 :    int x = (int)floor(v->x);
      46                 :          0 :    int y = (int)floor(v->x);
      47                 :            :    
      48                 :          0 :    al_get_clipping_rectangle(&clip_min_x, &clip_min_y, &clip_max_x, &clip_max_y);
      49                 :          0 :    clip_max_x += clip_min_x;
      50                 :          0 :    clip_max_y += clip_min_y;
      51                 :            :    
      52 [ #  # ][ #  # ]:          0 :    if(x < clip_min_x || x >= clip_max_x || y < clip_min_y || y >= clip_max_y)
         [ #  # ][ #  # ]
      53                 :          0 :       return;
      54                 :            : 
      55                 :          0 :    vc = v->color;
      56                 :            : 
      57                 :          0 :    al_get_separate_blender(&op, &src_mode, &dst_mode, &op_alpha, &src_alpha, &dst_alpha);
      58 [ #  # ][ #  # ]:          0 :    if (_AL_DEST_IS_ZERO && _AL_SRC_NOT_MODIFIED) {
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
      59                 :          0 :       shade = 0;
      60                 :            :    }
      61                 :            :    
      62         [ #  # ]:          0 :    if (texture) {
      63                 :          0 :       float U = fix_var(v->u, al_get_bitmap_width(texture));
      64                 :          0 :       float V = fix_var(v->v, al_get_bitmap_height(texture));
      65                 :          0 :       ALLEGRO_COLOR color = al_get_pixel(texture, U, V);
      66                 :            : 
      67 [ #  # ][ #  # ]:          0 :       if(vc.r != 1 || vc.g != 1 || vc.b != 1 || vc.a != 1) {
         [ #  # ][ #  # ]
      68                 :          0 :          color.r *= vc.r;
      69                 :          0 :          color.g *= vc.g;
      70                 :          0 :          color.b *= vc.b;
      71                 :          0 :          color.a *= vc.a;
      72                 :            :       }
      73                 :            : 
      74         [ #  # ]:          0 :       if (shade) {
      75                 :          0 :          al_put_blended_pixel(v->x, v->y, color);
      76                 :            :       } else {
      77                 :          0 :          al_put_pixel(v->x, v->y, color);
      78                 :            :       }
      79                 :            :    } else {
      80                 :          0 :       ALLEGRO_COLOR color = al_map_rgba_f(vc.r, vc.g, vc.b, vc.a);
      81         [ #  # ]:          0 :       if (shade) {
      82                 :          0 :          al_put_blended_pixel(v->x, v->y, color);
      83                 :            :       } else {
      84                 :          0 :          al_put_pixel(v->x, v->y, color);
      85                 :            :       }
      86                 :            :    }
      87                 :            : }

Generated by: LCOV version 1.9