diff options
-rw-r--r-- | BUILD.gn | 11 | ||||
-rw-r--r-- | gn/echo_headers.py | 1 | ||||
-rw-r--r-- | third_party/BUILD.gn | 83 | ||||
-rw-r--r-- | third_party/libjpeg_turbo/BUILD.gn | 62 | ||||
-rw-r--r-- | third_party/libpng/BUILD.gn | 37 | ||||
-rw-r--r-- | tools/fiddle/fiddle_main.cpp | 58 |
6 files changed, 132 insertions, 120 deletions
@@ -19,7 +19,7 @@ skia_public_includes = [ "include/utils", "include/utils/mac", - "include/c", # TODO: move back to top, order shouldn't matter + "include/c", # TODO: move back to top, order shouldn't matter ] # Skia public API, generally provided by :skia. @@ -148,6 +148,8 @@ component("skia") { ":opts_avx", ":opts_sse41", ":opts_ssse3", + "//third_party/libjpeg_turbo", + "//third_party/libpng", "//third_party/zlib", ] @@ -221,8 +223,6 @@ component("skia") { deps += [ "third_party:fontconfig", "third_party:freetype2", - "third_party:libjpeg-turbo", - "third_party:libpng", ] sources += [ "src/fonts/SkFontMgr_fontconfig.cpp", @@ -262,7 +262,10 @@ action("skia.h") { executable("fiddle") { include_dirs = [ "$target_gen_dir" ] - libs = [ "OSMesa" ] + libs = [] + if (is_linux) { + libs += [ "OSMesa" ] + } sources = [ "tools/fiddle/draw.cpp", diff --git a/gn/echo_headers.py b/gn/echo_headers.py index 325124fc22..6fed8545be 100644 --- a/gn/echo_headers.py +++ b/gn/echo_headers.py @@ -11,6 +11,7 @@ import os.path blacklist = [ 'GrGLConfig_chrome.h', + 'SkFontMgr_fontconfig.h', ] headers = [] diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn index 1aca3ca9cb..49d9f568c4 100644 --- a/third_party/BUILD.gn +++ b/third_party/BUILD.gn @@ -6,89 +6,6 @@ declare_args() { } -import("third_party.gni") - -config("libpng_public") { - include_dirs = [ "libpng" ] -} -third_party("libpng") { - public_configs = [ ":libpng_public" ] - - deps = [ - "//third_party/zlib", - ] - sources = [ - "libpng/png.c", - "libpng/pngerror.c", - "libpng/pngget.c", - "libpng/pngmem.c", - "libpng/pngpread.c", - "libpng/pngread.c", - "libpng/pngrio.c", - "libpng/pngrtran.c", - "libpng/pngrutil.c", - "libpng/pngset.c", - "libpng/pngtrans.c", - "libpng/pngwio.c", - "libpng/pngwrite.c", - "libpng/pngwtran.c", - "libpng/pngwutil.c", - ] -} - -config("libjpeg-turbo_config") { - include_dirs = [ "externals/libjpeg-turbo" ] -} -third_party("libjpeg-turbo") { - public_configs = [ ":libjpeg-turbo_config" ] - - sources = [ - "externals/libjpeg-turbo/jcapimin.c", - "externals/libjpeg-turbo/jcapistd.c", - "externals/libjpeg-turbo/jccoefct.c", - "externals/libjpeg-turbo/jccolor.c", - "externals/libjpeg-turbo/jcdctmgr.c", - "externals/libjpeg-turbo/jchuff.c", - "externals/libjpeg-turbo/jcinit.c", - "externals/libjpeg-turbo/jcmainct.c", - "externals/libjpeg-turbo/jcmarker.c", - "externals/libjpeg-turbo/jcmaster.c", - "externals/libjpeg-turbo/jcomapi.c", - "externals/libjpeg-turbo/jcparam.c", - "externals/libjpeg-turbo/jcphuff.c", - "externals/libjpeg-turbo/jcprepct.c", - "externals/libjpeg-turbo/jcsample.c", - "externals/libjpeg-turbo/jdapimin.c", - "externals/libjpeg-turbo/jdapistd.c", - "externals/libjpeg-turbo/jdcoefct.c", - "externals/libjpeg-turbo/jdcolor.c", - "externals/libjpeg-turbo/jddctmgr.c", - "externals/libjpeg-turbo/jdhuff.c", - "externals/libjpeg-turbo/jdinput.c", - "externals/libjpeg-turbo/jdmainct.c", - "externals/libjpeg-turbo/jdmarker.c", - "externals/libjpeg-turbo/jdmaster.c", - "externals/libjpeg-turbo/jdmerge.c", - "externals/libjpeg-turbo/jdphuff.c", - "externals/libjpeg-turbo/jdpostct.c", - "externals/libjpeg-turbo/jdsample.c", - "externals/libjpeg-turbo/jerror.c", - "externals/libjpeg-turbo/jfdctflt.c", - "externals/libjpeg-turbo/jfdctfst.c", - "externals/libjpeg-turbo/jfdctint.c", - "externals/libjpeg-turbo/jidctflt.c", - "externals/libjpeg-turbo/jidctfst.c", - "externals/libjpeg-turbo/jidctint.c", - "externals/libjpeg-turbo/jidctred.c", - "externals/libjpeg-turbo/jmemmgr.c", - "externals/libjpeg-turbo/jmemnobs.c", - "externals/libjpeg-turbo/jquant1.c", - "externals/libjpeg-turbo/jquant2.c", - "externals/libjpeg-turbo/jsimd_none.c", - "externals/libjpeg-turbo/jutils.c", - ] -} - config("system_freetype2") { include_dirs = [ "/usr/include/freetype2" ] libs = [ "freetype" ] diff --git a/third_party/libjpeg_turbo/BUILD.gn b/third_party/libjpeg_turbo/BUILD.gn new file mode 100644 index 0000000000..f03bca70d5 --- /dev/null +++ b/third_party/libjpeg_turbo/BUILD.gn @@ -0,0 +1,62 @@ +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +declare_args() { +} + +import("../third_party.gni") + +config("libjpeg_turbo_config") { + include_dirs = [ "../externals/libjpeg-turbo" ] +} +third_party("libjpeg_turbo") { + public_configs = [ ":libjpeg_turbo_config" ] + + sources = [ + "../externals/libjpeg-turbo/jcapimin.c", + "../externals/libjpeg-turbo/jcapistd.c", + "../externals/libjpeg-turbo/jccoefct.c", + "../externals/libjpeg-turbo/jccolor.c", + "../externals/libjpeg-turbo/jcdctmgr.c", + "../externals/libjpeg-turbo/jchuff.c", + "../externals/libjpeg-turbo/jcinit.c", + "../externals/libjpeg-turbo/jcmainct.c", + "../externals/libjpeg-turbo/jcmarker.c", + "../externals/libjpeg-turbo/jcmaster.c", + "../externals/libjpeg-turbo/jcomapi.c", + "../externals/libjpeg-turbo/jcparam.c", + "../externals/libjpeg-turbo/jcphuff.c", + "../externals/libjpeg-turbo/jcprepct.c", + "../externals/libjpeg-turbo/jcsample.c", + "../externals/libjpeg-turbo/jdapimin.c", + "../externals/libjpeg-turbo/jdapistd.c", + "../externals/libjpeg-turbo/jdcoefct.c", + "../externals/libjpeg-turbo/jdcolor.c", + "../externals/libjpeg-turbo/jddctmgr.c", + "../externals/libjpeg-turbo/jdhuff.c", + "../externals/libjpeg-turbo/jdinput.c", + "../externals/libjpeg-turbo/jdmainct.c", + "../externals/libjpeg-turbo/jdmarker.c", + "../externals/libjpeg-turbo/jdmaster.c", + "../externals/libjpeg-turbo/jdmerge.c", + "../externals/libjpeg-turbo/jdphuff.c", + "../externals/libjpeg-turbo/jdpostct.c", + "../externals/libjpeg-turbo/jdsample.c", + "../externals/libjpeg-turbo/jerror.c", + "../externals/libjpeg-turbo/jfdctflt.c", + "../externals/libjpeg-turbo/jfdctfst.c", + "../externals/libjpeg-turbo/jfdctint.c", + "../externals/libjpeg-turbo/jidctflt.c", + "../externals/libjpeg-turbo/jidctfst.c", + "../externals/libjpeg-turbo/jidctint.c", + "../externals/libjpeg-turbo/jidctred.c", + "../externals/libjpeg-turbo/jmemmgr.c", + "../externals/libjpeg-turbo/jmemnobs.c", + "../externals/libjpeg-turbo/jquant1.c", + "../externals/libjpeg-turbo/jquant2.c", + "../externals/libjpeg-turbo/jsimd_none.c", + "../externals/libjpeg-turbo/jutils.c", + ] +} diff --git a/third_party/libpng/BUILD.gn b/third_party/libpng/BUILD.gn new file mode 100644 index 0000000000..fd80aad3b9 --- /dev/null +++ b/third_party/libpng/BUILD.gn @@ -0,0 +1,37 @@ +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +declare_args() { +} + +import("../third_party.gni") + +config("libpng_public") { + include_dirs = [ "." ] +} +third_party("libpng") { + public_configs = [ ":libpng_public" ] + + deps = [ + "//third_party/zlib", + ] + sources = [ + "png.c", + "pngerror.c", + "pngget.c", + "pngmem.c", + "pngpread.c", + "pngread.c", + "pngrio.c", + "pngrtran.c", + "pngrutil.c", + "pngset.c", + "pngtrans.c", + "pngwio.c", + "pngwrite.c", + "pngwtran.c", + "pngwutil.c", + ] +} diff --git a/tools/fiddle/fiddle_main.cpp b/tools/fiddle/fiddle_main.cpp index f6270daaa5..1c80c4416c 100644 --- a/tools/fiddle/fiddle_main.cpp +++ b/tools/fiddle/fiddle_main.cpp @@ -8,8 +8,6 @@ #include <stdio.h> #include <stdlib.h> -#include <GL/osmesa.h> - #include "fiddle_main.h" // Globals externed in fiddle_main.h @@ -63,33 +61,31 @@ static SkData* encode_snapshot(const sk_sp<SkSurface>& surface) { return img ? img->encode() : nullptr; } -static OSMesaContext create_osmesa_context() { - OSMesaContext osMesaContext = - OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, nullptr); - if (osMesaContext != nullptr) { - static uint32_t buffer[16 * 16]; - OSMesaMakeCurrent(osMesaContext, &buffer, GL_UNSIGNED_BYTE, 16, 16); - } - return osMesaContext; -} +#if defined(__linux) + #include <GL/osmesa.h> + static sk_sp<GrContext> create_grcontext() { + // We just leak the OSMesaContext... the process will die soon anyway. + if (OSMesaContext osMesaContext = OSMesaCreateContextExt(OSMESA_BGRA, 0, 0, 0, nullptr)) { + static uint32_t buffer[16 * 16]; + OSMesaMakeCurrent(osMesaContext, &buffer, GL_UNSIGNED_BYTE, 16, 16); + } -static sk_sp<GrContext> create_mesa_grcontext() { - if (nullptr == OSMesaGetCurrentContext()) { - return nullptr; - } - auto osmesa_get = [](void* ctx, const char name[]) { - SkASSERT(nullptr == ctx); - SkASSERT(OSMesaGetCurrentContext()); - return OSMesaGetProcAddress(name); - }; - sk_sp<const GrGLInterface> mesa(GrGLAssembleInterface(nullptr, osmesa_get)); - if (!mesa) { - return nullptr; + auto osmesa_get = [](void* ctx, const char name[]) { + SkASSERT(nullptr == ctx); + SkASSERT(OSMesaGetCurrentContext()); + return OSMesaGetProcAddress(name); + }; + sk_sp<const GrGLInterface> mesa(GrGLAssembleInterface(nullptr, osmesa_get)); + if (!mesa) { + return nullptr; + } + return sk_sp<GrContext>(GrContext::Create( + kOpenGL_GrBackend, + reinterpret_cast<intptr_t>(mesa.get()))); } - return sk_sp<GrContext>(GrContext::Create( - kOpenGL_GrBackend, - reinterpret_cast<intptr_t>(mesa.get()))); -} +#else + static sk_sp<GrContext> create_grcontext() { return nullptr; } +#endif int main() { const DrawOptions options = GetDrawOptions(); @@ -117,10 +113,9 @@ int main() { rasterData.reset(encode_snapshot(rasterSurface)); } if (options.gpu) { - OSMesaContext osMesaContext = create_osmesa_context(); - auto grContext = create_mesa_grcontext(); + auto grContext = create_grcontext(); if (!grContext) { - fputs("Unable to get Mesa GrContext.\n", stderr); + fputs("Unable to get GrContext.\n", stderr); } else { auto surface = SkSurface::MakeRenderTarget( grContext.get(), @@ -134,9 +129,6 @@ int main() { draw(surface->getCanvas()); gpuData.reset(encode_snapshot(surface)); } - if (osMesaContext) { - OSMesaDestroyContext(osMesaContext); - } } if (options.pdf) { SkDynamicMemoryWStream pdfStream; |