move imagefilters into separate dir and flag for build.gn

Requires https://chromium-review.googlesource.com/c/chromium/src/+/1105062

Bug: skia:
Change-Id: I948056234efa57c0f727a61d5fb3258034de5199
Reviewed-on: https://skia-review.googlesource.com/135566
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-06-19 10:17:30 -04:00 committed by Skia Commit-Bot
parent 386d9cf402
commit 0917fad2c6
26 changed files with 124 additions and 84 deletions

View File

@ -34,6 +34,7 @@ declare_args() {
skia_android_serial = ""
skia_enable_discrete_gpu = true
skia_enable_effects = true
skia_enable_effects_imagefilters = true
skia_enable_flutter_defines = false
skia_enable_fontmgr_empty = false
skia_enable_gpu = true
@ -371,7 +372,15 @@ optional("effects") {
]
sources =
skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
if (skia_enable_effects_imagefilters) {
sources += skia_effects_imagefilter_sources
} 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") {

View File

@ -12,43 +12,26 @@ skia_effects_sources = [
"$_src/effects/Sk1DPathEffect.cpp",
"$_src/effects/Sk2DPathEffect.cpp",
"$_src/effects/SkAlphaThresholdFilter.cpp",
"$_src/effects/SkArithmeticImageFilter.cpp",
"$_src/effects/SkColorFilterImageFilter.cpp",
"$_src/effects/SkColorMatrix.cpp",
"$_src/effects/SkColorMatrixFilter.cpp",
"$_src/effects/SkComposeImageFilter.cpp",
"$_src/effects/SkCornerPathEffect.cpp",
"$_src/effects/SkDashPathEffect.cpp",
"$_src/effects/SkDiscretePathEffect.cpp",
"$_src/effects/SkDisplacementMapEffect.cpp",
"$_src/effects/SkDropShadowImageFilter.cpp",
"$_src/effects/SkEmbossMask.cpp",
"$_src/effects/SkEmbossMask.h",
"$_src/effects/SkEmbossMaskFilter.cpp",
"$_src/effects/SkImageSource.cpp",
"$_src/effects/SkHighContrastFilter.cpp",
"$_src/effects/SkLayerDrawLooper.cpp",
"$_src/effects/SkLightingImageFilter.cpp",
"$_src/effects/SkLumaColorFilter.cpp",
"$_src/effects/SkMagnifierImageFilter.cpp",
"$_src/effects/SkMatrixConvolutionImageFilter.cpp",
"$_src/effects/SkMergeImageFilter.cpp",
"$_src/effects/SkMorphologyImageFilter.cpp",
"$_src/effects/SkOffsetImageFilter.cpp",
"$_src/effects/SkOverdrawColorFilter.cpp",
"$_src/effects/SkPackBits.cpp",
"$_src/effects/SkPackBits.h",
"$_src/effects/SkPaintFlagsDrawFilter.cpp",
"$_src/effects/SkPaintImageFilter.cpp",
"$_src/effects/SkPictureImageFilter.cpp",
"$_src/effects/SkShaderMaskFilter.cpp",
"$_src/effects/SkTableColorFilter.cpp",
"$_src/effects/SkTableMaskFilter.cpp",
"$_src/effects/SkTileImageFilter.cpp",
"$_src/effects/SkToSRGBColorFilter.cpp",
"$_src/effects/SkTrimPathEffect.cpp",
"$_src/effects/SkXfermodeImageFilter.cpp",
"$_src/shaders/SkPerlinNoiseShader.cpp",
"$_src/shaders/gradients/Sk4fGradientBase.cpp",
@ -73,37 +56,20 @@ skia_effects_sources = [
"$_include/effects/Sk1DPathEffect.h",
"$_include/effects/Sk2DPathEffect.h",
"$_include/effects/SkAlphaThresholdFilter.h",
"$_include/effects/SkArithmeticImageFilter.h",
"$_include/effects/SkBlurDrawLooper.h",
"$_include/effects/SkBlurImageFilter.h",
"$_include/effects/SkBlurMaskFilter.h",
"$_include/effects/SkColorFilterImageFilter.h",
"$_include/effects/SkColorMatrix.h",
"$_include/effects/SkColorMatrixFilter.h",
"$_include/effects/SkCornerPathEffect.h",
"$_include/effects/SkDashPathEffect.h",
"$_include/effects/SkDiscretePathEffect.h",
"$_include/effects/SkDisplacementMapEffect.h",
"$_include/effects/SkDropShadowImageFilter.h",
"$_include/effects/SkGradientShader.h",
"$_include/effects/SkImageSource.h",
"$_include/effects/SkLayerDrawLooper.h",
"$_include/effects/SkLightingImageFilter.h",
"$_include/effects/SkLumaColorFilter.h",
"$_include/effects/SkMagnifierImageFilter.h",
"$_include/effects/SkMorphologyImageFilter.h",
"$_include/effects/SkOffsetImageFilter.h",
"$_include/effects/SkOverdrawColorFilter.h",
"$_include/effects/SkPaintFlagsDrawFilter.h",
"$_include/effects/SkPaintImageFilter.h",
"$_include/effects/SkPerlinNoiseShader.h",
"$_include/effects/SkTableColorFilter.h",
"$_include/effects/SkTableMaskFilter.h",
"$_include/effects/SkTileImageFilter.h",
"$_include/effects/SkToSRGBColorFilter.h",
"$_include/effects/SkXfermodeImageFilter.h",
]
# this will move to a real file after we land a reference to this in chrome
skia_effects_imagefilter_sources = []

View File

@ -0,0 +1,44 @@
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Things are easiest for everyone if these source paths are absolute.
_src = get_path_info("../src", "abspath")
_include = get_path_info("../include", "abspath")
skia_effects_imagefilter_sources = [
"$_src/ports/SkGlobalInitialization_default_imagefilters.cpp",
"$_src/effects/imagefilters/SkAlphaThresholdFilter.cpp",
"$_src/effects/imagefilters/SkArithmeticImageFilter.cpp",
"$_src/effects/imagefilters/SkColorFilterImageFilter.cpp",
"$_src/effects/imagefilters/SkComposeImageFilter.cpp",
"$_src/effects/imagefilters/SkDisplacementMapEffect.cpp",
"$_src/effects/imagefilters/SkDropShadowImageFilter.cpp",
"$_src/effects/imagefilters/SkImageSource.cpp",
"$_src/effects/imagefilters/SkLightingImageFilter.cpp",
"$_src/effects/imagefilters/SkMagnifierImageFilter.cpp",
"$_src/effects/imagefilters/SkMatrixConvolutionImageFilter.cpp",
"$_src/effects/imagefilters/SkMergeImageFilter.cpp",
"$_src/effects/imagefilters/SkMorphologyImageFilter.cpp",
"$_src/effects/imagefilters/SkOffsetImageFilter.cpp",
"$_src/effects/imagefilters/SkPaintImageFilter.cpp",
"$_src/effects/imagefilters/SkPictureImageFilter.cpp",
"$_src/effects/imagefilters/SkTileImageFilter.cpp",
"$_src/effects/imagefilters/SkXfermodeImageFilter.cpp",
"$_include/effects/SkAlphaThresholdFilter.h",
"$_include/effects/SkArithmeticImageFilter.h",
"$_include/effects/SkColorFilterImageFilter.h",
"$_include/effects/SkDisplacementMapEffect.h",
"$_include/effects/SkDropShadowImageFilter.h",
"$_include/effects/SkImageSource.h",
"$_include/effects/SkLightingImageFilter.h",
"$_include/effects/SkMagnifierImageFilter.h",
"$_include/effects/SkMorphologyImageFilter.h",
"$_include/effects/SkOffsetImageFilter.h",
"$_include/effects/SkPaintImageFilter.h",
"$_include/effects/SkTileImageFilter.h",
"$_include/effects/SkXfermodeImageFilter.h",
]

View File

@ -5,6 +5,7 @@
import("core.gni")
import("effects.gni")
import("effects_imagefilters.gni")
import("gpu.gni")
import("opts.gni")
import("pdf.gni")

View File

@ -90,6 +90,7 @@ protected:
public:
static void InitCore();
static void InitEffects();
static void InitImageFilters();
};
private:

View File

@ -50,6 +50,7 @@ void SkFlattenable::PrivateInitializer::InitCore() {
// Now initialize any optional/additional effects (implemented in src/ports)
InitEffects();
InitImageFilters();
// Finalize flattenable initialization.
SkFlattenable::Finalize();

View File

@ -7,48 +7,21 @@
#include "Sk1DPathEffect.h"
#include "Sk2DPathEffect.h"
#include "SkAlphaThresholdFilter.h"
#include "SkBlurImageFilter.h"
#include "SkColorFilterImageFilter.h"
#include "SkColorMatrixFilterRowMajor255.h"
#include "SkComposeImageFilter.h"
#include "SkCornerPathEffect.h"
#include "../../src/effects/SkDashImpl.h"
#include "SkDiscretePathEffect.h"
#include "SkDisplacementMapEffect.h"
#include "SkDropShadowImageFilter.h"
#include "../../src/effects/SkEmbossMaskFilter.h"
#include "SkGradientShader.h"
#include "SkHighContrastFilter.h"
#include "SkImageSource.h"
#include "SkLayerDrawLooper.h"
#include "SkLightingImageFilter.h"
#include "SkLocalMatrixImageFilter.h"
#include "SkLumaColorFilter.h"
#include "SkMagnifierImageFilter.h"
#include "SkMatrixConvolutionImageFilter.h"
#include "SkMergeImageFilter.h"
#include "SkMorphologyImageFilter.h"
#include "SkOffsetImageFilter.h"
#include "SkOverdrawColorFilter.h"
#include "SkPaintImageFilter.h"
#include "SkPerlinNoiseShader.h"
#include "SkPictureImageFilter.h"
#include "SkShaderMaskFilter.h"
#include "SkTableColorFilter.h"
#include "SkTileImageFilter.h"
#include "SkToSRGBColorFilter.h"
#include "../../src/effects/SkTrimPE.h"
#include "SkXfermodeImageFilter.h"
// Security note:
//
// As new subclasses are added here, they should be reviewed by chrome security before they
// support deserializing cross-process: chrome-security@google.com. SampleFilterFuzz.cpp should
// also be amended to exercise the new subclass.
//
// See SkReadBuffer::isCrossProcess() and SkPicture::PictureIOSecurityPrecautionsEnabled()
//
/*
* None of these are strictly "required" for Skia to operate.
@ -71,7 +44,6 @@ void SkFlattenable::PrivateInitializer::InitEffects() {
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorMatrixFilterRowMajor255)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLumaColorFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkToSRGBColorFilter)
SkAlphaThresholdFilter::InitializeFlattenables();
SkTableColorFilter::InitializeFlattenables();
SkOverdrawColorFilter::InitializeFlattenables();
SkHighContrastFilter::InitializeFlattenables();
@ -88,25 +60,4 @@ void SkFlattenable::PrivateInitializer::InitEffects() {
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLine2DPathEffect)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath2DPathEffect)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTrimPE)
// ImageFilter
SkImageFilter::InitializeFlattenables();
SkArithmeticImageFilter::InitializeFlattenables();
SkXfermodeImageFilter::InitializeFlattenables();
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDisplacementMapEffect)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDropShadowImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkErodeImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageSource)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLocalMatrixImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPaintImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTileImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMagnifierImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixConvolutionImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOffsetImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMergeImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterImageFilter)
SkLightingImageFilter::InitializeFlattenables();
}

View File

@ -0,0 +1,57 @@
/*
* 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 "SkFlattenablePriv.h"
#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 "SkMergeImageFilter.h"
#include "SkMorphologyImageFilter.h"
#include "SkOffsetImageFilter.h"
#include "SkPaintImageFilter.h"
#include "SkPictureImageFilter.h"
#include "SkTileImageFilter.h"
#include "SkXfermodeImageFilter.h"
/*
* None of these are strictly "required" for Skia to operate.
*
* These are the bulk of our "effects" -- subclasses of various effects on SkPaint.
*
* Clients should feel free to dup this file and modify it as needed. This function "InitEffects"
* will automatically be called before any of skia's effects are asked to be deserialized.
*/
void SkFlattenable::PrivateInitializer::InitImageFilters() {
SkAlphaThresholdFilter::InitializeFlattenables();
SkImageFilter::InitializeFlattenables();
SkArithmeticImageFilter::InitializeFlattenables();
SkXfermodeImageFilter::InitializeFlattenables();
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDisplacementMapEffect)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDropShadowImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkErodeImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageSource)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLocalMatrixImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPaintImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTileImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMagnifierImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixConvolutionImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOffsetImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMergeImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterImageFilter)
SkLightingImageFilter::InitializeFlattenables();
}

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() {}