Home | History | Annotate | Download | only in core
      1 
      2 /*
      3  * Copyright 2006 The Android Open Source Project
      4  *
      5  * Use of this source code is governed by a BSD-style license that can be
      6  * found in the LICENSE file.
      7  */
      8 
      9 
     10 #ifndef SkUserConfig_DEFINED
     11 #define SkUserConfig_DEFINED
     12 
     13 /*  SkTypes.h, the root of the public header files, does the following trick:
     14 
     15     #include "SkPreConfig.h"
     16     #include "SkUserConfig.h"
     17     #include "SkPostConfig.h"
     18 
     19     SkPreConfig.h runs first, and it is responsible for initializing certain
     20     skia defines.
     21 
     22     SkPostConfig.h runs last, and its job is to just check that the final
     23     defines are consistent (i.e. that we don't have mutually conflicting
     24     defines).
     25 
     26     SkUserConfig.h (this file) runs in the middle. It gets to change or augment
     27     the list of flags initially set in preconfig, and then postconfig checks
     28     that everything still makes sense.
     29 
     30     Below are optional defines that add, subtract, or change default behavior
     31     in Skia. Your port can locally edit this file to enable/disable flags as
     32     you choose, or these can be delared on your command line (i.e. -Dfoo).
     33 
     34     By default, this include file will always default to having all of the flags
     35     commented out, so including it will have no effect.
     36 */
     37 
     38 ///////////////////////////////////////////////////////////////////////////////
     39 
     40 //
     41 // ANDROID Specific changes - NO NOT CHECK BACK INTO code.google.com/p/skia
     42 //
     43 
     44 #define SK_BUILD_FOR_ANDROID
     45 
     46 // do this build check for other tools that still read this header
     47 #ifdef ANDROID
     48     #include <utils/misc.h>
     49 #endif
     50 
     51 #define SK_USE_POSIX_THREADS
     52 
     53 /*  Scalars (the fractional value type in skia) can be implemented either as
     54     floats or 16.16 integers (fixed). Exactly one of these two symbols must be
     55     defined.
     56 */
     57 #define SK_SCALAR_IS_FLOAT
     58 #undef SK_SCALAR_IS_FIXED
     59 
     60 
     61 /*  For some performance-critical scalar operations, skia will optionally work
     62     around the standard float operators if it knows that the CPU does not have
     63     native support for floats. If your environment uses software floating point,
     64     define this flag.
     65  */
     66 //#define SK_SOFTWARE_FLOAT
     67 
     68 
     69 /*  Skia has lots of debug-only code. Often this is just null checks or other
     70     parameter checking, but sometimes it can be quite intrusive (e.g. check that
     71     each 32bit pixel is in premultiplied form). This code can be very useful
     72     during development, but will slow things down in a shipping product.
     73 
     74     By default, these mutually exclusive flags are defined in SkPreConfig.h,
     75     based on the presence or absence of NDEBUG, but that decision can be changed
     76     here.
     77  */
     78 //#define SK_DEBUG
     79 //#define SK_RELEASE
     80 
     81 /*  Skia has certain debug-only code that is extremely intensive even for debug
     82     builds.  This code is useful for diagnosing specific issues, but is not
     83     generally applicable, therefore it must be explicitly enabled to avoid
     84     the performance impact. By default these flags are undefined, but can be
     85     enabled by uncommenting them below.
     86  */
     87 //#define SK_DEBUG_GLYPH_CACHE
     88 //#define SK_DEBUG_PATH
     89 
     90 /*  To assist debugging, Skia provides an instance counting utility in
     91     include/core/SkInstCount.h. This flag turns on and off that utility to
     92     allow instance count tracking in either debug or release builds. By
     93     default it is enabled in debug but disabled in release.
     94  */
     95 //#define SK_ENABLE_INST_COUNT 1
     96 
     97 /*  If, in debugging mode, Skia needs to stop (presumably to invoke a debugger)
     98     it will call SK_CRASH(). If this is not defined it, it is defined in
     99     SkPostConfig.h to write to an illegal address
    100  */
    101 //#define SK_CRASH() *(int *)(uintptr_t)0 = 0
    102 
    103 
    104 /*  preconfig will have attempted to determine the endianness of the system,
    105     but you can change these mutually exclusive flags here.
    106  */
    107 #if __BYTE_ORDER == __BIG_ENDIAN
    108     #define SK_CPU_BENDIAN
    109     #undef  SK_CPU_LENDIAN
    110 #else
    111     #define SK_CPU_LENDIAN
    112     #undef  SK_CPU_BENDIAN
    113 #endif
    114 
    115 /*  Most compilers use the same bit endianness for bit flags in a byte as the
    116     system byte endianness, and this is the default. If for some reason this
    117     needs to be overridden, specify which of the mutually exclusive flags to
    118     use. For example, some atom processors in certain configurations have big
    119     endian byte order but little endian bit orders.
    120 */
    121 //#define SK_UINT8_BITFIELD_BENDIAN
    122 //#define SK_UINT8_BITFIELD_LENDIAN
    123 
    124 
    125 /*  Some compilers don't support long long for 64bit integers. If yours does
    126     not, define this to the appropriate type.
    127  */
    128 #define SkLONGLONG int64_t
    129 
    130 
    131 /*  To write debug messages to a console, skia will call SkDebugf(...) following
    132     printf conventions (e.g. const char* format, ...). If you want to redirect
    133     this to something other than printf, define yours here
    134  */
    135 //#define SkDebugf(...)  MyFunction(__VA_ARGS__)
    136 
    137 /*
    138  *  To specify a different default font cache limit, define this. If this is
    139  *  undefined, skia will use a built-in value.
    140  */
    141 #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
    142 
    143 /* If defined, use CoreText instead of ATSUI on OS X.
    144 */
    145 //#define SK_USE_MAC_CORE_TEXT
    146 
    147 
    148 /*  If zlib is available and you want to support the flate compression
    149     algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the
    150     include path. Alternatively, define SK_SYSTEM_ZLIB to use the system zlib
    151     library specified as "#include <zlib.h>".
    152  */
    153 //#define SK_ZLIB_INCLUDE <zlib.h>
    154 //#define SK_SYSTEM_ZLIB
    155 
    156 /*  Define this to allow PDF scalars above 32k.  The PDF/A spec doesn't allow
    157     them, but modern PDF interpreters should handle them just fine.
    158  */
    159 //#define SK_ALLOW_LARGE_PDF_SCALARS
    160 
    161 /*  Define this to provide font subsetter in PDF generation.
    162  */
    163 //#define SK_SFNTLY_SUBSETTER "sfntly/subsetter/font_subsetter.h"
    164 
    165 /*  Define this to remove dimension checks on bitmaps. Not all blits will be
    166     correct yet, so this is mostly for debugging the implementation.
    167  */
    168 //#define SK_ALLOW_OVER_32K_BITMAPS
    169 
    170 /**
    171  *  To revert to int-only srcrect behavior in drawBitmapRect(ToRect),
    172  *  define this symbol.
    173  */
    174 //#define SK_SUPPORT_INT_SRCRECT_DRAWBITMAPRECT
    175 
    176 /*  Define this to set the upper limit for text to support LCD. Values that
    177     are very large increase the cost in the font cache and draw slower, without
    178     improving readability. If this is undefined, Skia will use its default
    179     value (e.g. 48)
    180  */
    181 //#define SK_MAX_SIZE_FOR_LCDTEXT     48
    182 
    183 /*  If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST
    184     which will run additional self-tests at startup. These can take a long time,
    185     so this flag is optional.
    186  */
    187 #ifdef SK_DEBUG
    188 //#define SK_SUPPORT_UNITTEST
    189 #endif
    190 
    191 /* If your system embeds skia and has complex event logging, define this
    192    symbol to name a file that maps the following macros to your system's
    193    equivalents:
    194        SK_TRACE_EVENT0(event)
    195        SK_TRACE_EVENT1(event, name1, value1)
    196        SK_TRACE_EVENT2(event, name1, value1, name2, value2)
    197    src/utils/SkDebugTrace.h has a trivial implementation that writes to
    198    the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined,
    199    SkTrace.h will define the above three macros to do nothing.
    200 */
    201 //#undef SK_USER_TRACE_INCLUDE_FILE
    202 
    203 /*  Change the ordering to work in X windows.
    204  */
    205 #ifdef SK_SAMPLES_FOR_X
    206         #define SK_R32_SHIFT    16
    207         #define SK_G32_SHIFT    8
    208         #define SK_B32_SHIFT    0
    209         #define SK_A32_SHIFT    24
    210 #endif
    211 
    212 
    213 /* Determines whether to build code that supports the GPU backend. Some classes
    214    that are not GPU-specific, such as SkShader subclasses, have optional code
    215    that is used allows them to interact with the GPU backend. If you'd like to
    216    omit this code set SK_SUPPORT_GPU to 0. This also allows you to omit the gpu
    217    directories from your include search path when you're not building the GPU
    218    backend. Defaults to 1 (build the GPU code).
    219  */
    220 //#define SK_SUPPORT_GPU 1
    221 
    222 #endif
    223