xref: /aosp_15_r20/external/skia/src/effects/colorfilters/SkGaussianColorFilter.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2022 Google LLC
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 #include "src/effects/colorfilters/SkGaussianColorFilter.h"
9 
10 #include "include/core/SkColorFilter.h"
11 #include "include/core/SkFlattenable.h"
12 #include "include/core/SkRefCnt.h"
13 #include "include/core/SkTypes.h"
14 #include "src/core/SkColorFilterPriv.h"
15 #include "src/core/SkEffectPriv.h"
16 #include "src/core/SkRasterPipeline.h"
17 #include "src/core/SkRasterPipelineOpList.h"
18 #include "src/effects/colorfilters/SkColorFilterBase.h"
19 
SkGaussianColorFilter()20 SkGaussianColorFilter::SkGaussianColorFilter() : SkColorFilterBase() {}
21 
appendStages(const SkStageRec & rec,bool shaderIsOpaque) const22 bool SkGaussianColorFilter::appendStages(const SkStageRec& rec, bool shaderIsOpaque) const {
23     rec.fPipeline->append(SkRasterPipelineOp::gauss_a_to_rgba);
24     return true;
25 }
26 
CreateProc(SkReadBuffer &)27 sk_sp<SkFlattenable> SkGaussianColorFilter::CreateProc(SkReadBuffer&) {
28     return SkColorFilterPriv::MakeGaussian();
29 }
30 
MakeGaussian()31 sk_sp<SkColorFilter> SkColorFilterPriv::MakeGaussian() {
32     return sk_sp<SkColorFilter>(new SkGaussianColorFilter);
33 }
34