Revert "simplify disabling effect deserialization"

This reverts commit 5bbf790b5b.

Reason for revert: flutter GN needs some love

Original change's description:
> simplify disabling effect deserialization
> 
> Switch to a simple #define instead of conditional build targets.
> 
> No one changes skia_enable_effects or skia_enable_effects_imagefilters,
> so we can merge all that together back into :skia.
> 
> Change-Id: I2985f95ee89149ddc687dc31f4c6bf35cb3a93c7
> Reviewed-on: https://skia-review.googlesource.com/c/169220
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,kjlubick@google.com

Change-Id: I3b818418d303dbc6d2a926a19df64a68499f0ec3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/169222
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2018-11-07 18:52:14 +00:00 committed by Skia Commit-Bot
parent 2969d27760
commit 34d7a163a4
9 changed files with 210 additions and 151 deletions

View File

@ -42,6 +42,9 @@ declare_args() {
skia_enable_ccpr = true
skia_enable_nvpr = !skia_enable_flutter_defines
skia_enable_discrete_gpu = true
skia_enable_effects = true
skia_enable_effects_imagefilters = true
skia_enable_effect_deserialization = !skia_enable_flutter_defines
skia_enable_fontmgr_empty = false
skia_enable_gpu = true
skia_enable_nima = false
@ -372,6 +375,38 @@ template("optional") {
}
}
optional("effects") {
enabled = skia_enable_effects
deps = [
":compile_processors",
]
sources = skia_effects_sources
if (skia_enable_effects_imagefilters) {
sources += skia_effects_imagefilter_sources_no_global_initialization
if (!skia_enable_skpicture) {
sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
}
}
}
optional("effect_deserialization") {
enabled = skia_enable_effects && skia_enable_effect_deserialization
sources = [
"src/ports/SkGlobalInitialization_default.cpp",
]
if (skia_enable_effects_imagefilters) {
sources += [ "src/ports/SkGlobalInitialization_default_imagefilters.cpp" ]
} else {
sources += [ "src/ports/SkGlobalInitialization_none_imagefilters.cpp" ]
}
sources_when_disabled = [
"src/ports/SkGlobalInitialization_none.cpp",
"src/ports/SkGlobalInitialization_none_imagefilters.cpp",
]
}
optional("fontmgr_android") {
enabled = fontmgr_android_enabled
@ -828,8 +863,9 @@ component("skia") {
":arm64",
":armv7",
":avx",
":compile_processors",
":crc32",
":effect_deserialization",
":effects",
":fontmgr_android",
":fontmgr_custom",
":fontmgr_empty",
@ -866,8 +902,6 @@ component("skia") {
sources += skia_core_sources
sources += skia_utils_sources
sources += skia_xps_sources
sources += skia_effects_sources
sources += skia_effects_imagefilter_sources
sources += [
"src/android/SkAndroidFrameworkUtils.cpp",
"src/android/SkAnimatedImage.cpp",
@ -893,7 +927,6 @@ component("skia") {
"src/codec/SkWbmpCodec.cpp",
"src/images/SkImageEncoder.cpp",
"src/ports/SkDiscardableMemory_none.cpp",
"src/ports/SkGlobalInitialization_default.cpp",
"src/ports/SkImageGenerator_skia.cpp",
"src/ports/SkMemory_malloc.cpp",
"src/ports/SkOSFile_stdio.cpp",
@ -907,7 +940,6 @@ component("skia") {
if (!skia_enable_skpicture) {
defines = [ "SK_DISABLE_SKPICTURE" ]
sources -= skia_skpicture_sources
sources -= [ "//src/effects/imagefilters/SkPictureImageFilter.cpp" ]
sources += [ "src/core/SkPicture_none.cpp" ]
}

View File

@ -101,7 +101,6 @@ echo "Compiling bitcode"
extra_cflags_cc=[\"-frtti\"] \
extra_cflags=[\"-s\",\"USE_FREETYPE=1\",\"-s\",\"USE_LIBPNG=1\", \"-s\", \"WARN_UNALIGNED=1\",
\"-DSKNX_NO_SIMD\", \"-DSK_DISABLE_AAA\", \"-DSK_DISABLE_DAA\", \"-DSK_DISABLE_READBUFFER\",
\"-DSK_DISABLE_EFFECT_DESERIALIZATION\",
${GN_GPU_FLAGS}
${EXTRA_CFLAGS}
] \
@ -131,6 +130,7 @@ echo "Compiling bitcode"
skia_enable_nvpr=false \
skia_enable_skpicture=false \
${GN_NIMA} \
skia_enable_effect_deserialization = false \
${GN_GPU} \
skia_enable_fontmgr_empty=false \
skia_enable_pdf=false"

View File

@ -7,7 +7,7 @@
_src = get_path_info("../src", "abspath")
_include = get_path_info("../include", "abspath")
skia_effects_imagefilter_sources = [
skia_effects_imagefilter_sources_no_global_initialization = [
"$_src/effects/imagefilters/SkAlphaThresholdFilter.cpp",
"$_src/effects/imagefilters/SkArithmeticImageFilter.cpp",
"$_src/effects/imagefilters/SkBlurImageFilter.cpp",
@ -42,3 +42,8 @@ skia_effects_imagefilter_sources = [
"$_include/effects/SkTileImageFilter.h",
"$_include/effects/SkXfermodeImageFilter.h",
]
# Chrome's using this target, so we need to keep it around for now.
skia_effects_imagefilter_sources =
skia_effects_imagefilter_sources_no_global_initialization +
[ "$_src/ports/SkGlobalInitialization_default_imagefilters.cpp" ]

View File

@ -15,7 +15,6 @@ flutter_defines = [
# Flutter doesn't deserialize anything.
"SK_DISABLE_READBUFFER",
"SK_DISABLE_EFFECT_DESERIALIZATION",
# Fast low-precision software rendering isn't a priority for Flutter.
"SK_DISABLE_LEGACY_SHADERCONTEXT",

View File

@ -301,6 +301,8 @@ BASE_SRCS_UNIX = struct(
"src/ports/SkFontMgr_empty_factory.cpp",
"src/ports/SkFontMgr_fontconfig.cpp",
"src/ports/SkFontMgr_fontconfig_factory.cpp",
"src/ports/SkGlobalInitialization_none.cpp",
"src/ports/SkGlobalInitialization_none_imagefilters.cpp",
"src/ports/SkImageGenerator_none.cpp",
"src/ports/SkTLS_none.cpp",
],
@ -328,6 +330,8 @@ BASE_SRCS_ANDROID = struct(
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
"src/ports/SkFontMgr_custom_empty_factory.cpp",
"src/ports/SkFontMgr_empty_factory.cpp",
"src/ports/SkGlobalInitialization_none.cpp",
"src/ports/SkGlobalInitialization_none_imagefilters.cpp",
"src/ports/SkImageGenerator_none.cpp",
"src/ports/SkTLS_none.cpp",
],
@ -359,6 +363,8 @@ BASE_SRCS_IOS = struct(
"src/ports/SkFontMgr_custom_embedded_factory.cpp",
"src/ports/SkFontMgr_custom_empty_factory.cpp",
"src/ports/SkFontMgr_empty_factory.cpp",
"src/ports/SkGlobalInitialization_none.cpp",
"src/ports/SkGlobalInitialization_none_imagefilters.cpp",
"src/ports/SkImageGenerator_none.cpp",
"src/ports/SkTLS_none.cpp",
],

View File

@ -5,151 +5,90 @@
* found in the LICENSE file.
*/
#include "SkFlattenable.h"
#include "../../src/effects/SkDashImpl.h"
#include "../../src/effects/SkEmbossMaskFilter.h"
#include "../../src/effects/SkOpPE.h"
#include "../../src/effects/SkTrimPE.h"
#include "Sk1DPathEffect.h"
#include "Sk2DPathEffect.h"
#include "SkBitmapProcShader.h"
#include "SkColorFilter.h"
#include "SkColorFilterShader.h"
#include "SkColorMatrixFilterRowMajor255.h"
#include "SkColorShader.h"
#include "SkComposeShader.h"
#include "SkCornerPathEffect.h"
#include "SkDiscretePathEffect.h"
#include "SkEmptyShader.h"
#include "SkGradientShader.h"
#include "SkHighContrastFilter.h"
#include "SkImageShader.h"
#include "SkLayerDrawLooper.h"
#include "SkLightingShader.h"
#include "SkLocalMatrixShader.h"
#include "SkLumaColorFilter.h"
#include "SkNormalSource.h"
#include "SkOverdrawColorFilter.h"
#include "SkPathEffect.h"
#include "SkPerlinNoiseShader.h"
#include "SkPictureShader.h"
#include "SkRecordedDrawable.h"
#include "SkShaderBase.h"
#include "SkShaderMaskFilter.h"
#include "SkTableColorFilter.h"
#include "SkToSRGBColorFilter.h"
#if defined(SK_DISABLE_EFFECT_DESERIALIZATION)
/*
* Register most effects for deserialization.
*
* None of these are strictly required for Skia to operate,
* so if you're not using deserialization yourself, you can
* build and link SkGlobalInitialization_none.cpp instead,
* or modify/replace this file as needed.
*/
void SkFlattenable::PrivateInitializer::InitEffects() {
// Shaders.
SK_REGISTER_FLATTENABLE(SkColor4Shader)
SK_REGISTER_FLATTENABLE(SkColorFilterShader)
SK_REGISTER_FLATTENABLE(SkColorShader)
SK_REGISTER_FLATTENABLE(SkComposeShader)
SK_REGISTER_FLATTENABLE(SkEmptyShader)
SK_REGISTER_FLATTENABLE(SkLocalMatrixShader)
SK_REGISTER_FLATTENABLE(SkPictureShader)
SkGradientShader::RegisterFlattenables();
SkLightingShader::RegisterFlattenables();
SkPerlinNoiseShader::RegisterFlattenables();
SkShaderBase::RegisterFlattenables();
void SkFlattenable::PrivateInitializer::InitEffects() {}
void SkFlattenable::PrivateInitializer::InitImageFilters() {}
// Color filters.
SK_REGISTER_FLATTENABLE(SkColorMatrixFilterRowMajor255)
SK_REGISTER_FLATTENABLE(SkLumaColorFilter)
SK_REGISTER_FLATTENABLE(SkToSRGBColorFilter)
SkColorFilter::RegisterFlattenables();
SkHighContrastFilter::RegisterFlattenables();
SkOverdrawColorFilter::RegisterFlattenables();
SkTableColorFilter::RegisterFlattenables();
#else
// Mask filters.
SK_REGISTER_FLATTENABLE(SkEmbossMaskFilter)
SkMaskFilter::RegisterFlattenables();
SkShaderMaskFilter::RegisterFlattenables();
#include "../../src/effects/SkDashImpl.h"
#include "../../src/effects/SkEmbossMaskFilter.h"
#include "../../src/effects/SkOpPE.h"
#include "../../src/effects/SkTrimPE.h"
#include "Sk1DPathEffect.h"
#include "Sk2DPathEffect.h"
#include "SkBitmapProcShader.h"
#include "SkColorFilter.h"
#include "SkColorFilterShader.h"
#include "SkColorMatrixFilterRowMajor255.h"
#include "SkColorShader.h"
#include "SkComposeShader.h"
#include "SkCornerPathEffect.h"
#include "SkDiscretePathEffect.h"
#include "SkEmptyShader.h"
#include "SkGradientShader.h"
#include "SkHighContrastFilter.h"
#include "SkImageShader.h"
#include "SkLayerDrawLooper.h"
#include "SkLightingShader.h"
#include "SkLocalMatrixShader.h"
#include "SkLumaColorFilter.h"
#include "SkNormalSource.h"
#include "SkOverdrawColorFilter.h"
#include "SkPathEffect.h"
#include "SkPerlinNoiseShader.h"
#include "SkPictureShader.h"
#include "SkRecordedDrawable.h"
#include "SkShaderBase.h"
#include "SkShaderMaskFilter.h"
#include "SkTableColorFilter.h"
#include "SkToSRGBColorFilter.h"
// Path effects.
SK_REGISTER_FLATTENABLE(SkCornerPathEffect)
SK_REGISTER_FLATTENABLE(SkDashImpl)
SK_REGISTER_FLATTENABLE(SkDiscretePathEffect)
SK_REGISTER_FLATTENABLE(SkLine2DPathEffect)
SK_REGISTER_FLATTENABLE(SkMatrixPE)
SK_REGISTER_FLATTENABLE(SkOpPE)
SK_REGISTER_FLATTENABLE(SkPath1DPathEffect)
SK_REGISTER_FLATTENABLE(SkPath2DPathEffect)
SK_REGISTER_FLATTENABLE(SkStrokePE)
SK_REGISTER_FLATTENABLE(SkTrimPE)
SkPathEffect::RegisterFlattenables();
#include "SkAlphaThresholdFilter.h"
#include "SkBlurImageFilter.h"
#include "SkColorFilterImageFilter.h"
#include "SkComposeImageFilter.h"
#include "SkDisplacementMapEffect.h"
#include "SkDropShadowImageFilter.h"
#include "SkImageSource.h"
#include "SkLightingImageFilter.h"
#include "SkLocalMatrixImageFilter.h"
#include "SkMagnifierImageFilter.h"
#include "SkMatrixConvolutionImageFilter.h"
#include "SkMatrixImageFilter.h"
#include "SkMergeImageFilter.h"
#include "SkMorphologyImageFilter.h"
#include "SkOffsetImageFilter.h"
#include "SkPaintImageFilter.h"
#include "SkPictureImageFilter.h"
#include "SkTileImageFilter.h"
#include "SkXfermodeImageFilter.h"
/*
* Register most effects for deserialization.
*
* None of these are strictly required for Skia to operate, so if you're
* not using deserialization yourself, you can define
* SK_DISABLE_EFFECT_SERIALIZATION, or modify/replace this file as needed.
*/
void SkFlattenable::PrivateInitializer::InitEffects() {
// Shaders.
SK_REGISTER_FLATTENABLE(SkColor4Shader)
SK_REGISTER_FLATTENABLE(SkColorFilterShader)
SK_REGISTER_FLATTENABLE(SkColorShader)
SK_REGISTER_FLATTENABLE(SkComposeShader)
SK_REGISTER_FLATTENABLE(SkEmptyShader)
SK_REGISTER_FLATTENABLE(SkLocalMatrixShader)
SK_REGISTER_FLATTENABLE(SkPictureShader)
SkGradientShader::RegisterFlattenables();
SkLightingShader::RegisterFlattenables();
SkPerlinNoiseShader::RegisterFlattenables();
SkShaderBase::RegisterFlattenables();
// Color filters.
SK_REGISTER_FLATTENABLE(SkColorMatrixFilterRowMajor255)
SK_REGISTER_FLATTENABLE(SkLumaColorFilter)
SK_REGISTER_FLATTENABLE(SkToSRGBColorFilter)
SkColorFilter::RegisterFlattenables();
SkHighContrastFilter::RegisterFlattenables();
SkOverdrawColorFilter::RegisterFlattenables();
SkTableColorFilter::RegisterFlattenables();
// Mask filters.
SK_REGISTER_FLATTENABLE(SkEmbossMaskFilter)
SkMaskFilter::RegisterFlattenables();
SkShaderMaskFilter::RegisterFlattenables();
// Path effects.
SK_REGISTER_FLATTENABLE(SkCornerPathEffect)
SK_REGISTER_FLATTENABLE(SkDashImpl)
SK_REGISTER_FLATTENABLE(SkDiscretePathEffect)
SK_REGISTER_FLATTENABLE(SkLine2DPathEffect)
SK_REGISTER_FLATTENABLE(SkMatrixPE)
SK_REGISTER_FLATTENABLE(SkOpPE)
SK_REGISTER_FLATTENABLE(SkPath1DPathEffect)
SK_REGISTER_FLATTENABLE(SkPath2DPathEffect)
SK_REGISTER_FLATTENABLE(SkStrokePE)
SK_REGISTER_FLATTENABLE(SkTrimPE)
SkPathEffect::RegisterFlattenables();
// Misc.
SK_REGISTER_FLATTENABLE(SkLayerDrawLooper)
SK_REGISTER_FLATTENABLE(SkRecordedDrawable)
SkNormalSource::RegisterFlattenables();
}
/*
* Register SkImageFilters for deserialization.
*
* None of these are strictly required for Skia to operate, so if you're
* not using deserialization yourself, you can define
* SK_DISABLE_EFFECT_SERIALIZATION, or modify/replace this file as needed.
*/
void SkFlattenable::PrivateInitializer::InitImageFilters() {
SkAlphaThresholdFilter::RegisterFlattenables();
SkImageFilter::RegisterFlattenables();
SkArithmeticImageFilter::RegisterFlattenables();
SkXfermodeImageFilter::RegisterFlattenables();
SK_REGISTER_FLATTENABLE(SkDilateImageFilter)
SK_REGISTER_FLATTENABLE(SkDisplacementMapEffect)
SK_REGISTER_FLATTENABLE(SkDropShadowImageFilter)
SK_REGISTER_FLATTENABLE(SkErodeImageFilter)
SK_REGISTER_FLATTENABLE(SkImageSource)
SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter)
SK_REGISTER_FLATTENABLE(SkPaintImageFilter)
SK_REGISTER_FLATTENABLE(SkPictureImageFilter)
SK_REGISTER_FLATTENABLE(SkTileImageFilter)
SK_REGISTER_FLATTENABLE(SkMagnifierImageFilter)
SK_REGISTER_FLATTENABLE(SkMatrixConvolutionImageFilter)
SK_REGISTER_FLATTENABLE(SkMatrixImageFilter)
SK_REGISTER_FLATTENABLE(SkOffsetImageFilter)
SK_REGISTER_FLATTENABLE(SkComposeImageFilter)
SK_REGISTER_FLATTENABLE(SkMergeImageFilter)
SK_REGISTER_FLATTENABLE(SkColorFilterImageFilter)
SkLightingImageFilter::RegisterFlattenables();
}
#endif
// Misc.
SK_REGISTER_FLATTENABLE(SkLayerDrawLooper)
SK_REGISTER_FLATTENABLE(SkRecordedDrawable)
SkNormalSource::RegisterFlattenables();
}

View File

@ -0,0 +1,58 @@
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkAlphaThresholdFilter.h"
#include "SkBlurImageFilter.h"
#include "SkColorFilterImageFilter.h"
#include "SkComposeImageFilter.h"
#include "SkDisplacementMapEffect.h"
#include "SkDropShadowImageFilter.h"
#include "SkImageSource.h"
#include "SkLightingImageFilter.h"
#include "SkLocalMatrixImageFilter.h"
#include "SkMagnifierImageFilter.h"
#include "SkMatrixConvolutionImageFilter.h"
#include "SkMatrixImageFilter.h"
#include "SkMergeImageFilter.h"
#include "SkMorphologyImageFilter.h"
#include "SkOffsetImageFilter.h"
#include "SkPaintImageFilter.h"
#include "SkPictureImageFilter.h"
#include "SkTileImageFilter.h"
#include "SkXfermodeImageFilter.h"
/*
* Register SkImageFilters for deserialization.
*
* None of these are strictly required for Skia to operate,
* so if you're not using deserialization yourself, you can
* build and link SkGlobalInitialization_none_imagefilters.cpp instead,
* or modify/replace this file as needed.
*/
void SkFlattenable::PrivateInitializer::InitImageFilters() {
SkAlphaThresholdFilter::RegisterFlattenables();
SkImageFilter::RegisterFlattenables();
SkArithmeticImageFilter::RegisterFlattenables();
SkXfermodeImageFilter::RegisterFlattenables();
SK_REGISTER_FLATTENABLE(SkDilateImageFilter)
SK_REGISTER_FLATTENABLE(SkDisplacementMapEffect)
SK_REGISTER_FLATTENABLE(SkDropShadowImageFilter)
SK_REGISTER_FLATTENABLE(SkErodeImageFilter)
SK_REGISTER_FLATTENABLE(SkImageSource)
SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter)
SK_REGISTER_FLATTENABLE(SkPaintImageFilter)
SK_REGISTER_FLATTENABLE(SkPictureImageFilter)
SK_REGISTER_FLATTENABLE(SkTileImageFilter)
SK_REGISTER_FLATTENABLE(SkMagnifierImageFilter)
SK_REGISTER_FLATTENABLE(SkMatrixConvolutionImageFilter)
SK_REGISTER_FLATTENABLE(SkMatrixImageFilter)
SK_REGISTER_FLATTENABLE(SkOffsetImageFilter)
SK_REGISTER_FLATTENABLE(SkComposeImageFilter)
SK_REGISTER_FLATTENABLE(SkMergeImageFilter)
SK_REGISTER_FLATTENABLE(SkColorFilterImageFilter)
SkLightingImageFilter::RegisterFlattenables();
}

View File

@ -0,0 +1,10 @@
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkFlattenable.h"
void SkFlattenable::PrivateInitializer::InitEffects() {}

View File

@ -0,0 +1,10 @@
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkFlattenable.h"
void SkFlattenable::PrivateInitializer::InitImageFilters() {}