src/events/default_cursor.h
author Ryan C. Gordon
Mon, 05 Jan 2015 01:41:42 -0500
changeset 9306 817656bd36ec
parent 8149 681eb46b8ac4
child 9619 b94b6d0bff0f
permissions -rw-r--r--
Clang static analysis builds should use C runtime directly.

This is a little macro magic to use malloc() directly instead of SDL_malloc(),
etc, so static analysis tests that know about the C runtime can function
properly, and understand that we are dealing with heap allocations, etc.

This changed our static analysis report from 5 outstanding bugs to 30.

5x as many bugs were hidden by SDL_malloc() not being recognized as malloc()
by the static analyzer!
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 
    22 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    23  * Default cursor - it happens to be the Mac cursor, but could be anything   */
    24 
    25 #define DEFAULT_CWIDTH  16
    26 #define DEFAULT_CHEIGHT 16
    27 #define DEFAULT_CHOTX   0
    28 #define DEFAULT_CHOTY   0
    29 
    30 /* Added a real MacOS cursor, at the request of Luc-Olivier de Charrière */
    31 #define USE_MACOS_CURSOR
    32 
    33 #ifdef USE_MACOS_CURSOR
    34 
    35 static const unsigned char default_cdata[] = {
    36     0x00, 0x00,
    37     0x40, 0x00,
    38     0x60, 0x00,
    39     0x70, 0x00,
    40     0x78, 0x00,
    41     0x7C, 0x00,
    42     0x7E, 0x00,
    43     0x7F, 0x00,
    44     0x7F, 0x80,
    45     0x7C, 0x00,
    46     0x6C, 0x00,
    47     0x46, 0x00,
    48     0x06, 0x00,
    49     0x03, 0x00,
    50     0x03, 0x00,
    51     0x00, 0x00
    52 };
    53 
    54 static const unsigned char default_cmask[] = {
    55     0xC0, 0x00,
    56     0xE0, 0x00,
    57     0xF0, 0x00,
    58     0xF8, 0x00,
    59     0xFC, 0x00,
    60     0xFE, 0x00,
    61     0xFF, 0x00,
    62     0xFF, 0x80,
    63     0xFF, 0xC0,
    64     0xFF, 0xE0,
    65     0xFE, 0x00,
    66     0xEF, 0x00,
    67     0xCF, 0x00,
    68     0x87, 0x80,
    69     0x07, 0x80,
    70     0x03, 0x00
    71 };
    72 
    73 #else
    74 
    75 static const unsigned char default_cdata[] = {
    76     0x00, 0x00,
    77     0x40, 0x00,
    78     0x60, 0x00,
    79     0x70, 0x00,
    80     0x78, 0x00,
    81     0x7C, 0x00,
    82     0x7E, 0x00,
    83     0x7F, 0x00,
    84     0x7F, 0x80,
    85     0x7C, 0x00,
    86     0x6C, 0x00,
    87     0x46, 0x00,
    88     0x06, 0x00,
    89     0x03, 0x00,
    90     0x03, 0x00,
    91     0x00, 0x00
    92 };
    93 
    94 static const unsigned char default_cmask[] = {
    95     0x40, 0x00,
    96     0xE0, 0x00,
    97     0xF0, 0x00,
    98     0xF8, 0x00,
    99     0xFC, 0x00,
   100     0xFE, 0x00,
   101     0xFF, 0x00,
   102     0xFF, 0x80,
   103     0xFF, 0xC0,
   104     0xFF, 0x80,
   105     0xFE, 0x00,
   106     0xEF, 0x00,
   107     0x4F, 0x00,
   108     0x07, 0x80,
   109     0x07, 0x80,
   110     0x03, 0x00
   111 };
   112 
   113 #endif /* TRUE_MACINTOSH_CURSOR */
   114 /* vi: set ts=4 sw=4 expandtab: */