Home | History | Annotate | Download | only in core
      1 /*
      2  * Copyright (C) 2006 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef SkUserConfig_DEFINED
     18 #define SkUserConfig_DEFINED
     19 
     20 /*  SkTypes.h, the root of the public header files, does the following trick:
     21 
     22     #include "SkPreConfig.h"
     23     #include "SkUserConfig.h"
     24     #include "SkPostConfig.h"
     25 
     26     SkPreConfig.h runs first, and it is responsible for initializing certain
     27     skia defines.
     28 
     29     SkPostConfig.h runs last, and its job is to just check that the final
     30     defines are consistent (i.e. that we don't have mutually conflicting
     31     defines).
     32 
     33     SkUserConfig.h (this file) runs in the middle. It gets to change or augment
     34     the list of flags initially set in preconfig, and then postconfig checks
     35     that everything still makes sense.
     36 
     37     Below are optional defines that add, subtract, or change default behavior
     38     in Skia. Your port can locally edit this file to enable/disable flags as
     39     you choose, or these can be delared on your command line (i.e. -Dfoo).
     40 
     41     By default, this include file will always default to having all of the flags
     42     commented out, so including it will have no effect.
     43 */
     44 
     45 ///////////////////////////////////////////////////////////////////////////////
     46 
     47 //
     48 // ANDROID Specific changes - NO NOT CHECK BACK INTO code.google.com/p/skia
     49 //
     50 
     51 // do this build check for other tools that still read this header
     52 #ifdef ANDROID
     53     #include <utils/misc.h>
     54 #endif
     55 
     56 #ifdef SK_BUILD_FOR_MAC
     57     #undef SK_BUILD_FOR_MAC
     58 #endif
     59 #define SK_BUILD_FOR_UNIX
     60 
     61 /*  Scalars (the fractional value type in skia) can be implemented either as
     62     floats or 16.16 integers (fixed). Exactly one of these two symbols must be
     63     defined.
     64 */
     65 #define SK_SCALAR_IS_FLOAT
     66 #undef SK_SCALAR_IS_FIXED
     67 
     68 
     69 /*  Somewhat independent of how SkScalar is implemented, Skia also wants to know
     70     if it can use floats at all. Naturally, if SK_SCALAR_IS_FLOAT is defined,
     71     then so muse SK_CAN_USE_FLOAT, but if scalars are fixed, SK_CAN_USE_FLOAT
     72     can go either way.
     73  */
     74 #define SK_CAN_USE_FLOAT
     75 
     76 /*  For some performance-critical scalar operations, skia will optionally work
     77     around the standard float operators if it knows that the CPU does not have
     78     native support for floats. If your environment uses software floating point,
     79     define this flag.
     80  */
     81 //#define SK_SOFTWARE_FLOAT
     82 
     83 
     84 /*  Skia has lots of debug-only code. Often this is just null checks or other
     85     parameter checking, but sometimes it can be quite intrusive (e.g. check that
     86     each 32bit pixel is in premultiplied form). This code can be very useful
     87     during development, but will slow things down in a shipping product.
     88 
     89     By default, these mutually exclusive flags are defined in SkPreConfig.h,
     90     based on the presence or absence of NDEBUG, but that decision can be changed
     91     here.
     92  */
     93 //#define SK_DEBUG
     94 //#define SK_RELEASE
     95 
     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 
    116 /*  Some compilers don't support long long for 64bit integers. If yours does
    117     not, define this to the appropriate type.
    118  */
    119 #define SkLONGLONG int64_t
    120 
    121 
    122 /*  Some envorinments do not suport writable globals (eek!). If yours does not,
    123     define this flag.
    124  */
    125 //#define SK_USE_RUNTIME_GLOBALS
    126 
    127 
    128 /*  To write debug messages to a console, skia will call SkDebugf(...) following
    129     printf conventions (e.g. const char* format, ...). If you want to redirect
    130     this to something other than printf, define yours here
    131  */
    132 #define SkDebugf(...) Android_SkDebugf(__FILE__, __LINE__, \
    133                                         __FUNCTION__, __VA_ARGS__)
    134 void Android_SkDebugf(const char* file, int line,
    135                       const char* function, const char* format, ...);
    136 
    137 /*  To enable additional blitters (and fontscaler code) to support separate
    138     alpha channels for R G B channels, define SK_SUPPORT_LCDTEXT
    139  */
    140 //#define SK_SUPPORT_LCDTEXT
    141 
    142 /*  If zlib is available and you want to support the flate compression
    143     algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the
    144     include path.
    145  */
    146 //#define SK_ZLIB_INCLUDE <zlib.h>
    147 
    148 /*  Define this to allow PDF scalars above 32k.  The PDF/A spec doesn't allow
    149     them, but modern PDF interpreters should handle them just fine.
    150  */
    151 //#define SK_ALLOW_LARGE_PDF_SCALARS
    152 
    153 /*  Define this to remove dimension checks on bitmaps. Not all blits will be
    154     correct yet, so this is mostly for debugging the implementation.
    155  */
    156 //#define SK_ALLOW_OVER_32K_BITMAPS
    157 
    158 /*  If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST
    159     which will run additional self-tests at startup. These can take a long time,
    160     so this flag is optional.
    161  */
    162 #ifdef SK_DEBUG
    163     #define SK_SUPPORT_UNITTEST
    164 #endif
    165 
    166 /*  Change the ordering to work in X windows.
    167  */
    168 #ifdef SK_SAMPLES_FOR_X
    169         #define SK_R32_SHIFT    16
    170         #define SK_G32_SHIFT    8
    171         #define SK_B32_SHIFT    0
    172         #define SK_A32_SHIFT    24
    173 #endif
    174 
    175 #endif
    176 
    177