blob: d402c02e21e04dffa9f46d2cda7b0bf2aed03e3e [file] [log] [blame]
caryclark@google.comd26147a2011-12-15 14:16:43 +00001/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
rmistry@google.comd6176b02012-08-23 18:14:13 +00007
caryclark@google.comd26147a2011-12-15 14:16:43 +00008#include "SkTypes.h"
9
caryclark@google.comd26147a2011-12-15 14:16:43 +000010#include "SkBitmapProcShader.h"
caryclark@google.comd26147a2011-12-15 14:16:43 +000011#include "SkMallocPixelRef.h"
12#include "SkPathEffect.h"
13#include "SkPixelRef.h"
caryclark@google.comd26147a2011-12-15 14:16:43 +000014#include "SkXfermode.h"
15
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000016#include "Sk1DPathEffect.h"
17#include "Sk2DPathEffect.h"
senorblanco@chromium.org9a6eb0e2013-05-29 20:55:09 +000018#include "SkArithmeticMode.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000019#include "SkAvoidXfermode.h"
senorblanco@chromium.org3f2d45a2013-01-18 20:48:20 +000020#include "SkBicubicImageFilter.h"
senorblanco@chromium.orgd912ca42012-08-23 19:10:04 +000021#include "SkBitmapSource.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000022#include "SkBlurDrawLooper.h"
23#include "SkBlurImageFilter.h"
24#include "SkBlurMaskFilter.h"
25#include "SkColorFilter.h"
senorblanco@chromium.org392e14e2012-08-20 19:45:02 +000026#include "SkColorFilterImageFilter.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000027#include "SkColorMatrixFilter.h"
28#include "SkColorShader.h"
commit-bot@chromium.org1c4c9ef2013-08-07 00:07:51 +000029#include "SkComposeImageFilter.h"
scroggob3c0f482012-07-02 19:07:57 +000030#include "SkComposeShader.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000031#include "SkCornerPathEffect.h"
32#include "SkDashPathEffect.h"
33#include "SkDiscretePathEffect.h"
sugoi@google.com781cc762013-01-15 15:40:19 +000034#include "SkDisplacementMapEffect.h"
junov@chromium.orgf44fcdc2013-08-07 20:00:55 +000035#include "SkDropShadowImageFilter.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000036#include "SkEmptyShader.h"
scroggo@google.com72ae6bd2012-04-20 18:42:55 +000037#include "SkEmbossMaskFilter.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000038#include "SkFlattenable.h"
39#include "SkGradientShader.h"
scroggo@google.com5a7c6be2012-10-04 21:46:08 +000040#include "SkImages.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000041#include "SkLayerDrawLooper.h"
42#include "SkLayerRasterizer.h"
reed@google.com8c6411a2013-05-22 13:21:32 +000043#include "SkLerpXfermode.h"
djsollen@google.com08337772012-06-26 14:33:13 +000044#include "SkLightingImageFilter.h"
commit-bot@chromium.org6c1ee2d2013-10-07 18:00:17 +000045#include "SkLumaColorFilter.h"
senorblanco@chromium.org35c5ff02012-08-22 18:34:16 +000046#include "SkMagnifierImageFilter.h"
senorblanco@chromium.orgb4ca9df2012-09-19 22:50:21 +000047#include "SkMatrixConvolutionImageFilter.h"
senorblanco@chromium.org4a9a6122012-12-04 14:18:50 +000048#include "SkMergeImageFilter.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000049#include "SkMorphologyImageFilter.h"
senorblanco@chromium.org4a9a6122012-12-04 14:18:50 +000050#include "SkOffsetImageFilter.h"
commit-bot@chromium.orgc0b7e102013-10-23 17:06:21 +000051#include "SkOnce.h"
sugoi@google.come3b4c502013-04-05 13:47:09 +000052#include "SkPerlinNoiseShader.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000053#include "SkPixelXorXfermode.h"
commit-bot@chromium.orgcf292b72013-09-05 18:28:08 +000054#include "SkRectShaderImageFilter.h"
robertphillips@google.com088719e2012-06-05 13:22:14 +000055#include "SkStippleMaskFilter.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000056#include "SkTableColorFilter.h"
57#include "SkTestImageFilters.h"
sugoi@google.com0ac74b22013-09-26 17:03:38 +000058#include "SkTileImageFilter.h"
senorblanco@chromium.org86fc2662013-05-31 17:49:12 +000059#include "SkXfermodeImageFilter.h"
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000060
commit-bot@chromium.orgc0b7e102013-10-23 17:06:21 +000061static void InitializeFlattenables(int*) {
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000062 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkAvoidXfermode)
senorblanco@chromium.org3f2d45a2013-01-18 20:48:20 +000063 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBicubicImageFilter)
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000064 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader)
senorblanco@chromium.orgd912ca42012-08-23 19:10:04 +000065 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapSource)
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000066 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurDrawLooper)
67 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter)
68 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorMatrixFilter)
69 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorShader)
70 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposePathEffect)
scroggob3c0f482012-07-02 19:07:57 +000071 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeShader)
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000072 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkCornerPathEffect)
73 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDashPathEffect)
74 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter)
75 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiscretePathEffect)
sugoi@google.com781cc762013-01-15 15:40:19 +000076 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDisplacementMapEffect)
junov@chromium.orgf44fcdc2013-08-07 20:00:55 +000077 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDropShadowImageFilter)
scroggo@google.com72ae6bd2012-04-20 18:42:55 +000078 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmbossMaskFilter)
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000079 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmptyShader)
80 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkErodeImageFilter)
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000081 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerDrawLooper)
82 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLayerRasterizer)
reed@google.com8c6411a2013-05-22 13:21:32 +000083 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLerpXfermode)
commit-bot@chromium.org6c1ee2d2013-10-07 18:00:17 +000084 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLumaColorFilter)
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000085 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath1DPathEffect)
scroggo@google.comd8a6cc82012-09-12 18:53:49 +000086 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Sk2DPathEffect)
87 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLine2DPathEffect)
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000088 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPath2DPathEffect)
sugoi@google.come3b4c502013-04-05 13:47:09 +000089 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPerlinNoiseShader)
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000090 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPixelXorXfermode)
commit-bot@chromium.orgcf292b72013-09-05 18:28:08 +000091 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRectShaderImageFilter)
robertphillips@google.com941ee932012-06-05 12:55:05 +000092 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkStippleMaskFilter)
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000093 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect)
sugoi@google.com0ac74b22013-09-26 17:03:38 +000094 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTileImageFilter)
senorblanco@chromium.org86fc2662013-05-31 17:49:12 +000095 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkXfermodeImageFilter)
bsalomon@google.com82aa7482012-08-13 14:22:17 +000096 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMagnifierImageFilter)
senorblanco@chromium.orgb4ca9df2012-09-19 22:50:21 +000097 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixConvolutionImageFilter)
djsollen@google.coma2ca41e2012-03-23 19:00:34 +000098
99 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkOffsetImageFilter)
100 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeImageFilter)
101 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMergeImageFilter)
102 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterImageFilter)
103 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDownSampleImageFilter)
djsollen@google.com5370cd92012-03-28 20:47:01 +0000104 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMallocPixelRef)
105
senorblanco@chromium.org9a6eb0e2013-05-29 20:55:09 +0000106 SkArithmeticMode::InitializeFlattenables();
djsollen@google.coma2ca41e2012-03-23 19:00:34 +0000107 SkBlurMaskFilter::InitializeFlattenables();
108 SkColorFilter::InitializeFlattenables();
109 SkGradientShader::InitializeFlattenables();
scroggo@google.com5a7c6be2012-10-04 21:46:08 +0000110 SkImages::InitializeFlattenables();
djsollen@google.com08337772012-06-26 14:33:13 +0000111 SkLightingImageFilter::InitializeFlattenables();
djsollen@google.coma2ca41e2012-03-23 19:00:34 +0000112 SkTableColorFilter::InitializeFlattenables();
113 SkXfermode::InitializeFlattenables();
caryclark@google.comd26147a2011-12-15 14:16:43 +0000114}
commit-bot@chromium.orgc0b7e102013-10-23 17:06:21 +0000115
116void SkFlattenable::InitializeFlattenablesIfNeeded() {
117 int dummy;
118 SK_DECLARE_STATIC_ONCE(once);
119 SkOnce(&once, InitializeFlattenables, &dummy);
120}