Update Skia and get using its BUILD.gn instead of maintaining own own copy. (flutter/engine#3233)
This commit is contained in:
16
DEPS
16
DEPS
@@ -20,10 +20,11 @@
|
||||
vars = {
|
||||
'chromium_git': 'https://chromium.googlesource.com',
|
||||
'fuchsia_git': 'https://fuchsia.googlesource.com',
|
||||
'skia_git': 'https://skia.googlesource.com',
|
||||
'github_git': 'https://github.com',
|
||||
'mojo_sdk_revision': '6b5fb1227c742f5ecc077486ebc029f2711c61fa',
|
||||
'base_revision': 'b2412302ed4e45bfb47d7b5c0c3418077009e1ce',
|
||||
'skia_revision': 'bbe17a66705aff6f34a22adc0c12883dcb6161b3',
|
||||
'skia_revision': '06a65e2799eaead18f778792801406aff4aec0d9',
|
||||
|
||||
# Note: When updating the Dart revision, ensure that all entries that are
|
||||
# dependencies of dart are also updated
|
||||
@@ -42,10 +43,11 @@ allowed_hosts = [
|
||||
'chromium.googlesource.com',
|
||||
'fuchsia.googlesource.com',
|
||||
'github.com',
|
||||
'skia.googlesource.com',
|
||||
]
|
||||
|
||||
deps = {
|
||||
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'a69330303690bbc10953ed1a662f37f1f3c7b2b9',
|
||||
'src': 'https://github.com/flutter/buildroot.git' + '@' + '8e0347319b586cc29650e5bd878ddf73a3a6823d',
|
||||
|
||||
# Fuchsia compatibility
|
||||
#
|
||||
@@ -112,13 +114,13 @@ deps = {
|
||||
Var('dart_root_certificates_revision'),
|
||||
|
||||
'src/third_party/skia':
|
||||
Var('chromium_git') + '/skia.git' + '@' + Var('skia_revision'),
|
||||
Var('skia_git') + '/skia.git' + '@' + Var('skia_revision'),
|
||||
|
||||
'src/third_party/yasm/source/patched-yasm':
|
||||
Var('chromium_git') + '/chromium/deps/yasm/patched-yasm.git' + '@' + '4671120cd8558ce62ee8672ebf3eb6f5216f909b',
|
||||
|
||||
'src/third_party/libjpeg_turbo':
|
||||
Var('chromium_git') + '/chromium/deps/libjpeg_turbo.git' + '@' + '7260e4d8b8e1e40b17f03fafdf1cd83296900f76',
|
||||
'src/third_party/libjpeg-turbo':
|
||||
Var('skia_git') + '/third_party/libjpeg-turbo.git' + '@' + 'debddedc75850bcdeb8a57258572f48b802a4bb3',
|
||||
|
||||
# Headers for Vulkan 1.0
|
||||
'src/third_party/vulkan':
|
||||
@@ -146,8 +148,8 @@ deps_os = {
|
||||
'src/third_party/robolectric/lib':
|
||||
Var('chromium_git') + '/chromium/third_party/robolectric.git' + '@' + '6b63c99a8b6967acdb42cbed0adb067c80efc810',
|
||||
|
||||
'src/third_party/freetype-android/src':
|
||||
Var('chromium_git') + '/chromium/src/third_party/freetype2.git' + '@' + 'e186230678ee8e4ea4ac4797ece8125761e3225a',
|
||||
'src/third_party/freetype2':
|
||||
Var('fuchsia_git') + '/third_party/freetype2' + '@' + '6cfcc4303b6fc7850f764e41f72a89d67e301f44',
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,10 @@ source_set("flow") {
|
||||
deps = [
|
||||
"//flutter/common",
|
||||
"//flutter/glue",
|
||||
"//flutter/skia",
|
||||
"//flutter/synchronization",
|
||||
"//lib/ftl",
|
||||
"//third_party/skia",
|
||||
"//third_party/skia:gpu",
|
||||
]
|
||||
|
||||
if (is_fuchsia) {
|
||||
|
||||
@@ -76,9 +76,10 @@ source_set("ui") {
|
||||
"//flutter/common",
|
||||
"//flutter/flow",
|
||||
"//flutter/glue",
|
||||
"//flutter/skia",
|
||||
"//flutter/sky/engine",
|
||||
"//lib/tonic",
|
||||
"//third_party/skia",
|
||||
"//third_party/skia:gpu",
|
||||
]
|
||||
|
||||
if (is_android) {
|
||||
|
||||
@@ -350,13 +350,11 @@ void Canvas::drawVertices(const Paint& paint,
|
||||
const tonic::Float32List& vertices,
|
||||
const tonic::Float32List& texture_coordinates,
|
||||
const tonic::Int32List& colors,
|
||||
SkXfermode::Mode transfer_mode,
|
||||
SkBlendMode blend_mode,
|
||||
const tonic::Int32List& indices) {
|
||||
if (!canvas_)
|
||||
return;
|
||||
|
||||
sk_sp<SkXfermode> transfer_mode_ptr = SkXfermode::Make(transfer_mode);
|
||||
|
||||
std::vector<uint16_t> indices16;
|
||||
indices16.reserve(indices.num_elements());
|
||||
for (int i = 0; i < indices.num_elements(); ++i)
|
||||
@@ -372,7 +370,7 @@ void Canvas::drawVertices(const Paint& paint,
|
||||
vertices.num_elements() / 2, // SkPoints have two floats.
|
||||
reinterpret_cast<const SkPoint*>(vertices.data()),
|
||||
reinterpret_cast<const SkPoint*>(texture_coordinates.data()),
|
||||
reinterpret_cast<const SkColor*>(colors.data()), transfer_mode_ptr.get(),
|
||||
reinterpret_cast<const SkColor*>(colors.data()), blend_mode,
|
||||
indices16.empty() ? nullptr : indices16.data(), indices16.size(),
|
||||
*paint.paint());
|
||||
}
|
||||
@@ -383,7 +381,7 @@ void Canvas::drawAtlas(const Paint& paint,
|
||||
const tonic::Float32List& transforms,
|
||||
const tonic::Float32List& rects,
|
||||
const tonic::Int32List& colors,
|
||||
SkXfermode::Mode transfer_mode,
|
||||
SkBlendMode blend_mode,
|
||||
const tonic::Float32List& cull_rect) {
|
||||
if (!canvas_)
|
||||
return;
|
||||
@@ -400,7 +398,7 @@ void Canvas::drawAtlas(const Paint& paint,
|
||||
reinterpret_cast<const SkRect*>(rects.data()),
|
||||
reinterpret_cast<const SkColor*>(colors.data()),
|
||||
rects.num_elements() / 4, // SkRect have four floats.
|
||||
transfer_mode, reinterpret_cast<const SkRect*>(cull_rect.data()),
|
||||
blend_mode, reinterpret_cast<const SkRect*>(cull_rect.data()),
|
||||
paint.paint());
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ class Canvas : public ftl::RefCountedThreadSafe<Canvas>,
|
||||
const tonic::Float32List& vertices,
|
||||
const tonic::Float32List& texture_coordinates,
|
||||
const tonic::Int32List& colors,
|
||||
SkXfermode::Mode transfer_mode,
|
||||
SkBlendMode blend_mode,
|
||||
const tonic::Int32List& indices);
|
||||
|
||||
void drawAtlas(const Paint& paint,
|
||||
@@ -157,7 +157,7 @@ class Canvas : public ftl::RefCountedThreadSafe<Canvas>,
|
||||
const tonic::Float32List& transforms,
|
||||
const tonic::Float32List& rects,
|
||||
const tonic::Int32List& colors,
|
||||
SkXfermode::Mode transfer_mode,
|
||||
SkBlendMode blend_mode,
|
||||
const tonic::Float32List& cull_rect);
|
||||
|
||||
SkCanvas* canvas() const { return canvas_; }
|
||||
|
||||
@@ -107,8 +107,8 @@ Paint DartConverter<Paint>::FromArguments(Dart_NativeArguments args,
|
||||
|
||||
if (uint_data[kColorFilterIndex]) {
|
||||
SkColor color = uint_data[kColorFilterColorIndex];
|
||||
SkXfermode::Mode transfer_mode =
|
||||
static_cast<SkXfermode::Mode>(uint_data[kColorFilterTransferModeIndex]);
|
||||
SkBlendMode transfer_mode =
|
||||
static_cast<SkBlendMode>(uint_data[kColorFilterTransferModeIndex]);
|
||||
paint.setColorFilter(SkColorFilter::MakeModeFilter(color, transfer_mode));
|
||||
}
|
||||
|
||||
|
||||
@@ -63,20 +63,20 @@ source_set("runtime") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
":embedded_resources_cc",
|
||||
"//dart/runtime:libdart",
|
||||
"//dart/runtime/bin:embedded_dart_io",
|
||||
"//dart/runtime:libdart",
|
||||
"//flutter/assets",
|
||||
"//flutter/common",
|
||||
"//flutter/flow",
|
||||
"//flutter/glue",
|
||||
"//flutter/lib/io",
|
||||
"//flutter/lib/ui",
|
||||
"//flutter/skia",
|
||||
"//flutter/sky/engine/platform",
|
||||
"//lib/ftl",
|
||||
"//lib/tonic",
|
||||
"//third_party/rapidjson",
|
||||
"//third_party/skia",
|
||||
":embedded_resources_cc",
|
||||
]
|
||||
|
||||
if (flutter_runtime_mode != "release") {
|
||||
|
||||
@@ -225,7 +225,7 @@ sk_sp<SkTypeface> AssetFontSelector::getTypefaceAsset(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SkAutoTUnref<SkFontMgr> font_mgr(SkFontMgr::RefDefault());
|
||||
sk_sp<SkFontMgr> font_mgr(SkFontMgr::RefDefault());
|
||||
SkMemoryStream* typeface_stream = new SkMemoryStream(
|
||||
typeface_asset->data.data(), typeface_asset->data.size());
|
||||
typeface_asset->typeface =
|
||||
|
||||
@@ -85,6 +85,8 @@ source_set("common") {
|
||||
"rasterizer.h",
|
||||
"shell.cc",
|
||||
"shell.h",
|
||||
"skia_event_tracer_impl.cc",
|
||||
"skia_event_tracer_impl.h",
|
||||
"surface.cc",
|
||||
"surface.h",
|
||||
"switches.cc",
|
||||
@@ -108,13 +110,14 @@ source_set("common") {
|
||||
"//flutter/glue",
|
||||
"//flutter/lib/ui",
|
||||
"//flutter/runtime",
|
||||
"//flutter/skia",
|
||||
"//flutter/sky/engine/wtf",
|
||||
"//flutter/synchronization",
|
||||
"//lib/ftl",
|
||||
"//lib/tonic",
|
||||
"//third_party/libjpeg",
|
||||
"//third_party/rapidjson",
|
||||
"//third_party/skia",
|
||||
"//third_party/skia:gpu",
|
||||
":generate_embedder_diagnostic_server_resources_cc",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
#include "flutter/common/threads.h"
|
||||
#include "flutter/glue/task_runner_adaptor.h"
|
||||
#include "flutter/runtime/dart_init.h"
|
||||
#include "flutter/shell/common/diagnostic/diagnostic_server.h"
|
||||
#include "flutter/shell/common/engine.h"
|
||||
#include "flutter/shell/common/platform_view_service_protocol.h"
|
||||
#include "flutter/shell/common/skia_event_tracer_impl.h"
|
||||
#include "flutter/shell/common/switches.h"
|
||||
#include "flutter/shell/common/diagnostic/diagnostic_server.h"
|
||||
#include "flutter/skia/ext/event_tracer_impl.h"
|
||||
#include "lib/ftl/files/unique_fd.h"
|
||||
|
||||
namespace shell {
|
||||
|
||||
74
engine/src/flutter/shell/common/skia_event_tracer_impl.cc
Normal file
74
engine/src/flutter/shell/common/skia_event_tracer_impl.cc
Normal file
@@ -0,0 +1,74 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
#include "flutter/shell/common/skia_event_tracer_impl.h"
|
||||
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "third_party/skia/include/utils/SkEventTracer.h"
|
||||
|
||||
namespace skia {
|
||||
|
||||
class SkChromiumEventTracer: public SkEventTracer {
|
||||
const uint8_t* getCategoryGroupEnabled(const char* name) override;
|
||||
const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) override;
|
||||
SkEventTracer::Handle addTraceEvent(char phase,
|
||||
const uint8_t* categoryEnabledFlag,
|
||||
const char* name,
|
||||
uint64_t id,
|
||||
int32_t numArgs,
|
||||
const char** argNames,
|
||||
const uint8_t* argTypes,
|
||||
const uint64_t* argValues,
|
||||
uint8_t flags) override;
|
||||
void updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
|
||||
const char* name,
|
||||
SkEventTracer::Handle handle) override;
|
||||
};
|
||||
|
||||
const uint8_t*
|
||||
SkChromiumEventTracer::getCategoryGroupEnabled(const char* name) {
|
||||
return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(name);
|
||||
}
|
||||
|
||||
const char* SkChromiumEventTracer::getCategoryGroupName(
|
||||
const uint8_t* categoryEnabledFlag) {
|
||||
return base::trace_event::TraceLog::GetCategoryGroupName(categoryEnabledFlag);
|
||||
}
|
||||
|
||||
SkEventTracer::Handle
|
||||
SkChromiumEventTracer::addTraceEvent(char phase,
|
||||
const uint8_t* categoryEnabledFlag,
|
||||
const char* name,
|
||||
uint64_t id,
|
||||
int32_t numArgs,
|
||||
const char** argNames,
|
||||
const uint8_t* argTypes,
|
||||
const uint64_t* argValues,
|
||||
uint8_t flags) {
|
||||
base::trace_event::TraceEventHandle handle = TRACE_EVENT_API_ADD_TRACE_EVENT(
|
||||
phase, categoryEnabledFlag, name, id, numArgs, argNames, argTypes,
|
||||
(const long long unsigned int*)argValues, NULL, flags);
|
||||
SkEventTracer::Handle result;
|
||||
memcpy(&result, &handle, sizeof(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
SkChromiumEventTracer::updateTraceEventDuration(
|
||||
const uint8_t* categoryEnabledFlag,
|
||||
const char *name,
|
||||
SkEventTracer::Handle handle) {
|
||||
base::trace_event::TraceEventHandle traceEventHandle;
|
||||
memcpy(&traceEventHandle, &handle, sizeof(handle));
|
||||
TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(
|
||||
categoryEnabledFlag, name, traceEventHandle);
|
||||
}
|
||||
|
||||
} // namespace skia
|
||||
|
||||
void InitSkiaEventTracer() {
|
||||
// Initialize the binding to Skia's tracing events. Skia will
|
||||
// take ownership of and clean up the memory allocated here.
|
||||
SkEventTracer::SetInstance(new skia::SkChromiumEventTracer());
|
||||
}
|
||||
10
engine/src/flutter/shell/common/skia_event_tracer_impl.h
Normal file
10
engine/src/flutter/shell/common/skia_event_tracer_impl.h
Normal file
@@ -0,0 +1,10 @@
|
||||
// Copyright 2016 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.
|
||||
|
||||
#ifndef FLUTTER_SHELL_COMMON_SKIA_EVENT_TRACER_IMPL_H_
|
||||
#define FLUTTER_SHELL_COMMON_SKIA_EVENT_TRACER_IMPL_H_
|
||||
|
||||
void InitSkiaEventTracer();
|
||||
|
||||
#endif // FLUTTER_SHELL_COMMON_SKIA_EVENT_TRACER_IMPL_H_
|
||||
@@ -17,8 +17,9 @@ source_set("gpu") {
|
||||
"//flutter/flow",
|
||||
"//flutter/glue",
|
||||
"//flutter/shell/common",
|
||||
"//flutter/skia",
|
||||
"//flutter/synchronization",
|
||||
"//lib/ftl",
|
||||
"//third_party/skia",
|
||||
"//third_party/skia:gpu",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -47,9 +47,9 @@ shared_library("sky_shell") {
|
||||
"//flutter/runtime",
|
||||
"//flutter/shell/common",
|
||||
"//flutter/shell/gpu",
|
||||
"//flutter/skia",
|
||||
"//flutter/vulkan",
|
||||
"//lib/ftl",
|
||||
"//third_party/skia",
|
||||
":jni_headers",
|
||||
]
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ source_set("common") {
|
||||
"//flutter/shell/common",
|
||||
"//flutter/shell/gpu",
|
||||
"//flutter/shell/testing",
|
||||
"//flutter/skia",
|
||||
"//flutter/sky/engine/wtf",
|
||||
"//lib/ftl",
|
||||
"//third_party/skia",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -30,9 +30,9 @@ source_set("mac_desktop_platform") {
|
||||
"//flutter/shell/gpu",
|
||||
"//flutter/shell/platform/darwin/common",
|
||||
"//flutter/shell/testing",
|
||||
"//flutter/skia",
|
||||
"//flutter/synchronization",
|
||||
"//lib/ftl",
|
||||
"//third_party/skia",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -58,10 +58,10 @@ shared_library("flutter_framework_dylib") {
|
||||
"//flutter/shell/common",
|
||||
"//flutter/shell/gpu",
|
||||
"//flutter/shell/platform/darwin/common",
|
||||
"//flutter/skia",
|
||||
"//flutter/sky/engine/platform",
|
||||
"//flutter/sky/engine/wtf",
|
||||
"//lib/ftl",
|
||||
"//third_party/skia",
|
||||
]
|
||||
|
||||
defines = [
|
||||
|
||||
@@ -19,9 +19,9 @@ executable("linux") {
|
||||
"//flutter/shell/common",
|
||||
"//flutter/shell/gpu",
|
||||
"//flutter/shell/testing",
|
||||
"//flutter/skia",
|
||||
"//lib/ftl",
|
||||
"//third_party/glfw",
|
||||
"//third_party/skia",
|
||||
]
|
||||
|
||||
ldflags = [
|
||||
|
||||
@@ -16,7 +16,7 @@ source_set("testing") {
|
||||
"//base",
|
||||
"//flutter/common",
|
||||
"//flutter/shell/common",
|
||||
"//flutter/skia",
|
||||
"//lib/ftl",
|
||||
"//third_party/skia",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,548 +0,0 @@
|
||||
# Copyright (c) 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.
|
||||
|
||||
if (is_fuchsia) {
|
||||
|
||||
group("skia") {
|
||||
# TODO(abarth): Switch the non-Fuchsia build over to using Skia's BUILD.gn
|
||||
# files as well.
|
||||
public_deps = [
|
||||
"//third_party/skia",
|
||||
"//third_party/skia:gpu",
|
||||
]
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
import("//build/config/features.gni")
|
||||
import("//testing/test.gni")
|
||||
|
||||
if (current_cpu == "arm" || current_cpu == "arm64") {
|
||||
import("//build/config/arm.gni")
|
||||
}
|
||||
if (current_cpu == "mipsel" || current_cpu == "mips64el") {
|
||||
import("//build/config/mips.gni")
|
||||
}
|
||||
|
||||
# The list of Skia core sources that are to be set for chromium.
|
||||
gypi_skia_core =
|
||||
exec_script("//build/gypi_to_gn.py",
|
||||
[
|
||||
rebase_path("//third_party/skia/gyp/core.gypi"),
|
||||
"--replace=<(skia_include_path)=//third_party/skia/include",
|
||||
"--replace=<(skia_src_path)=//third_party/skia/src",
|
||||
],
|
||||
"scope",
|
||||
[ "//third_party/skia/gyp/core.gypi" ])
|
||||
|
||||
# The list of Skia gpu sources that are to be set for chromium.
|
||||
gypi_skia_gpu =
|
||||
exec_script("//build/gypi_to_gn.py",
|
||||
[
|
||||
rebase_path("//third_party/skia/gyp/gpu.gypi"),
|
||||
"--replace=<(skia_include_path)=//third_party/skia/include",
|
||||
"--replace=<(skia_src_path)=//third_party/skia/src",
|
||||
],
|
||||
"scope",
|
||||
[ "//third_party/skia/gyp/gpu.gypi" ])
|
||||
|
||||
# The list of Skia effects that are to be set for chromium.
|
||||
gypi_skia_effects =
|
||||
exec_script("//build/gypi_to_gn.py",
|
||||
[
|
||||
rebase_path("//third_party/skia/gyp/effects.gypi"),
|
||||
"--replace=<(skia_include_path)=//third_party/skia/include",
|
||||
"--replace=<(skia_src_path)=//third_party/skia/src",
|
||||
],
|
||||
"scope",
|
||||
[ "//third_party/skia/gyp/effects.gypi" ])
|
||||
|
||||
gypi_skia_sources =
|
||||
exec_script("//build/gypi_to_gn.py",
|
||||
[
|
||||
rebase_path("//third_party/skia/gyp/skia_sources.gypi"),
|
||||
"--replace=..=//third_party/skia",
|
||||
],
|
||||
"scope",
|
||||
[ "//third_party/skia/gyp/skia_sources.gypi" ])
|
||||
|
||||
gypi_skia_opts =
|
||||
exec_script("//build/gypi_to_gn.py",
|
||||
[
|
||||
rebase_path("//third_party/skia/gyp/opts.gypi"),
|
||||
"--replace=<(skia_include_path)=//third_party/skia/include",
|
||||
"--replace=<(skia_src_path)=//third_party/skia/src",
|
||||
],
|
||||
"scope",
|
||||
[ "//third_party/skia/gyp/opts.gypi" ])
|
||||
|
||||
# External-facing config for dependent code.
|
||||
config("skia_config") {
|
||||
include_dirs = [
|
||||
"//third_party/skia/include/c",
|
||||
"//third_party/skia/include/client/android",
|
||||
"//third_party/skia/include/core",
|
||||
"//third_party/skia/include/effects",
|
||||
"//third_party/skia/include/gpu",
|
||||
"//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/utils",
|
||||
"config",
|
||||
"ext",
|
||||
]
|
||||
}
|
||||
|
||||
# Internal-facing config for Skia library code.
|
||||
config("skia_library_config") {
|
||||
include_dirs = [
|
||||
"config",
|
||||
"//third_party/skia/include/private",
|
||||
"//third_party/skia/include/codec",
|
||||
"//third_party/skia/src/codec",
|
||||
"//third_party/skia/src/core",
|
||||
"//third_party/skia/src/image",
|
||||
"//third_party/skia/src/lazy",
|
||||
"//third_party/skia/src/opts",
|
||||
"//third_party/skia/src/pdf",
|
||||
"//third_party/skia/src/ports",
|
||||
"//third_party/skia/src/sfnt",
|
||||
"//third_party/skia/src/utils",
|
||||
"//third_party/skia/src/gpu",
|
||||
]
|
||||
|
||||
include_dirs += gypi_skia_sources.sksl_include_dirs
|
||||
|
||||
if (is_mac || is_ios) {
|
||||
include_dirs += [ "//third_party/skia/include/utils/mac" ]
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
include_dirs += [ "//third_party/skia/include/utils/ios" ]
|
||||
}
|
||||
|
||||
defines = [ "SK_SUPPORT_GPU=1" ]
|
||||
|
||||
# Supported codecs.
|
||||
defines += [
|
||||
"SK_HAS_JPEG_LIBRARY",
|
||||
"SK_HAS_PNG_LIBRARY",
|
||||
]
|
||||
|
||||
if (is_mac) {
|
||||
defines += [ "SK_BUILD_FOR_MAC" ]
|
||||
}
|
||||
|
||||
if (is_ios) {
|
||||
defines += [ "SK_BUILD_FOR_IOS" ]
|
||||
}
|
||||
|
||||
if (is_android) {
|
||||
defines += [ "SK_BUILD_FOR_ANDROID" ]
|
||||
}
|
||||
|
||||
if (component_mode == "shared_library") {
|
||||
defines += [
|
||||
"SKIA_IMPLEMENTATION=1",
|
||||
"SKIA_DLL",
|
||||
"GR_GL_IGNORE_ES3_MSAA=0",
|
||||
]
|
||||
}
|
||||
|
||||
if (current_cpu == "arm") {
|
||||
if (arm_use_neon) {
|
||||
defines += [ "SK_ARM_HAS_NEON" ]
|
||||
}
|
||||
if (arm_optionally_use_neon) {
|
||||
defines += [ "SK_ARM_HAS_OPTIONAL_NEON" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (current_cpu == "arm64") {
|
||||
# All 64-bit ARM variants have NEON.
|
||||
defines += [ "SK_ARM_HAS_NEON" ]
|
||||
}
|
||||
|
||||
# Settings for text blitting, chosen to approximate the system browser.
|
||||
if (is_linux) {
|
||||
defines += [
|
||||
"SK_GAMMA_EXPONENT=1.2",
|
||||
"SK_GAMMA_CONTRAST=0.2",
|
||||
"SK_HIGH_QUALITY_IS_LANCZOS",
|
||||
]
|
||||
} else if (is_android) {
|
||||
defines += [
|
||||
"SK_GAMMA_APPLY_TO_A8",
|
||||
"SK_GAMMA_EXPONENT=1.4",
|
||||
"SK_GAMMA_CONTRAST=0.0",
|
||||
]
|
||||
} else if (is_win) {
|
||||
defines += [
|
||||
"SK_GAMMA_SRGB",
|
||||
"SK_GAMMA_CONTRAST=0.5",
|
||||
"SK_HIGH_QUALITY_IS_LANCZOS",
|
||||
]
|
||||
} else if (is_mac) {
|
||||
defines += [
|
||||
"SK_GAMMA_SRGB",
|
||||
"SK_GAMMA_CONTRAST=0.0",
|
||||
"SK_HIGH_QUALITY_IS_LANCZOS",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_android) {
|
||||
defines += [
|
||||
# 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).
|
||||
"SK_DEFAULT_FONT_CACHE_LIMIT=1048576", # 1024 * 1024
|
||||
]
|
||||
} else {
|
||||
defines += [ "SK_DEFAULT_FONT_CACHE_LIMIT=20971520" ] # 20 * 1024 * 1024
|
||||
}
|
||||
|
||||
if (is_ios) {
|
||||
cflags = [
|
||||
# Skia uses routines deprecated in iOS 7 and above
|
||||
"-Wno-deprecated-declarations",
|
||||
# Clang incorrectly defines this even though the crc32 instruction is
|
||||
# unavailable https://github.com/lionheart/openradar-mirror/issues/7653
|
||||
"-U__ARM_FEATURE_CRC32",
|
||||
]
|
||||
|
||||
libs = [ "ImageIO.framework" ]
|
||||
}
|
||||
}
|
||||
|
||||
component("skia") {
|
||||
sources = [
|
||||
# Chrome sources.
|
||||
"config/SkUserConfig.h",
|
||||
"ext/SkMemory_new_handler.cpp",
|
||||
"ext/event_tracer_impl.cc",
|
||||
"ext/event_tracer_impl.h",
|
||||
"ext/google_logging.cc",
|
||||
]
|
||||
|
||||
# The skia gypi values are relative to the skia_dir, so we need to rebase.
|
||||
sources += gypi_skia_core.sources
|
||||
sources += gypi_skia_effects.sources
|
||||
sources += gypi_skia_sources.utils_sources
|
||||
sources += gypi_skia_sources.sksl_sources
|
||||
|
||||
sources += [
|
||||
"//third_party/skia/src/codec/SkAndroidCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkBmpCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkBmpMaskCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkBmpRLECodec.cpp",
|
||||
"//third_party/skia/src/codec/SkBmpStandardCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkCodecImageGenerator.cpp",
|
||||
"//third_party/skia/src/codec/SkIcoCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkJpegCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkJpegDecoderMgr.cpp",
|
||||
"//third_party/skia/src/codec/SkJpegUtility.cpp",
|
||||
"//third_party/skia/src/codec/SkMaskSwizzler.cpp",
|
||||
"//third_party/skia/src/codec/SkMasks.cpp",
|
||||
"//third_party/skia/src/codec/SkPngCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkSampledCodec.cpp",
|
||||
"//third_party/skia/src/codec/SkSampler.cpp",
|
||||
"//third_party/skia/src/codec/SkSwizzler.cpp",
|
||||
"//third_party/skia/src/codec/SkWbmpCodec.cpp",
|
||||
"//third_party/skia/src/images/SkImageEncoder.cpp",
|
||||
"//third_party/skia/src/images/SkImageEncoder_Factory.cpp",
|
||||
"//third_party/skia/src/images/SkPNGImageEncoder.cpp",
|
||||
|
||||
"//third_party/skia/include/images/SkMovie.h",
|
||||
"//third_party/skia/include/ports/SkTypeface_win.h",
|
||||
"//third_party/skia/src/fonts/SkFontMgr_indirect.cpp",
|
||||
"//third_party/skia/src/fonts/SkRemotableFontMgr.cpp",
|
||||
"//third_party/skia/src/ports/SkDiscardableMemory_none.cpp",
|
||||
"//third_party/skia/src/ports/SkFontConfigInterface.cpp",
|
||||
"//third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp",
|
||||
"//third_party/skia/src/ports/SkFontConfigInterface_direct.cpp",
|
||||
"//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp",
|
||||
"//third_party/skia/src/ports/SkFontHost_FreeType_common.h",
|
||||
"//third_party/skia/src/ports/SkFontHost_FreeType.cpp",
|
||||
"//third_party/skia/src/ports/SkFontHost_mac.cpp",
|
||||
"//third_party/skia/src/ports/SkFontHost_win.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_android.cpp",
|
||||
"//third_party/skia/src/ports/SkFontMgr_FontConfigInterface.cpp",
|
||||
"//third_party/skia/src/ports/SkFontMgr_FontConfigInterface_factory.cpp",
|
||||
"//third_party/skia/src/ports/SkFontMgr_win_dw.cpp",
|
||||
"//third_party/skia/src/ports/SkGlobalInitialization_default.cpp",
|
||||
"//third_party/skia/src/ports/SkImageGenerator_skia.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/SkRemotableFontMgr_win_dw.cpp",
|
||||
"//third_party/skia/src/ports/SkScalerContext_win_dw.cpp",
|
||||
"//third_party/skia/src/ports/SkScalerContext_win_dw.h",
|
||||
"//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/ports/SkTypeface_win_dw.h",
|
||||
"//third_party/skia/src/sfnt/SkOTTable_name.cpp",
|
||||
"//third_party/skia/src/sfnt/SkOTTable_name.h",
|
||||
"//third_party/skia/src/sfnt/SkOTUtils.cpp",
|
||||
"//third_party/skia/src/sfnt/SkOTUtils.h",
|
||||
|
||||
#mac
|
||||
"//third_party/skia/src/utils/mac/SkStream_mac.cpp",
|
||||
|
||||
#testing
|
||||
"//third_party/skia/src/fonts/SkGScalerContext.cpp",
|
||||
"//third_party/skia/src/fonts/SkGScalerContext.h",
|
||||
]
|
||||
|
||||
# This and skia_opts are really the same conceptual target so share headers.
|
||||
allow_circular_includes_from = [ ":skia_opts" ]
|
||||
|
||||
if (current_cpu == "arm") {
|
||||
sources += [
|
||||
"//third_party/skia/src/core/SkUtilsArm.cpp",
|
||||
"//third_party/skia/src/core/SkUtilsArm.h",
|
||||
]
|
||||
}
|
||||
|
||||
# GPU
|
||||
|
||||
sources += gypi_skia_gpu.skgpu_sources
|
||||
sources += gypi_skia_gpu.skgpu_null_gl_sources
|
||||
|
||||
# Remove unused util files include in utils.gypi
|
||||
sources -= [
|
||||
"//third_party/skia/src/utils/SkBoundaryPatch.cpp",
|
||||
"//third_party/skia/src/utils/SkCamera.cpp",
|
||||
"//third_party/skia/src/utils/SkCanvasStack.h",
|
||||
"//third_party/skia/src/utils/SkDumpCanvas.cpp",
|
||||
"//third_party/skia/src/utils/SkFloatUtils.h",
|
||||
"//third_party/skia/src/utils/SkFrontBufferedStream.cpp",
|
||||
"//third_party/skia/src/utils/SkInterpolator.cpp",
|
||||
"//third_party/skia/src/utils/SkLayer.cpp",
|
||||
"//third_party/skia/src/utils/SkMeshUtils.cpp",
|
||||
"//third_party/skia/src/utils/SkOSFile.cpp",
|
||||
"//third_party/skia/src/utils/SkParsePath.cpp",
|
||||
|
||||
#testing
|
||||
"//third_party/skia/src/fonts/SkGScalerContext.cpp",
|
||||
"//third_party/skia/src/fonts/SkGScalerContext.h",
|
||||
]
|
||||
|
||||
if (is_ios || is_mac || is_android) {
|
||||
sources -= [
|
||||
"//third_party/skia/src/gpu/gl/GrGLCreateNativeInterface_none.cpp"
|
||||
]
|
||||
|
||||
set_sources_assignment_filter([])
|
||||
|
||||
if (is_ios) {
|
||||
sources += [
|
||||
"//third_party/skia/src/gpu/gl/iOS/GrGLCreateNativeInterface_iOS.cpp"
|
||||
]
|
||||
} else if (is_mac) {
|
||||
sources += [
|
||||
"//third_party/skia/src/gpu/gl/mac/GrGLCreateNativeInterface_mac.cpp"
|
||||
]
|
||||
} else if (is_android) {
|
||||
sources += [
|
||||
"//third_party/skia/src/gpu/gl/android/GrGLCreateNativeInterface_android.cpp"
|
||||
]
|
||||
}
|
||||
|
||||
set_sources_assignment_filter(sources_assignment_filter)
|
||||
}
|
||||
|
||||
if (is_win) {
|
||||
sources -= [
|
||||
# Keeping _win.cpp
|
||||
"//third_party/skia/src/utils/SkThreadUtils_pthread.cpp",
|
||||
"//third_party/skia/src/utils/SkThreadUtils_pthread_other.cpp",
|
||||
]
|
||||
} else {
|
||||
sources -= [
|
||||
# Keeping _pthread.cpp and _pthread_other.cpp.
|
||||
"//third_party/skia/src/utils/SkThreadUtils_win.cpp",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_ios) {
|
||||
set_sources_assignment_filter([])
|
||||
|
||||
sources += [
|
||||
"//third_party/skia/src/utils/mac/SkCreateCGImageRef.cpp",
|
||||
"//third_party/skia/src/utils/mac/SkStream_mac.cpp",
|
||||
]
|
||||
|
||||
set_sources_assignment_filter(sources_assignment_filter)
|
||||
}
|
||||
|
||||
# Fixup skia library sources.
|
||||
if (is_win) {
|
||||
sources -= [
|
||||
"//third_party/skia/src/ports/SkOSFile_posix.cpp",
|
||||
"//third_party/skia/src/ports/SkTLS_pthread.cpp",
|
||||
]
|
||||
} else {
|
||||
sources -= [
|
||||
"//third_party/skia/src/ports/SkFontHost_win.cpp",
|
||||
"//third_party/skia/src/ports/SkFontMgr_win_dw.cpp",
|
||||
"//third_party/skia/src/ports/SkOSFile_win.cpp",
|
||||
"//third_party/skia/src/ports/SkRemotableFontMgr_win_dw.cpp",
|
||||
"//third_party/skia/src/ports/SkScalerContext_win_dw.cpp",
|
||||
"//third_party/skia/src/ports/SkScalerContext_win_dw.h",
|
||||
"//third_party/skia/src/ports/SkTLS_win.cpp",
|
||||
"//third_party/skia/src/ports/SkTypeface_win_dw.cpp",
|
||||
"//third_party/skia/src/ports/SkTypeface_win_dw.h",
|
||||
]
|
||||
}
|
||||
if (!is_android) {
|
||||
sources -= [
|
||||
"//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",
|
||||
]
|
||||
}
|
||||
if (!is_mac && !is_ios) {
|
||||
sources -= [ "//third_party/skia/src/ports/SkFontHost_mac.cpp" ]
|
||||
}
|
||||
|
||||
if (!is_linux) {
|
||||
sources -= [
|
||||
"//third_party/skia/src/ports/SkFontConfigInterface.cpp",
|
||||
"//third_party/skia/src/ports/SkFontConfigInterface_direct_factory.cpp",
|
||||
"//third_party/skia/src/ports/SkFontConfigInterface_direct.cpp",
|
||||
"//third_party/skia/src/ports/SkFontMgr_FontConfigInterface.cpp",
|
||||
"//third_party/skia/src/ports/SkFontMgr_FontConfigInterface_factory.cpp",
|
||||
]
|
||||
}
|
||||
|
||||
if (!is_linux && !is_android) {
|
||||
sources -= [
|
||||
"//third_party/skia/src/ports/SkFontHost_FreeType.cpp",
|
||||
"//third_party/skia/src/ports/SkFontHost_FreeType_common.cpp",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_clang) {
|
||||
# Skia won't compile with some of the more strict clang warnings.
|
||||
# e.g. it does:
|
||||
# SkASSERT(!"sk_out_of_memory");
|
||||
configs -= [ "//build/config/clang:extra_warnings" ]
|
||||
}
|
||||
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [
|
||||
":skia_library_config",
|
||||
"//build/config/compiler:no_chromium_code",
|
||||
]
|
||||
public_configs = [ ":skia_config" ]
|
||||
|
||||
deps = [
|
||||
":skia_opts",
|
||||
"//base",
|
||||
"//base/third_party/dynamic_annotations",
|
||||
"//third_party/zlib",
|
||||
"//third_party/libpng",
|
||||
"//third_party/libjpeg_turbo:libjpeg",
|
||||
]
|
||||
|
||||
if (is_linux) {
|
||||
configs += [
|
||||
"//build/config/linux:fontconfig",
|
||||
"//build/config/linux:freetype2",
|
||||
]
|
||||
deps += [ "//third_party/icu:icuuc" ]
|
||||
}
|
||||
|
||||
if (is_android) {
|
||||
deps += [
|
||||
"//third_party/expat",
|
||||
"//third_party/freetype-android:freetype",
|
||||
"//third_party/android_tools:cpu_features",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_android && !is_debug) {
|
||||
configs -= [ "//build/config/compiler:optimize" ]
|
||||
configs += [ "//build/config/compiler:optimize_max" ]
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
deps += [ "//third_party/glfw" ]
|
||||
}
|
||||
}
|
||||
|
||||
# Separated out so it can be compiled with different flags for SSE.
|
||||
source_set("skia_opts") {
|
||||
cflags = []
|
||||
defines = []
|
||||
|
||||
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||
sources = gypi_skia_opts.sse2_sources + gypi_skia_opts.ssse3_sources +
|
||||
gypi_skia_opts.sse41_sources + gypi_skia_opts.sse42_sources +
|
||||
gypi_skia_opts.avx_sources
|
||||
cflags += [ "-msse4.1" ]
|
||||
} else if (current_cpu == "arm") {
|
||||
# The assembly uses the frame pointer register (r7 in Thumb/r11 in
|
||||
# ARM), the compiler doesn't like that.
|
||||
cflags += [ "-fomit-frame-pointer" ]
|
||||
if (arm_version >= 7 && (arm_use_neon || arm_optionally_use_neon)) {
|
||||
sources = gypi_skia_opts.armv7_sources
|
||||
if (arm_use_neon || arm_optionally_use_neon) {
|
||||
sources += gypi_skia_opts.neon_sources
|
||||
|
||||
# Root build config sets -mfpu=$arm_fpu, which we expect to be neon
|
||||
# when running this.
|
||||
if (!arm_use_neon) {
|
||||
configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
|
||||
cflags += [ "-mfpu=neon" ]
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sources = gypi_skia_opts.none_sources
|
||||
}
|
||||
} else if (current_cpu == "arm64") {
|
||||
sources = gypi_skia_opts.armv7_sources
|
||||
+ gypi_skia_opts.neon_sources
|
||||
+ gypi_skia_opts.crc32_sources
|
||||
} else if (current_cpu == "mipsel") {
|
||||
cflags += [ "-fomit-frame-pointer" ]
|
||||
|
||||
if (mips_dsp_rev >= 1) {
|
||||
sources = gypi_skia_opts.mips_dsp_sources
|
||||
} else {
|
||||
sources = gypi_skia_opts.none_sources
|
||||
}
|
||||
} else {
|
||||
assert(false, "Need to port cpu specific stuff from skia_library_opts.gyp")
|
||||
}
|
||||
|
||||
sources += gypi_skia_opts.hsw_sources
|
||||
|
||||
if (is_android && !is_debug) {
|
||||
configs -= [ "//build/config/compiler:optimize" ]
|
||||
configs += [ "//build/config/compiler:optimize_max" ]
|
||||
}
|
||||
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [
|
||||
":skia_config",
|
||||
":skia_library_config",
|
||||
"//build/config/compiler:no_chromium_code",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
]
|
||||
|
||||
visibility = [ ":skia" ]
|
||||
}
|
||||
|
||||
} # if (is_fuchsia)
|
||||
@@ -1,294 +0,0 @@
|
||||
/*
|
||||
* 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 SkUserConfig_DEFINED
|
||||
#define SkUserConfig_DEFINED
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* Scalars (the fractional value type in skia) can be implemented either as
|
||||
floats or 16.16 integers (fixed). Exactly one of these two symbols must be
|
||||
defined.
|
||||
*/
|
||||
//#define SK_SCALAR_IS_FLOAT
|
||||
//#define SK_SCALAR_IS_FIXED
|
||||
|
||||
|
||||
/* Somewhat independent of how SkScalar is implemented, Skia also wants to know
|
||||
if it can use floats at all. Naturally, if SK_SCALAR_IS_FLOAT is defined,
|
||||
then so muse SK_CAN_USE_FLOAT, but if scalars are fixed, SK_CAN_USE_FLOAT
|
||||
can go either way.
|
||||
*/
|
||||
//#define SK_CAN_USE_FLOAT
|
||||
|
||||
/* For some performance-critical scalar operations, skia will optionally work
|
||||
around the standard float operators if it knows that the CPU does not have
|
||||
native support for floats. If your environment uses software floating point,
|
||||
define this flag.
|
||||
*/
|
||||
//#define SK_SOFTWARE_FLOAT
|
||||
|
||||
|
||||
/* 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
|
||||
|
||||
|
||||
/* Some compilers don't support long long for 64bit integers. If yours does
|
||||
not, define this to the appropriate type.
|
||||
*/
|
||||
//#define SkLONGLONG int64_t
|
||||
|
||||
|
||||
/* Some envorinments do not suport writable globals (eek!). If yours does not,
|
||||
define this flag.
|
||||
*/
|
||||
//#define SK_USE_RUNTIME_GLOBALS
|
||||
|
||||
/* 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 SK_ZLIB_INCLUDE "third_party/zlib/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/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(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_LEGACY_DRAWPICTURECALLBACK
|
||||
# define SK_LEGACY_DRAWPICTURECALLBACK
|
||||
#endif
|
||||
|
||||
#ifndef SK_SUPPORT_LEGACY_GETDEVICE
|
||||
# define SK_SUPPORT_LEGACY_GETDEVICE
|
||||
#endif
|
||||
|
||||
#ifndef SK_SUPPORT_LEGACY_PUBLIC_IMAGEINFO_FIELDS
|
||||
# define SK_SUPPORT_LEGACY_PUBLIC_IMAGEINFO_FIELDS
|
||||
#endif
|
||||
|
||||
#ifndef SK_IGNORE_ETC1_SUPPORT
|
||||
# define SK_IGNORE_ETC1_SUPPORT
|
||||
#endif
|
||||
|
||||
#ifndef SK_SUPPORT_LEGACY_BOOL_ONGETINFO
|
||||
# define SK_SUPPORT_LEGACY_BOOL_ONGETINFO
|
||||
#endif
|
||||
|
||||
#ifndef SK_IGNORE_GPU_DITHER
|
||||
# define SK_IGNORE_GPU_DITHER
|
||||
#endif
|
||||
|
||||
#ifndef SK_SUPPORT_LEGACY_INT_COLORMATRIX
|
||||
# define SK_SUPPORT_LEGACY_INT_COLORMATRIX
|
||||
#endif
|
||||
|
||||
#ifndef SK_LEGACY_STROKE_CURVES
|
||||
# define SK_LEGACY_STROKE_CURVES
|
||||
#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
|
||||
|
||||
/* Forcing the unoptimized path for the offset image filter in skia until
|
||||
* all filters used in Blink support the optimized path properly
|
||||
*/
|
||||
#define SK_DISABLE_OFFSETIMAGEFILTER_OPTIMIZATION
|
||||
|
||||
/* This flag forces Skia not to use typographic metrics with GDI.
|
||||
*/
|
||||
#define SK_GDI_ALWAYS_USE_TEXTMETRICS_FOR_FONT_METRICS
|
||||
|
||||
#define IGNORE_ROT_AA_RECT_OPT
|
||||
#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"
|
||||
|
||||
// ===== End Chrome-specific definitions =====
|
||||
|
||||
#endif
|
||||
@@ -46,6 +46,11 @@ def to_gn_args(args):
|
||||
|
||||
gn_args = {}
|
||||
|
||||
# Skia GN args.
|
||||
gn_args['skia_use_dng_sdk'] = False # RAW image handling.
|
||||
gn_args['skia_use_sfntly'] = False # PDF handling.
|
||||
gn_args['skia_use_libwebp'] = False # Needs third_party/libwebp.
|
||||
|
||||
gn_args['is_debug'] = args.unoptimized
|
||||
gn_args['android_full_debug'] = args.target_os == 'android' and args.unoptimized
|
||||
gn_args['is_clang'] = True
|
||||
|
||||
Reference in New Issue
Block a user