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 // When built as part of the system image we can enable certian non-NDK compliant
     45 // optimizations.
     46 #define SK_BUILD_FOR_ANDROID_FRAMEWORK
     47 #define SK_FONTHOST_DOES_NOT_USE_FONTMGR
     48 #define SK_SUPPORT_GPU 1
     49 
     50 // temporary define until we can update the callers to the new convention
     51 #define SK_SUPPORT_LEGACY_PIXELREF_CONSTRUCTOR
     52 
     53 // Android Text Tuning
     54 #define SK_GAMMA_APPLY_TO_A8
     55 #define SK_GAMMA_EXPONENT 1.4
     56 #define SK_GAMMA_CONTRAST 0.0
     57 
     58 // Optimizations for chromium (m30)
     59 #define GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"
     60 #define IGNORE_ROT_AA_RECT_OPT
     61 
     62 // Needed for chromium (m33)
     63 #define SK_DISABLE_OFFSETIMAGEFILTER_OPTIMIZATION
     64 #define SK_IGNORE_BLURRED_RRECT_OPT
     65 #define SK_IGNORE_QUAD_RR_CORNERS_OPT
     66 
     67 // Disable this check because it is too strict for some chromium-specific
     68 // subclasses of SkPixelRef. See bug: crbug.com/171776.
     69 #define SK_DISABLE_PIXELREF_LOCKCOUNT_BALANCE_CHECK
     70 
     71 // do this build check for other tools that still read this header
     72 #ifdef ANDROID
     73     #include <utils/misc.h>
     74 #endif
     75 
     76 #define SK_USE_POSIX_THREADS
     77 
     78 /*  Scalars (the fractional value type in skia) can be implemented either as
     79     floats or 16.16 integers (fixed). Exactly one of these two symbols must be
     80     defined.
     81 */
     82 #define SK_SCALAR_IS_FLOAT
     83 #undef SK_SCALAR_IS_FIXED
     84 
     85 
     86 /*  For some performance-critical scalar operations, skia will optionally work
     87     around the standard float operators if it knows that the CPU does not have
     88     native support for floats. If your environment uses software floating point,
     89     define this flag.
     90  */
     91 //#define SK_SOFTWARE_FLOAT
     92 
     93 
     94 /*  Skia has lots of debug-only code. Often this is just null checks or other
     95     parameter checking, but sometimes it can be quite intrusive (e.g. check that
     96     each 32bit pixel is in premultiplied form). This code can be very useful
     97     during development, but will slow things down in a shipping product.
     98 
     99     By default, these mutually exclusive flags are defined in SkPreConfig.h,
    100     based on the presence or absence of NDEBUG, but that decision can be changed
    101     here.
    102  */
    103 //#define SK_DEBUG
    104 //#define SK_RELEASE
    105 
    106 /*  Skia has certain debug-only code that is extremely intensive even for debug
    107     builds.  This code is useful for diagnosing specific issues, but is not
    108     generally applicable, therefore it must be explicitly enabled to avoid
    109     the performance impact. By default these flags are undefined, but can be
    110     enabled by uncommenting them below.
    111  */
    112 //#define SK_DEBUG_GLYPH_CACHE
    113 //#define SK_DEBUG_PATH
    114 
    115 /*  To assist debugging, Skia provides an instance counting utility in
    116     include/core/SkInstCount.h. This flag turns on and off that utility to
    117     allow instance count tracking in either debug or release builds. By
    118     default it is enabled in debug but disabled in release.
    119  */
    120 //#define SK_ENABLE_INST_COUNT 1
    121 
    122 /*  If, in debugging mode, Skia needs to stop (presumably to invoke a debugger)
    123     it will call SK_CRASH(). If this is not defined it, it is defined in
    124     SkPostConfig.h to write to an illegal address
    125  */
    126 //#define SK_CRASH() *(int *)(uintptr_t)0 = 0
    127 
    128 
    129 /*  preconfig will have attempted to determine the endianness of the system,
    130     but you can change these mutually exclusive flags here.
    131  */
    132 #if __BYTE_ORDER == __BIG_ENDIAN
    133     #define SK_CPU_BENDIAN
    134     #undef  SK_CPU_LENDIAN
    135 #else
    136     #define SK_CPU_LENDIAN
    137     #undef  SK_CPU_BENDIAN
    138 #endif
    139 
    140 /*  Most compilers use the same bit endianness for bit flags in a byte as the
    141     system byte endianness, and this is the default. If for some reason this
    142     needs to be overridden, specify which of the mutually exclusive flags to
    143     use. For example, some atom processors in certain configurations have big
    144     endian byte order but little endian bit orders.
    145 */
    146 //#define SK_UINT8_BITFIELD_BENDIAN
    147 //#define SK_UINT8_BITFIELD_LENDIAN
    148 
    149 
    150 /*  Some compilers don't support long long for 64bit integers. If yours does
    151     not, define this to the appropriate type.
    152  */
    153 #define SkLONGLONG int64_t
    154 
    155 
    156 /*  To write debug messages to a console, skia will call SkDebugf(...) following
    157     printf conventions (e.g. const char* format, ...). If you want to redirect
    158     this to something other than printf, define yours here
    159  */
    160 //#define SkDebugf(...)  MyFunction(__VA_ARGS__)
    161 
    162 /*
    163  *  To specify a different default font cache limit, define this. If this is
    164  *  undefined, skia will use a built-in value.
    165  */
    166 #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
    167 
    168 /*
    169  *  To specify the default size of the image cache, undefine this and set it to
    170  *  the desired value (in bytes). SkGraphics.h as a runtime API to set this
    171  *  value as well. If this is undefined, a built-in value will be used.
    172  */
    173 //#define SK_DEFAULT_IMAGE_CACHE_LIMIT (1024 * 1024)
    174 
    175 /*  If zlib is available and you want to support the flate compression
    176     algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the
    177     include path. Alternatively, define SK_SYSTEM_ZLIB to use the system zlib
    178     library specified as "#include <zlib.h>".
    179  */
    180 //#define SK_ZLIB_INCLUDE <zlib.h>
    181 //#define SK_SYSTEM_ZLIB
    182 
    183 /*  Define this to allow PDF scalars above 32k.  The PDF/A spec doesn't allow
    184     them, but modern PDF interpreters should handle them just fine.
    185  */
    186 //#define SK_ALLOW_LARGE_PDF_SCALARS
    187 
    188 /*  Define this to provide font subsetter in PDF generation.
    189  */
    190 #define SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"
    191 
    192 /*  Define this to set the upper limit for text to support LCD. Values that
    193     are very large increase the cost in the font cache and draw slower, without
    194     improving readability. If this is undefined, Skia will use its default
    195     value (e.g. 48)
    196  */
    197 //#define SK_MAX_SIZE_FOR_LCDTEXT     48
    198 
    199 /*  If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST
    200     which will run additional self-tests at startup. These can take a long time,
    201     so this flag is optional.
    202  */
    203 #ifdef SK_DEBUG
    204 //#define SK_SUPPORT_UNITTEST
    205 #endif
    206 
    207 /* If your system embeds skia and has complex event logging, define this
    208    symbol to name a file that maps the following macros to your system's
    209    equivalents:
    210        SK_TRACE_EVENT0(event)
    211        SK_TRACE_EVENT1(event, name1, value1)
    212        SK_TRACE_EVENT2(event, name1, value1, name2, value2)
    213    src/utils/SkDebugTrace.h has a trivial implementation that writes to
    214    the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined,
    215    SkTrace.h will define the above three macros to do nothing.
    216 */
    217 //#undef SK_USER_TRACE_INCLUDE_FILE
    218 
    219 /*  Change the ordering to work in X windows.
    220  */
    221 #ifdef SK_SAMPLES_FOR_X
    222         #define SK_R32_SHIFT    16
    223         #define SK_G32_SHIFT    8
    224         #define SK_B32_SHIFT    0
    225         #define SK_A32_SHIFT    24
    226 #endif
    227 
    228 
    229 /* Determines whether to build code that supports the GPU backend. Some classes
    230    that are not GPU-specific, such as SkShader subclasses, have optional code
    231    that is used allows them to interact with the GPU backend. If you'd like to
    232    omit this code set SK_SUPPORT_GPU to 0. This also allows you to omit the gpu
    233    directories from your include search path when you're not building the GPU
    234    backend. Defaults to 1 (build the GPU code).
    235  */
    236 //#define SK_SUPPORT_GPU 1
    237 
    238 /* The PDF generation code uses Path Ops to generate inverse fills and complex
    239  * clipping paths, but at this time, Path Ops is not release ready yet. So,
    240  * the code is hidden behind this #define guard. If you are feeling adventurous
    241  * and want the latest and greatest PDF generation code, uncomment the #define.
    242  * When Path Ops is release ready, the define guards and this user config
    243  * define should be removed entirely.
    244  */
    245 //#define SK_PDF_USE_PATHOPS
    246 
    247 #define SK_REF_CNT_MIXIN_INCLUDE "../ports/SkRefCnt_android.h"
    248 
    249 #endif
    250