Flutter Engine
The Flutter Engine
third_party
skia
modules
svg
src
SkSVGFeFlood.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2020 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
#include "
include/effects/SkImageFilters.h
"
9
#include "
modules/svg/include/SkSVGFeFlood.h
"
10
#include "
modules/svg/include/SkSVGFilterContext.h
"
11
#include "
modules/svg/include/SkSVGRenderContext.h
"
12
#include "
modules/svg/include/SkSVGValue.h
"
13
14
SkColor
SkSVGFeFlood::resolveFloodColor(
const
SkSVGRenderContext
& ctx)
const
{
15
const
auto
floodColor = this->getFloodColor();
16
const
auto
floodOpacity = this->getFloodOpacity();
17
// Uninherited presentation attributes should have a concrete value by now.
18
if
(!floodColor.isValue() || !floodOpacity.isValue()) {
19
SkDebugf
(
"unhandled: flood-color or flood-opacity has no value\n"
);
20
return
SK_ColorBLACK
;
21
}
22
23
const
SkColor
color
= ctx.
resolveSvgColor
(*floodColor);
24
return
SkColorSetA
(
color
,
SkScalarRoundToInt
(*floodOpacity * 255));
25
}
26
27
sk_sp<SkImageFilter>
SkSVGFeFlood::onMakeImageFilter
(
const
SkSVGRenderContext
& ctx,
28
const
SkSVGFilterContext
& fctx)
const
{
29
return
SkImageFilters::Shader
(
SkShaders::Color
(resolveFloodColor(ctx)),
30
this->
resolveFilterSubregion
(ctx, fctx));
31
}
SkColor
uint32_t SkColor
Definition:
SkColor.h:37
SkColorSetA
static constexpr SkColor SkColorSetA(SkColor c, U8CPU a)
Definition:
SkColor.h:82
SK_ColorBLACK
constexpr SkColor SK_ColorBLACK
Definition:
SkColor.h:103
SkDebugf
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
SkImageFilters.h
SkSVGFeFlood.h
SkSVGFilterContext.h
SkSVGRenderContext.h
SkSVGValue.h
SkScalarRoundToInt
#define SkScalarRoundToInt(x)
Definition:
SkScalar.h:37
SkImageFilters::Shader
static sk_sp< SkImageFilter > Shader(sk_sp< SkShader > shader, const CropRect &cropRect={})
Definition:
SkImageFilters.h:456
SkSVGFeFlood::onMakeImageFilter
sk_sp< SkImageFilter > onMakeImageFilter(const SkSVGRenderContext &, const SkSVGFilterContext &) const override
Definition:
SkSVGFeFlood.cpp:27
SkSVGFe::resolveFilterSubregion
SkRect resolveFilterSubregion(const SkSVGRenderContext &, const SkSVGFilterContext &) const
Definition:
SkSVGFe.cpp:54
SkSVGFilterContext
Definition:
SkSVGFilterContext.h:21
SkSVGRenderContext
Definition:
SkSVGRenderContext.h:63
SkSVGRenderContext::resolveSvgColor
SkSVGColorType resolveSvgColor(const SkSVGColor &) const
Definition:
SkSVGRenderContext.cpp:471
sk_sp< SkImageFilter >
color
DlColor color
Definition:
dl_golden_blur_unittests.cc:23
SkShaders::Color
SK_API sk_sp< SkShader > Color(SkColor)
Definition:
SkColorShader.cpp:103
Generated on Sun Jun 23 2024 21:56:08 for Flutter Engine by
1.9.4