1/*
2 * Copyright 2016 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 */
7
8#ifndef SkArithmeticImageFilter_DEFINED
9#define SkArithmeticImageFilter_DEFINED
10
11#include "include/core/SkImageFilter.h"
12
13struct ArithmeticFPInputs {
14 ArithmeticFPInputs(float k0, float k1, float k2, float k3, bool enforcePMColor) {
15 // We copy instances of this struct as the input data blob for the SkSL FP. The FP
16 // may try to access all of our bytes (for comparison purposes), so be sure to zero out
17 // any padding after the dangling bool.
18 memset(this, 0, sizeof(*this));
19 fK[0] = k0;
20 fK[1] = k1;
21 fK[2] = k2;
22 fK[3] = k3;
23 fEnforcePMColor = enforcePMColor;
24 }
25
26 float fK[4];
27 bool fEnforcePMColor;
28};
29
30// DEPRECATED: Use include/effects/SkImageFilters::Arithmetic
31class SK_API SkArithmeticImageFilter {
32public:
33 static sk_sp<SkImageFilter> Make(float k1, float k2, float k3, float k4, bool enforcePMColor,
34 sk_sp<SkImageFilter> background,
35 sk_sp<SkImageFilter> foreground,
36 const SkImageFilter::CropRect* cropRect);
37
38 static void RegisterFlattenables();
39
40private:
41 SkArithmeticImageFilter(); // can't instantiate
42};
43
44#endif
45