Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
helpers.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_LIB_WEB_UI_SKWASM_HELPERS_H_
6#define FLUTTER_LIB_WEB_UI_SKWASM_HELPERS_H_
7
11
12namespace Skwasm {
13
14inline SkMatrix createMatrix(const SkScalar* f) {
15 return SkMatrix::MakeAll(f[0], f[1], f[2], f[3], f[4], f[5], f[6], f[7],
16 f[8]);
17}
18
19inline SkRRect createRRect(const SkScalar* f) {
20 const SkRect* rect = reinterpret_cast<const SkRect*>(f);
21 const SkVector* radiiValues = reinterpret_cast<const SkVector*>(f + 4);
22
23 SkRRect rr;
24 rr.setRectRadii(*rect, radiiValues);
25 return rr;
26}
27
28// This needs to be kept in sync with the "FilterQuality" enum in dart:ui
29enum class FilterQuality {
30 none,
31 low,
32 medium,
33 high,
34};
35
37 switch (quality) {
44 }
45}
46
48 switch (quality) {
56 // Cubic equation coefficients recommended by Mitchell & Netravali
57 // in their paper on cubic interpolation.
59 }
60}
61} // namespace Skwasm
62
63#endif // FLUTTER_LIB_WEB_UI_SKWASM_HELPERS_H_
SkFilterMode
static SkMatrix MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, SkScalar skewY, SkScalar scaleY, SkScalar transY, SkScalar pers0, SkScalar pers1, SkScalar pers2)
Definition SkMatrix.h:179
void setRectRadii(const SkRect &rect, const SkVector radii[4])
Definition SkRRect.cpp:189
float SkScalar
Definition extension.cpp:12
SkRRect createRRect(const SkScalar *f)
Definition helpers.h:19
SkSamplingOptions samplingOptionsForQuality(FilterQuality quality)
Definition helpers.h:47
FilterQuality
Definition helpers.h:29
SkFilterMode filterModeForQuality(FilterQuality quality)
Definition helpers.h:36
SkMatrix createMatrix(const SkScalar *f)
Definition helpers.h:14
static constexpr SkCubicResampler Mitchell()