diff options
Diffstat (limited to 'skia')
-rw-r--r-- | skia/config/SkUserConfig.h | 268 | ||||
-rw-r--r-- | skia/ext/DEPS | 3 | ||||
-rw-r--r-- | skia/ext/google_logging.cc | 24 | ||||
-rw-r--r-- | skia/skia.gyp | 71 | ||||
-rw-r--r-- | skia/skia_common.gypi | 157 | ||||
-rw-r--r-- | skia/skia_library.gypi | 312 | ||||
-rw-r--r-- | skia/skia_library_opts.gyp | 330 | ||||
-rw-r--r-- | skia/skia_pdfium.gypi | 29 |
8 files changed, 1194 insertions, 0 deletions
diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h new file mode 100644 index 0000000000..2f13fda7b5 --- /dev/null +++ b/skia/config/SkUserConfig.h @@ -0,0 +1,268 @@ +/* + * Copyright (C) 2006 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SKIA_CONFIG_SKUSERCONFIG_H_ +#define SKIA_CONFIG_SKUSERCONFIG_H_ + +/* SkTypes.h, the root of the public header files, does the following trick: + + #include <SkPreConfig.h> + #include <SkUserConfig.h> + #include <SkPostConfig.h> + + SkPreConfig.h runs first, and it is responsible for initializing certain + skia defines. + + SkPostConfig.h runs last, and its job is to just check that the final + defines are consistent (i.e. that we don't have mutually conflicting + defines). + + SkUserConfig.h (this file) runs in the middle. It gets to change or augment + the list of flags initially set in preconfig, and then postconfig checks + that everything still makes sense. + + Below are optional defines that add, subtract, or change default behavior + in Skia. Your port can locally edit this file to enable/disable flags as + you choose, or these can be delared on your command line (i.e. -Dfoo). + + By default, this include file will always default to having all of the flags + commented out, so including it will have no effect. +*/ + +/////////////////////////////////////////////////////////////////////////////// + +/* Skia has lots of debug-only code. Often this is just null checks or other + parameter checking, but sometimes it can be quite intrusive (e.g. check that + each 32bit pixel is in premultiplied form). This code can be very useful + during development, but will slow things down in a shipping product. + + By default, these mutually exclusive flags are defined in SkPreConfig.h, + based on the presence or absence of NDEBUG, but that decision can be changed + here. + */ +// #define SK_DEBUG +// #define SK_RELEASE + +// #ifdef DCHECK_ALWAYS_ON +// #undef SK_RELEASE +// #define SK_DEBUG +// #endif + +/* If, in debugging mode, Skia needs to stop (presumably to invoke a debugger) + it will call SK_CRASH(). If this is not defined it, it is defined in + SkPostConfig.h to write to an illegal address + */ +// #define SK_CRASH() *(int *)(uintptr_t)0 = 0 + +/* preconfig will have attempted to determine the endianness of the system, + but you can change these mutually exclusive flags here. + */ +// #define SK_CPU_BENDIAN +// #define SK_CPU_LENDIAN + +/* If zlib is available and you want to support the flate compression + algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the + include path. + */ +// #define SK_ZLIB_INCLUDE <zlib.h> + +/* Define this to allow PDF scalars above 32k. The PDF/A spec doesn't allow + them, but modern PDF interpreters should handle them just fine. + */ +// #define SK_ALLOW_LARGE_PDF_SCALARS + +/* Define this to provide font subsetter for font subsetting when generating + PDF documents. + */ +// #define SK_SFNTLY_SUBSETTER \ +// "third_party/sfntly/src/cpp/src/sample/chromium/font_subsetter.h" + +/* To write debug messages to a console, skia will call SkDebugf(...) following + printf conventions (e.g. const char* format, ...). If you want to redirect + this to something other than printf, define yours here + */ +// #define SkDebugf(...) MyFunction(__VA_ARGS__) + +/* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST + which will run additional self-tests at startup. These can take a long time, + so this flag is optional. + */ +#ifdef SK_DEBUG +#define SK_SUPPORT_UNITTEST +#endif + +/* If cross process SkPictureImageFilters are not explicitly enabled then + they are always disabled. + */ +#ifndef SK_ALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS +#ifndef SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS +#define SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS +#endif +#endif + +/* If your system embeds skia and has complex event logging, define this + symbol to name a file that maps the following macros to your system's + equivalents: + SK_TRACE_EVENT0(event) + SK_TRACE_EVENT1(event, name1, value1) + SK_TRACE_EVENT2(event, name1, value1, name2, value2) + src/utils/SkDebugTrace.h has a trivial implementation that writes to + the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined, + SkTrace.h will define the above three macros to do nothing. +*/ +#undef SK_USER_TRACE_INCLUDE_FILE + +// ===== Begin Chrome-specific definitions ===== + +#define SK_SCALAR_IS_FLOAT +#undef SK_SCALAR_IS_FIXED + +#define SK_MSCALAR_IS_FLOAT +#undef SK_MSCALAR_IS_DOUBLE + +#define GR_MAX_OFFSCREEN_AA_DIM 512 + +// Log the file and line number for assertions. +#define SkDebugf(...) SkDebugf_FileLine(__FILE__, __LINE__, false, __VA_ARGS__) +SK_API void SkDebugf_FileLine(const char* file, + int line, + bool fatal, + const char* format, + ...); + +// Marking the debug print as "fatal" will cause a debug break, so we don't need +// a separate crash call here. +#define SK_DEBUGBREAK(cond) \ + do { \ + if (!(cond)) { \ + SkDebugf_FileLine(__FILE__, __LINE__, true, \ + "%s:%d: failed assertion \"%s\"\n", __FILE__, \ + __LINE__, #cond); \ + } \ + } while (false) + +#if !defined(ANDROID) // On Android, we use the skia default settings. +#define SK_A32_SHIFT 24 +#define SK_R32_SHIFT 16 +#define SK_G32_SHIFT 8 +#define SK_B32_SHIFT 0 +#endif + +#if defined(SK_BUILD_FOR_WIN32) + +#define SK_BUILD_FOR_WIN + +// Skia uses this deprecated bzero function to fill zeros into a string. +#define bzero(str, len) memset(str, 0, len) + +#elif defined(SK_BUILD_FOR_MAC) + +#define SK_CPU_LENDIAN +#undef SK_CPU_BENDIAN + +#elif defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) + +// Prefer FreeType's emboldening algorithm to Skia's +// TODO: skia used to just use hairline, but has improved since then, so +// we should revisit this choice... +#define SK_USE_FREETYPE_EMBOLDEN + +#if defined(SK_BUILD_FOR_UNIX) && defined(SK_CPU_BENDIAN) +// Above we set the order for ARGB channels in registers. I suspect that, on +// big endian machines, you can keep this the same and everything will work. +// The in-memory order will be different, of course, but as long as everything +// is reading memory as words rather than bytes, it will all work. However, if +// you find that colours are messed up I thought that I would leave a helpful +// locator for you. Also see the comments in +// base/gfx/bitmap_platform_device_linux.h +#error Read the comment at this location +#endif + +#endif + +// The default crash macro writes to badbeef which can cause some strange +// problems. Instead, pipe this through to the logging function as a fatal +// assertion. +#define SK_CRASH() SkDebugf_FileLine(__FILE__, __LINE__, true, "SK_CRASH") + +// These flags are no longer defined in Skia, but we have them (temporarily) +// until we update our call-sites (typically these are for API changes). +// +// Remove these as we update our sites. +// +#ifndef SK_SUPPORT_LEGACY_GETTOPDEVICE +#define SK_SUPPORT_LEGACY_GETTOPDEVICE +#endif + +#ifndef SK_SUPPORT_LEGACY_GETDEVICE +#define SK_SUPPORT_LEGACY_GETDEVICE +#endif + +// Workaround for poor anisotropic mipmap quality, +// pending Skia ripmap support. +// (https://bugs.chromium.org/p/skia/issues/detail?id=4863) +#ifndef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE +#define SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE +#endif + +#ifndef SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX +#define SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX +#endif + +#ifndef SK_IGNORE_ETC1_SUPPORT +#define SK_IGNORE_ETC1_SUPPORT +#endif + +#ifndef SK_IGNORE_GPU_DITHER +#define SK_IGNORE_GPU_DITHER +#endif + +#ifndef SK_SUPPORT_LEGACY_EVAL_CUBIC +#define SK_SUPPORT_LEGACY_EVAL_CUBIC +#endif + +///////////////////////// Imported from BUILD.gn and skia_common.gypi + +/* In some places Skia can use static initializers for global initialization, + * or fall back to lazy runtime initialization. Chrome always wants the latter. + */ +#define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0 + +/* This flag forces Skia not to use typographic metrics with GDI. + */ +#define SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS + +#define SK_IGNORE_BLURRED_RRECT_OPT +#define SK_USE_DISCARDABLE_SCALEDIMAGECACHE +#define SK_WILL_NEVER_DRAW_PERSPECTIVE_TEXT + +#define SK_ATTR_DEPRECATED SK_NOTHING_ARG1 +#define SK_ENABLE_INST_COUNT 0 +#define GR_GL_CUSTOM_SETUP_HEADER "GrGLConfig_chrome.h" + +// Blink layout tests are baselined to Clang optimizing through the UB in +// SkDivBits. +#define SK_SUPPORT_LEGACY_DIVBITS_UB + +// mtklein's fiddling with Src / SrcOver. Will rebaseline these only once when +// done. +#define SK_SUPPORT_LEGACY_X86_BLITS + +#define SK_DISABLE_TILE_IMAGE_FILTER_OPTIMIZATION + +// ===== End Chrome-specific definitions ===== + +#endif // SKIA_CONFIG_SKUSERCONFIG_H_ diff --git a/skia/ext/DEPS b/skia/ext/DEPS new file mode 100644 index 0000000000..007e5550d5 --- /dev/null +++ b/skia/ext/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + '+third_party/skia/include/core' +] diff --git a/skia/ext/google_logging.cc b/skia/ext/google_logging.cc new file mode 100644 index 0000000000..c0ddd99c0e --- /dev/null +++ b/skia/ext/google_logging.cc @@ -0,0 +1,24 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file provides integration with Google-style "base/logging.h" assertions +// for Skia SkASSERT. If you don't want this, you can link with another file +// that provides integration with the logging of your choice. + +#include <stdio.h> + +#include "third_party/skia/include/core/SkTypes.h" + +void SkDebugf_FileLine(const char* file, + int line, + bool fatal, + const char* format, + ...) { + va_list ap; + va_start(ap, format); + + fprintf(stderr, "%s:%d ", file, line); + vfprintf(stderr, format, ap); + va_end(ap); +} diff --git a/skia/skia.gyp b/skia/skia.gyp new file mode 100644 index 0000000000..29f5464938 --- /dev/null +++ b/skia/skia.gyp @@ -0,0 +1,71 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'conditions': [ + # In component mode (shared_lib), we build all of skia as a single DLL. + # However, in the static mode, we need to build skia as multiple targets + # in order to support the use case where a platform (e.g. Android) may + # already have a copy of skia as a system library. + ['component=="static_library"', { + 'targets': [ + { + 'target_name': 'skia_library', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + 'skia_library.gypi', + ], + }, + ], + }], + ['component=="static_library"', { + 'targets': [ + { + 'target_name': 'skia', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'type': 'none', + 'dependencies': [ + 'skia_library', + 'skia_pdfium', + ], + 'export_dependent_settings': [ + 'skia_library', + 'skia_pdfium', + ], + 'direct_dependent_settings': { + 'conditions': [ + [ 'OS == "win"', { + 'defines': [ + 'GR_GL_FUNCTION_TYPE=__stdcall', + ], + }], + ], + }, + }, + { + 'target_name': 'skia_pdfium', + 'type': 'static_library', + 'includes': [ + 'skia_pdfium.gypi', + 'skia_common.gypi', + ], + }, + ], + }], + ], +} diff --git a/skia/skia_common.gypi b/skia/skia_common.gypi new file mode 100644 index 0000000000..4b7a51b6b1 --- /dev/null +++ b/skia/skia_common.gypi @@ -0,0 +1,157 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This gypi file handles the removal of platform-specific files from the +# Skia build. +{ + 'include_dirs': [ + '..', + 'config', + ], + + 'conditions': [ + [ 'OS != "android"', { + 'sources/': [ + ['exclude', '_android\\.(cc|cpp)$'], + ], + }], + [ 'OS != "ios"', { + 'sources/': [ + ['exclude', '_ios\\.(cc|cpp|mm?)$'], + ], + }], + [ 'OS == "ios"', { + 'defines': [ + 'SK_BUILD_FOR_IOS', + ], + }], + [ 'OS != "mac"', { + 'sources/': [ + ['exclude', '_mac\\.(cc|cpp|mm?)$'], + ], + }], + [ 'OS == "mac"', { + 'defines': [ + 'SK_BUILD_FOR_MAC', + ], + }], + [ 'OS != "win"', { + 'sources/': [ ['exclude', '_win\\.(cc|cpp)$'] ], + }], + [ 'OS == "win"', { + 'defines': [ + # On windows, GDI handles are a scarse system-wide resource so we have to keep + # the glyph cache, which holds up to 4 GDI handles per entry, to a fairly small + # size. + # http://crbug.com/314387 + 'SK_DEFAULT_FONT_CACHE_COUNT_LIMIT=256', + 'GR_GL_FUNCTION_TYPE=__stdcall', + ], + }], + [ 'OS!="linux"', { + 'sources/': [ ['exclude', '_linux\\.(cc|cpp)$'] ], + }], + + #Settings for text blitting, chosen to approximate the system browser. + [ 'OS == "linux"', { + 'defines': [ + 'SK_GAMMA_EXPONENT=1.2', + 'SK_GAMMA_CONTRAST=0.2', + ], + }], + ['OS == "android"', { + 'defines': [ + 'SK_GAMMA_APPLY_TO_A8', + 'SK_GAMMA_EXPONENT=1.4', + 'SK_GAMMA_CONTRAST=0.0', + ], + }], + ['OS == "win"', { + 'defines': [ + 'SK_GAMMA_SRGB', + 'SK_GAMMA_CONTRAST=0.5', + ], + }], + ['OS == "mac"', { + 'defines': [ + 'SK_GAMMA_SRGB', + 'SK_GAMMA_CONTRAST=0.0', + ], + }], + + # Neon support. + [ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 1', { + 'defines': [ + 'SK_ARM_HAS_NEON', + ], + }], + [ 'target_arch == "arm" and arm_version >= 7 and arm_neon == 0 and arm_neon_optional == 1', { + 'defines': [ + 'SK_ARM_HAS_OPTIONAL_NEON', + ], + }], + ], + + 'variables': { + 'variables': { + 'conditions': [ + ['OS== "ios"', { + 'skia_support_gpu': 0, + }, { + 'skia_support_gpu': 1, + }], + ], + }, + 'skia_support_gpu': '<(skia_support_gpu)', + 'skia_support_pdf': '<(skia_support_pdf)', + + # These two set the paths so we can include skia/gyp/core.gypi + 'skia_src_path': '../third_party/skia/src', + 'skia_include_path': '../third_party/skia/include', + + # This list will contain all defines that also need to be exported to + # dependent components. + 'skia_export_defines': [ + 'SK_SUPPORT_GPU=<(skia_support_gpu)', + ], + + 'default_font_cache_limit%': '(20*1024*1024)', + + 'conditions': [ + ['OS== "android"', { + # Android devices are typically more memory constrained, so + # default to a smaller glyph cache (it may be overriden at runtime + # when the renderer starts up, depending on the actual device memory). + 'default_font_cache_limit': '(1*1024*1024)', + 'skia_export_defines': [ + 'SK_BUILD_FOR_ANDROID', + ], + }], + ], + }, + + 'defines': [ + '<@(skia_export_defines)', + + 'SK_DEFAULT_FONT_CACHE_LIMIT=<(default_font_cache_limit)', + ], + + 'direct_dependent_settings': { + 'defines': [ + '<@(skia_export_defines)', + ], + }, + + # We would prefer this to be direct_dependent_settings, + # however we currently have no means to enforce that direct dependents + # re-export if they include Skia headers in their public headers. + 'all_dependent_settings': { + 'include_dirs': [ + '..', + 'config', + ], + }, + + 'msvs_disabled_warnings': [4244, 4267, 4341, 4345, 4390, 4554, 4748, 4800], +} diff --git a/skia/skia_library.gypi b/skia/skia_library.gypi new file mode 100644 index 0000000000..fea93a3abc --- /dev/null +++ b/skia/skia_library.gypi @@ -0,0 +1,312 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +# This gypi file contains the Skia library. +# In component mode (shared_lib) it is folded into a single shared library with +# the Chrome-specific enhancements but in all other cases it is a separate lib. + +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# variables and defines should go in skia_common.gypi so they can be seen +# by files listed here and in skia_library_opts.gypi. +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +{ + 'dependencies': [ + 'skia_library_opts.gyp:skia_opts', + '../third_party/third_party.gyp:fx_zlib', + ], + + 'includes': [ + '../third_party/skia/gyp/core.gypi', + '../third_party/skia/gyp/effects.gypi', + '../third_party/skia/gyp/pdf.gypi', + '../third_party/skia/gyp/utils.gypi', + ], + + 'sources': [ + '../third_party/skia/src/lazy/SkDiscardableMemoryPool.cpp', + + '../third_party/skia/src/ports/SkImageDecoder_empty.cpp', + '../third_party/skia/src/images/SkScaledBitmapSampler.cpp', + + '../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp', + '../third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp', + + '../third_party/skia/src/ports/SkDiscardableMemory_none.cpp', + + '../third_party/skia/src/fonts/SkFontMgr_indirect.cpp', + '../third_party/skia/src/ports/SkFontHost_FreeType.cpp', + + '../third_party/skia/src/ports/SkFontMgr_empty_factory.cpp', + '../third_party/skia/src/fonts/SkFontMgr_indirect.cpp', + '../third_party/skia/src/fonts/SkRemotableFontMgr.cpp', + '../third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp', + + '../third_party/skia/src/ports/SkImageGenerator_none.cpp', + + '../third_party/skia/src/ports/SkFontHost_FreeType.cpp', + '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp', + '../third_party/skia/src/ports/SkFontHost_mac.cpp', + '../third_party/skia/src/ports/SkFontHost_win.cpp', + "../third_party/skia/src/ports/SkFontMgr_android.cpp", + "../third_party/skia/src/ports/SkFontMgr_android_factory.cpp", + '../third_party/skia/src/ports/SkFontMgr_android_parser.cpp', + '../third_party/skia/src/ports/SkFontMgr_win_dw.cpp', + '../third_party/skia/src/ports/SkGlobalInitialization_default.cpp', + '../third_party/skia/src/ports/SkMemory_malloc.cpp', + '../third_party/skia/src/ports/SkOSFile_posix.cpp', + '../third_party/skia/src/ports/SkOSFile_stdio.cpp', + '../third_party/skia/src/ports/SkOSFile_win.cpp', + '../third_party/skia/src/ports/SkScalerContext_win_dw.cpp', + '../third_party/skia/src/ports/SkTime_Unix.cpp', + '../third_party/skia/src/ports/SkTLS_pthread.cpp', + '../third_party/skia/src/ports/SkTLS_win.cpp', + '../third_party/skia/src/ports/SkTypeface_win_dw.cpp', + + '../third_party/skia/src/sfnt/SkOTTable_name.cpp', + '../third_party/skia/src/sfnt/SkOTUtils.cpp', + ], + + # Exclude all unused files in skia utils.gypi file + 'sources!': [ + '../third_party/skia/src/utils/SkBoundaryPatch.cpp', + '../third_party/skia/src/utils/SkFrontBufferedStream.cpp', + '../third_party/skia/src/utils/SkCamera.cpp', + '../third_party/skia/src/utils/SkDumpCanvas.cpp', + '../third_party/skia/src/utils/SkInterpolator.cpp', + '../third_party/skia/src/utils/SkLayer.cpp', + '../third_party/skia/src/utils/SkMD5.cpp', + '../third_party/skia/src/utils/SkMeshUtils.cpp', + '../third_party/skia/src/utils/SkNinePatch.cpp', + '../third_party/skia/src/utils/SkOSFile.cpp', + '../third_party/skia/src/utils/SkParsePath.cpp', + +#windows + '../third_party/skia/src/utils/win/SkAutoCoInitialize.cpp', + '../third_party/skia/src/utils/win/SkIStream.cpp', + '../third_party/skia/src/utils/win/SkWGL_win.cpp', + +#testing + '../third_party/skia/src/fonts/SkGScalerContext.cpp', + ], + + 'include_dirs': [ + '../third_party/skia/include/c', + '../third_party/skia/include/core', + '../third_party/skia/include/client/android', + '../third_party/skia/include/effects', + '../third_party/skia/include/images', + '../third_party/skia/include/lazy', + '../third_party/skia/include/pathops', + '../third_party/skia/include/pdf', + '../third_party/skia/include/pipe', + '../third_party/skia/include/ports', + '../third_party/skia/include/private', + '../third_party/skia/include/utils', + '../third_party/skia/src/core', + '../third_party/skia/src/opts', + '../third_party/skia/src/image', + '../third_party/skia/src/pdf', + '../third_party/skia/src/ports', + '../third_party/skia/src/sfnt', + '../third_party/skia/src/utils', + '../third_party/skia/src/lazy', + ], + 'conditions': [ + ['skia_support_gpu != 0', { + 'includes': [ + '../third_party/skia/gyp/gpu.gypi', + ], + 'sources': [ + '<@(skgpu_null_gl_sources)', + '<@(skgpu_sources)', + ], + 'include_dirs': [ + '../third_party/skia/include/gpu', + '../third_party/skia/src/gpu', + ], + }], + ['skia_support_pdf == 0', { + 'sources/': [ + ['exclude', '../third_party/skia/src/doc/SkDocument_PDF.cpp'], + ['exclude', '../third_party/skia/src/pdf/'], + ], + }], + ['skia_support_pdf == 1', { + 'dependencies': [ + '../third_party/sfntly/sfntly.gyp:sfntly', + ], + }], + + [ 'OS == "win"', { + 'sources!': [ + # Keeping _win.cpp + "../third_party/skia/src/utils/SkThreadUtils_pthread.cpp", + ], + },{ + 'sources!': [ + # Keeping _pthread.cpp + "../third_party/skia/src/utils/SkThreadUtils_win.cpp", + ], + }], + + [ 'OS != "mac"', { + 'sources/': [ + ['exclude', '/mac/'] + ], + }], + [ 'OS == "android" and target_arch == "arm"', { + 'sources': [ + '../third_party/skia/src/core/SkUtilsArm.cpp', + ], + }], + [ 'OS=="linux"', { + 'dependencies': [ + '../third_party/third_party.gyp:fx_freetype' + ], + 'cflags': [ + '-Wno-unused', + '-Wno-unused-function', + ], + # TODO(dsinclair): Right way to use third_party.gyp:fx_freetype? + 'include_dirs': [ + '../third_party/freetype/include', + ], + }], + [ 'OS=="win" or OS=="mac" or OS=="ios" or OS=="android"', { + 'sources!': [ + '../third_party/skia/src/ports/SkFontConfigInterface_direct.cpp', + '../third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp', + '../third_party/skia/src/ports/SkFontHost_fontconfig.cpp', + '../third_party/skia/src/fonts/SkFontMgr_fontconfig.cpp', + ], + }], + [ 'OS=="win" or OS=="mac" or OS=="ios"', { + 'sources!': [ + '../third_party/skia/src/ports/SkFontHost_FreeType.cpp', + '../third_party/skia/src/ports/SkFontHost_FreeType_common.cpp', + + ], + }], + [ 'OS == "android"', { + 'dependencies': [ + '../third_party/expat/expat.gyp:expat', + '../third_party/freetype-android/freetype.gyp:ft2', + ], + # This exports a hard dependency because it needs to run its + # symlink action in order to expose the skia header files. + 'hard_dependency': 1, + 'include_dirs': [ + '../third_party/expat/files/lib', + ], + },{ # not 'OS == "android"' + 'sources!': [ + "../third_party/skia/src/ports/SkFontMgr_android_factory.cpp", + '../third_party/skia/src/ports/SkFontMgr_android_parser.cpp', + ], + }], + [ 'OS == "ios"', { + 'include_dirs': [ + '../third_party/skia/include/utils/ios', + '../third_party/skia/include/utils/mac', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/ImageIO.framework', + ], + }, + 'sources': [ + # This file is used on both iOS and Mac, so it should be removed + # from the ios and mac conditions and moved into the main sources + # list. + '../third_party/skia/src/utils/mac/SkStream_mac.cpp', + ], + + # The main skia_opts target does not currently work on iOS because the + # target architecture on iOS is determined at compile time rather than + # gyp time (simulator builds are x86, device builds are arm). As a + # temporary measure, this is a separate opts target for iOS-only, using + # the _none.cpp files to avoid architecture-dependent implementations. + 'dependencies': [ + 'skia_library_opts.gyp:skia_opts_none', + ], + 'dependencies!': [ + 'skia_library_opts.gyp:skia_opts', + ], + }], + [ 'OS == "mac"', { + 'direct_dependent_settings': { + 'include_dirs': [ + '../third_party/skia/include/utils/mac', + ], + }, + 'include_dirs': [ + '../third_party/skia/include/utils/mac', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/AppKit.framework', + ], + }, + 'sources': [ + '../third_party/skia/src/utils/mac/SkStream_mac.cpp', + ], + }], + [ 'OS == "win"', { + 'sources!': [ + '../third_party/skia/src/ports/SkOSFile_posix.cpp', + '../third_party/skia/src/ports/SkTime_Unix.cpp', + '../third_party/skia/src/ports/SkTLS_pthread.cpp', + ], + 'include_dirs': [ + '../third_party/skia/include/utils/win', + '../third_party/skia/src/utils/win', + ], + },{ # not 'OS == "win"' + 'sources!': [ + '../third_party/skia/src/ports/SkFontMgr_win_dw.cpp', + '../third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp', + '../third_party/skia/src/ports/SkScalerContext_win_dw.cpp', + '../third_party/skia/src/ports/SkTypeface_win_dw.cpp', + + '../third_party/skia/src/utils/win/SkDWrite.cpp', + '../third_party/skia/src/utils/win/SkDWriteFontFileStream.cpp', + '../third_party/skia/src/utils/win/SkDWriteGeometrySink.cpp', + '../third_party/skia/src/utils/win/SkHRESULT.cpp', + ], + }], + ], + 'target_conditions': [ + # Pull in specific Mac files for iOS (which have been filtered out + # by file name rules). + [ 'OS == "ios"', { + 'sources/': [ + ['include', 'SkFontHost_mac\\.cpp$',], + ['include', 'SkStream_mac\\.cpp$',], + ['include', 'SkCreateCGImageRef\\.cpp$',], + ], + 'xcode_settings' : { + 'WARNING_CFLAGS': [ + # SkFontHost_mac.cpp uses API deprecated in iOS 7. + # crbug.com/408571 + '-Wno-deprecated-declarations', + ], + }, + }], + ], + + 'direct_dependent_settings': { + 'include_dirs': [ + '../third_party/skia/include/core', + '../third_party/skia/include/effects', + '../third_party/skia/include/pdf', + '../third_party/skia/include/gpu', + '../third_party/skia/include/lazy', + '../third_party/skia/include/pathops', + '../third_party/skia/include/pipe', + '../third_party/skia/include/ports', + '../third_party/skia/include/utils', + ], + }, +} diff --git a/skia/skia_library_opts.gyp b/skia/skia_library_opts.gyp new file mode 100644 index 0000000000..32b69bb164 --- /dev/null +++ b/skia/skia_library_opts.gyp @@ -0,0 +1,330 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This gyp file contains the platform-specific optimizations for Skia +{ + 'variables': { + 'skia_src_path': '../third_party/skia/src', + 'includes': [ '../third_party/skia/gyp/opts.gypi' ], + 'include_dirs': [ + '../third_party/skia/include/core', + '../third_party/skia/include/effects', + '../third_party/skia/include/private', + '../third_party/skia/include/utils', + '../third_party/skia/src/core', + '../third_party/skia/src/opts', + '../third_party/skia/src/utils', + ], + }, + + 'targets': [ + # SSE files have to be built in a separate target, because gcc needs + # different -msse flags for different SSE levels which enable use of SSE + # intrinsics but also allow emission of SSE2 instructions for scalar code. + # gyp does not allow per-file compiler flags. + # For about the same reason, we need to compile the ARM opts files + # separately as well. + { + 'target_name': 'skia_opts', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'conditions': [ + [ 'target_arch != "arm" and target_arch != "mipsel" and \ + target_arch != "arm64" and target_arch != "mips64el"', { + # Chrome builds with -msse2 locally, so sse2_sources could in theory + # be in the regular skia target. But we need skia_opts for arm + # anyway, so putting sse2_sources here is simpler than making this + # conditionally a type none target on x86. + 'sources': [ '<@(sse2_sources)' ], + 'dependencies': [ + 'skia_opts_ssse3', + 'skia_opts_sse41', + 'skia_opts_sse42', + 'skia_opts_avx', + 'skia_opts_avx2', + ], + }], + [ 'target_arch == "arm"', { + 'conditions': [ + [ 'arm_version >= 7', { + 'sources': [ '<@(armv7_sources)' ], + }, { # arm_version < 7 + 'sources': [ '<@(none_sources)' ], + }], + [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', { + 'dependencies': [ + 'skia_opts_neon', + ] + }], + ], + # The assembly uses the frame pointer register (r7 in Thumb/r11 in + # ARM), the compiler doesn't like that. Explicitly remove the + # -fno-omit-frame-pointer flag for Android, as that gets added to all + # targets via common.gypi. + 'cflags!': [ + '-fno-omit-frame-pointer', + '-marm', + '-mapcs-frame', + ], + 'cflags': [ + '-fomit-frame-pointer', + ], + }], + [ 'target_arch == "mipsel"',{ + 'cflags': [ '-fomit-frame-pointer' ], + 'conditions': [ + [ 'mips_dsp_rev >= 1', { + 'sources': [ '<@(mips_dsp_sources)' ], + }, { # mips_dsp_rev == 0 + 'sources': [ '<@(none_sources)' ], + }], + ], + }], + [ 'target_arch == "mips64el"',{ + 'cflags': [ '-fomit-frame-pointer' ], + 'sources': [ '<@(none_sources)' ], + }], + [ 'target_arch == "arm64"', { + 'sources': [ '<@(arm64_sources)' ], + }], + ], + }, + # For the same lame reasons as what is done for skia_opts, we have to + # create another target specifically for SSSE3 code as we would not want + # to compile the SSE2 code with -mssse3 which would potentially allow + # gcc to generate SSSE3 code. + { + 'target_name': 'skia_opts_ssse3', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'conditions': [ + [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + 'cflags': [ '-mssse3' ], + }], + [ 'OS == "mac"', { + 'xcode_settings': { + 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', + }, + }], + [ 'OS == "win" and clang == 1', { + # cl.exe's /arch flag doesn't have a setting for SSSE3, and cl.exe + # doesn't need it for intrinsics. clang-cl does need it, though. + 'msvs_settings': { + 'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] }, + }, + }], + [ 'OS == "win"', { + 'defines' : [ 'SK_CPU_SSE_LEVEL=31' ], + }], + [ 'target_arch != "arm" and target_arch != "arm64" and \ + target_arch != "mipsel" and target_arch != "mips64el"', { + 'sources': [ '<@(ssse3_sources)' ], + }], + ], + }, + # For the same lame reasons as what is done for skia_opts, we also have to + # create another target specifically for SSE4.1 code as we would not want + # to compile the SSE2 code with -msse4.1 which would potentially allow + # gcc to generate SSE4.1 code. + { + 'target_name': 'skia_opts_sse41', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'sources': [ '<@(sse41_sources)' ], + 'conditions': [ + [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + 'cflags': [ '-msse4.1' ], + }], + [ 'OS == "mac"', { + 'xcode_settings': { + 'GCC_ENABLE_SSE41_EXTENSIONS': 'YES', + }, + }], + [ 'OS == "win" and clang == 1', { + # cl.exe's /arch flag doesn't have a setting for SSE4.1, and cl.exe + # doesn't need it for intrinsics. clang-cl does need it, though. + 'msvs_settings': { + 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] }, + }, + }], + [ 'OS == "win"', { + 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ], + }], + ], + }, + { + 'target_name': 'skia_opts_sse42', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'sources': [ '<@(sse42_sources)' ], + 'conditions': [ + [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + 'cflags': [ '-msse4.2' ], + }], + [ 'OS == "mac"', { + 'xcode_settings': { + 'GCC_ENABLE_SSE42_EXTENSIONS': 'YES', + }, + }], + [ 'OS == "win" and clang == 1', { + # cl.exe's /arch flag doesn't have a setting for SSE4.2, and cl.exe + # doesn't need it for intrinsics. clang-cl does need it, though. + 'msvs_settings': { + 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.2' ] }, + }, + }], + [ 'OS == "win"', { + 'defines' : [ 'SK_CPU_SSE_LEVEL=42' ], + }], + ], + }, + { + 'target_name': 'skia_opts_avx', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'sources': [ '<@(avx_sources)' ], + 'conditions': [ + [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + 'cflags': [ '-mavx' ], + }], + [ 'OS == "mac"', { + 'xcode_settings': { + 'OTHER_CFLAGS': [ '-mavx' ], + }, + }], + [ 'OS == "win"', { + 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '3' } }, + }], + ], + }, + { + 'target_name': 'skia_opts_avx2', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'sources': [ '<@(avx2_sources)' ], + 'conditions': [ + [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', { + 'cflags': [ '-mavx2' ], + }], + [ 'OS == "mac"', { + 'xcode_settings': { + 'OTHER_CFLAGS': [ '-mavx2' ], + }, + }], + [ 'OS == "win"', { + 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '5' } }, + }], + ], + }, + { + 'target_name': 'skia_opts_none', + 'type': 'static_library', + # The optimize: 'max' scattered throughout are particularly + # important when compiled by MSVC 2013, which seems + # to mis-link-time-compile code that's built with + # different optimization levels. http://crbug.com/543583 + 'variables': { + 'optimize': 'max', + }, + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'sources': [ '<@(none_sources)' ], + }, + ], + 'conditions': [ + # NEON code must be compiled with -mfpu=neon which also affects scalar + # code. To support dynamic NEON code paths, we need to build all + # NEON-specific sources in a separate static library. The situation + # is very similar to the SSSE3 one. + ['target_arch == "arm" and (arm_neon == 1 or arm_neon_optional == 1)', { + 'targets': [ + { + 'target_name': 'skia_opts_neon', + 'type': 'static_library', + 'includes': [ + 'skia_common.gypi', + ], + 'include_dirs': [ '<@(include_dirs)' ], + 'cflags!': [ + '-fno-omit-frame-pointer', + '-mfpu=vfp', # remove them all, just in case. + '-mfpu=vfpv3', + '-mfpu=vfpv3-d16', + ], + 'cflags': [ + '-mfpu=neon', + '-fomit-frame-pointer', + ], + 'ldflags': [ + '-march=armv7-a', + '-Wl,--fix-cortex-a8', + ], + 'sources': [ '<@(neon_sources)' ], + }, + ], + }], + ], +} diff --git a/skia/skia_pdfium.gypi b/skia/skia_pdfium.gypi new file mode 100644 index 0000000000..0de3f84d72 --- /dev/null +++ b/skia/skia_pdfium.gypi @@ -0,0 +1,29 @@ +# Copyright 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +# This gypi file contains all the Chrome-specific enhancements to Skia. +# In component mode (shared_lib) it is folded into a single shared library with +# the Skia files but in all other cases it is a separate library. +{ + 'dependencies': [ + 'skia_library', + ], + + 'direct_dependent_settings': { + 'include_dirs': [ + 'ext', + ], + }, + 'variables': { + # TODO(scottmg): http://crbug.com/177306 + 'clang_warning_flags_unset': [ + # Don't warn about string->bool used in asserts. + '-Wstring-conversion', + ], + }, + 'sources': [ + 'ext/google_logging.cc', + ], +} |