/src/mozilla-central/gfx/2d/SVGTurbulenceRenderer-inl.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "2D.h" |
8 | | #include "Filters.h" |
9 | | #include "SIMD.h" |
10 | | |
11 | | namespace mozilla { |
12 | | namespace gfx { |
13 | | |
14 | | template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t> |
15 | | class SVGTurbulenceRenderer |
16 | | { |
17 | | public: |
18 | | SVGTurbulenceRenderer(const Size &aBaseFrequency, int32_t aSeed, |
19 | | int aNumOctaves, const Rect &aTileRect); |
20 | | |
21 | | already_AddRefed<DataSourceSurface> Render(const IntSize &aSize, const Point &aOffset) const; |
22 | | |
23 | | private: |
24 | | /* The turbulence calculation code is an adapted version of what |
25 | | appears in the SVG 1.1 specification: |
26 | | http://www.w3.org/TR/SVG11/filters.html#feTurbulence |
27 | | */ |
28 | | |
29 | | struct StitchInfo { |
30 | | int32_t width; // How much to subtract to wrap for stitching. |
31 | | int32_t height; |
32 | | int32_t wrapX; // Minimum value to wrap. |
33 | | int32_t wrapY; |
34 | | }; |
35 | | |
36 | | const static int sBSize = 0x100; |
37 | | const static int sBM = 0xff; |
38 | | void InitFromSeed(int32_t aSeed); |
39 | | void AdjustBaseFrequencyForStitch(const Rect &aTileRect); |
40 | | IntPoint AdjustForStitch(IntPoint aLatticePoint, const StitchInfo& aStitchInfo) const; |
41 | | StitchInfo CreateStitchInfo(const Rect &aTileRect) const; |
42 | | f32x4_t Noise2(Point aVec, const StitchInfo& aStitchInfo) const; |
43 | | i32x4_t Turbulence(const Point &aPoint) const; |
44 | | Point EquivalentNonNegativeOffset(const Point &aOffset) const; |
45 | | |
46 | | Size mBaseFrequency; |
47 | | int32_t mNumOctaves; |
48 | | StitchInfo mStitchInfo; |
49 | | bool mStitchable; |
50 | | TurbulenceType mType; |
51 | | uint8_t mLatticeSelector[sBSize]; |
52 | | f32x4_t mGradient[sBSize][2]; |
53 | | }; |
54 | | |
55 | | namespace { |
56 | | |
57 | | struct RandomNumberSource |
58 | | { |
59 | 0 | explicit RandomNumberSource(int32_t aSeed) : mLast(SetupSeed(aSeed)) {} Unexecuted instantiation: FilterProcessingSSE2.cpp:mozilla::gfx::(anonymous namespace)::RandomNumberSource::RandomNumberSource(int) Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::(anonymous namespace)::RandomNumberSource::RandomNumberSource(int) |
60 | 0 | int32_t Next() { mLast = Random(mLast); return mLast; } Unexecuted instantiation: FilterProcessingSSE2.cpp:mozilla::gfx::(anonymous namespace)::RandomNumberSource::Next() Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::(anonymous namespace)::RandomNumberSource::Next() |
61 | | |
62 | | private: |
63 | | static const int32_t RAND_M = 2147483647; /* 2**31 - 1 */ |
64 | | static const int32_t RAND_A = 16807; /* 7**5; primitive root of m */ |
65 | | static const int32_t RAND_Q = 127773; /* m / a */ |
66 | | static const int32_t RAND_R = 2836; /* m % a */ |
67 | | |
68 | | /* Produces results in the range [1, 2**31 - 2]. |
69 | | Algorithm is: r = (a * r) mod m |
70 | | where a = 16807 and m = 2**31 - 1 = 2147483647 |
71 | | See [Park & Miller], CACM vol. 31 no. 10 p. 1195, Oct. 1988 |
72 | | To test: the algorithm should produce the result 1043618065 |
73 | | as the 10,000th generated number if the original seed is 1. |
74 | | */ |
75 | | |
76 | | static int32_t |
77 | 0 | SetupSeed(int32_t aSeed) { |
78 | 0 | if (aSeed <= 0) |
79 | 0 | aSeed = -(aSeed % (RAND_M - 1)) + 1; |
80 | 0 | if (aSeed > RAND_M - 1) |
81 | 0 | aSeed = RAND_M - 1; |
82 | 0 | return aSeed; |
83 | 0 | } Unexecuted instantiation: FilterProcessingSSE2.cpp:mozilla::gfx::(anonymous namespace)::RandomNumberSource::SetupSeed(int) Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::(anonymous namespace)::RandomNumberSource::SetupSeed(int) |
84 | | |
85 | | static int32_t |
86 | | Random(int32_t aSeed) |
87 | 0 | { |
88 | 0 | int32_t result = RAND_A * (aSeed % RAND_Q) - RAND_R * (aSeed / RAND_Q); |
89 | 0 | if (result <= 0) |
90 | 0 | result += RAND_M; |
91 | 0 | return result; |
92 | 0 | } Unexecuted instantiation: FilterProcessingSSE2.cpp:mozilla::gfx::(anonymous namespace)::RandomNumberSource::Random(int) Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::(anonymous namespace)::RandomNumberSource::Random(int) |
93 | | |
94 | | int32_t mLast; |
95 | | }; |
96 | | |
97 | | } // unnamed namespace |
98 | | |
99 | | template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t> |
100 | | SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::SVGTurbulenceRenderer(const Size &aBaseFrequency, int32_t aSeed, |
101 | | int aNumOctaves, const Rect &aTileRect) |
102 | | : mBaseFrequency(aBaseFrequency) |
103 | | , mNumOctaves(aNumOctaves) |
104 | | , mStitchInfo() |
105 | | , mStitchable(false) |
106 | | , mType(TURBULENCE_TYPE_TURBULENCE) |
107 | 0 | { |
108 | 0 | InitFromSeed(aSeed); |
109 | 0 | if (Stitch) { |
110 | 0 | AdjustBaseFrequencyForStitch(aTileRect); |
111 | 0 | mStitchInfo = CreateStitchInfo(aTileRect); |
112 | 0 | } |
113 | 0 | } Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::SVGTurbulenceRenderer(mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> const&, int, int, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::SVGTurbulenceRenderer(mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> const&, int, int, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::SVGTurbulenceRenderer(mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> const&, int, int, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::SVGTurbulenceRenderer(mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> const&, int, int, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::SVGTurbulenceRenderer(mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> const&, int, int, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::SVGTurbulenceRenderer(mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> const&, int, int, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::SVGTurbulenceRenderer(mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> const&, int, int, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::SVGTurbulenceRenderer(mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float> const&, int, int, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) |
114 | | |
115 | | template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t> |
116 | | void |
117 | | SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::InitFromSeed(int32_t aSeed) |
118 | 0 | { |
119 | 0 | RandomNumberSource rand(aSeed); |
120 | 0 |
|
121 | 0 | float gradient[4][sBSize][2]; |
122 | 0 | for (int32_t k = 0; k < 4; k++) { |
123 | 0 | for (int32_t i = 0; i < sBSize; i++) { |
124 | 0 | float a, b; |
125 | 0 | do { |
126 | 0 | a = float((rand.Next() % (sBSize + sBSize)) - sBSize) / sBSize; |
127 | 0 | b = float((rand.Next() % (sBSize + sBSize)) - sBSize) / sBSize; |
128 | 0 | } while (a == 0 && b == 0); |
129 | 0 | float s = sqrt(a * a + b * b); |
130 | 0 | gradient[k][i][0] = a / s; |
131 | 0 | gradient[k][i][1] = b / s; |
132 | 0 | } |
133 | 0 | } |
134 | 0 |
|
135 | 0 | for (int32_t i = 0; i < sBSize; i++) { |
136 | 0 | mLatticeSelector[i] = i; |
137 | 0 | } |
138 | 0 | for (int32_t i1 = sBSize - 1; i1 > 0; i1--) { |
139 | 0 | int32_t i2 = rand.Next() % sBSize; |
140 | 0 | Swap(mLatticeSelector[i1], mLatticeSelector[i2]); |
141 | 0 | } |
142 | 0 |
|
143 | 0 | for (int32_t i = 0; i < sBSize; i++) { |
144 | 0 | // Contrary to the code in the spec, we build the first lattice selector |
145 | 0 | // lookup into mGradient so that we don't need to do it again for every |
146 | 0 | // pixel. |
147 | 0 | // We also change the order of the gradient indexing so that we can process |
148 | 0 | // all four color channels at the same time. |
149 | 0 | uint8_t j = mLatticeSelector[i]; |
150 | 0 | mGradient[i][0] = simd::FromF32<f32x4_t>(gradient[2][j][0], gradient[1][j][0], |
151 | 0 | gradient[0][j][0], gradient[3][j][0]); |
152 | 0 | mGradient[i][1] = simd::FromF32<f32x4_t>(gradient[2][j][1], gradient[1][j][1], |
153 | 0 | gradient[0][j][1], gradient[3][j][1]); |
154 | 0 | } |
155 | 0 | } Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::InitFromSeed(int) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::InitFromSeed(int) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::InitFromSeed(int) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::InitFromSeed(int) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::InitFromSeed(int) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::InitFromSeed(int) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::InitFromSeed(int) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::InitFromSeed(int) |
156 | | |
157 | | // Adjust aFreq such that aLength * AdjustForLength(aFreq, aLength) is integer |
158 | | // and as close to aLength * aFreq as possible. |
159 | | static inline float |
160 | | AdjustForLength(float aFreq, float aLength) |
161 | 0 | { |
162 | 0 | float lowFreq = floor(aLength * aFreq) / aLength; |
163 | 0 | float hiFreq = ceil(aLength * aFreq) / aLength; |
164 | 0 | if (aFreq / lowFreq < hiFreq / aFreq) { |
165 | 0 | return lowFreq; |
166 | 0 | } |
167 | 0 | return hiFreq; |
168 | 0 | } Unexecuted instantiation: FilterProcessingSSE2.cpp:mozilla::gfx::AdjustForLength(float, float) Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::AdjustForLength(float, float) |
169 | | |
170 | | template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t> |
171 | | void |
172 | | SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::AdjustBaseFrequencyForStitch(const Rect &aTileRect) |
173 | 0 | { |
174 | 0 | mBaseFrequency = Size(AdjustForLength(mBaseFrequency.width, aTileRect.Width()), |
175 | 0 | AdjustForLength(mBaseFrequency.height, aTileRect.Height())); |
176 | 0 | } Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::AdjustBaseFrequencyForStitch(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::AdjustBaseFrequencyForStitch(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::AdjustBaseFrequencyForStitch(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::AdjustBaseFrequencyForStitch(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::AdjustBaseFrequencyForStitch(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::AdjustBaseFrequencyForStitch(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::AdjustBaseFrequencyForStitch(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::AdjustBaseFrequencyForStitch(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) |
177 | | |
178 | | template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t> |
179 | | typename SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::StitchInfo |
180 | | SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::CreateStitchInfo(const Rect &aTileRect) const |
181 | 0 | { |
182 | 0 | StitchInfo stitch; |
183 | 0 | stitch.width = int32_t(floorf(aTileRect.Width() * mBaseFrequency.width + 0.5f)); |
184 | 0 | stitch.height = int32_t(floorf(aTileRect.Height() * mBaseFrequency.height + 0.5f)); |
185 | 0 | stitch.wrapX = int32_t(aTileRect.X() * mBaseFrequency.width) + stitch.width; |
186 | 0 | stitch.wrapY = int32_t(aTileRect.Y() * mBaseFrequency.height) + stitch.height; |
187 | 0 | return stitch; |
188 | 0 | } Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::CreateStitchInfo(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::CreateStitchInfo(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::CreateStitchInfo(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::CreateStitchInfo(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::CreateStitchInfo(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::CreateStitchInfo(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::CreateStitchInfo(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::CreateStitchInfo(mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float> const&) const |
189 | | |
190 | | static MOZ_ALWAYS_INLINE Float |
191 | | SCurve(Float t) |
192 | 0 | { |
193 | 0 | return t * t * (3 - 2 * t); |
194 | 0 | } Unexecuted instantiation: FilterProcessingSSE2.cpp:mozilla::gfx::SCurve(float) Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::SCurve(float) |
195 | | |
196 | | static MOZ_ALWAYS_INLINE Point |
197 | | SCurve(Point t) |
198 | 0 | { |
199 | 0 | return Point(SCurve(t.x), SCurve(t.y)); |
200 | 0 | } Unexecuted instantiation: FilterProcessingSSE2.cpp:mozilla::gfx::SCurve(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>) Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::SCurve(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>) |
201 | | |
202 | | template<typename f32x4_t> |
203 | | static MOZ_ALWAYS_INLINE f32x4_t |
204 | | BiMix(const f32x4_t& aa, const f32x4_t& ab, |
205 | | const f32x4_t& ba, const f32x4_t& bb, Point s) |
206 | 0 | { |
207 | 0 | return simd::MixF32(simd::MixF32(aa, ab, s.x), |
208 | 0 | simd::MixF32(ba, bb, s.x), s.y); |
209 | 0 | } Unexecuted instantiation: FilterProcessingSSE2.cpp:float __vector(4) mozilla::gfx::BiMix<float __vector(4)>(float __vector(4) const&, float __vector(4) const&, float __vector(4) const&, float __vector(4) const&, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>) Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::simd::Scalarf32x4_t mozilla::gfx::BiMix<mozilla::gfx::simd::Scalarf32x4_t>(mozilla::gfx::simd::Scalarf32x4_t const&, mozilla::gfx::simd::Scalarf32x4_t const&, mozilla::gfx::simd::Scalarf32x4_t const&, mozilla::gfx::simd::Scalarf32x4_t const&, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>) |
210 | | |
211 | | template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t> |
212 | | IntPoint |
213 | | SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::AdjustForStitch(IntPoint aLatticePoint, |
214 | | const StitchInfo& aStitchInfo) const |
215 | 0 | { |
216 | 0 | if (Stitch) { |
217 | 0 | if (aLatticePoint.x >= aStitchInfo.wrapX) { |
218 | 0 | aLatticePoint.x -= aStitchInfo.width; |
219 | 0 | } |
220 | 0 | if (aLatticePoint.y >= aStitchInfo.wrapY) { |
221 | 0 | aLatticePoint.y -= aStitchInfo.height; |
222 | 0 | } |
223 | 0 | } |
224 | 0 | return aLatticePoint; |
225 | 0 | } Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::AdjustForStitch(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::AdjustForStitch(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::AdjustForStitch(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::AdjustForStitch(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::AdjustForStitch(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::AdjustForStitch(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::AdjustForStitch(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::AdjustForStitch(mozilla::gfx::IntPointTyped<mozilla::gfx::UnknownUnits>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::StitchInfo const&) const |
226 | | |
227 | | template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t> |
228 | | f32x4_t |
229 | | SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::Noise2(Point aVec, const StitchInfo& aStitchInfo) const |
230 | 0 | { |
231 | 0 | // aVec is guaranteed to be non-negative, so casting to int32_t always |
232 | 0 | // rounds towards negative infinity. |
233 | 0 | IntPoint topLeftLatticePoint(int32_t(aVec.x), int32_t(aVec.y)); |
234 | 0 | Point r = aVec - topLeftLatticePoint; // fractional offset |
235 | 0 |
|
236 | 0 | IntPoint b0 = AdjustForStitch(topLeftLatticePoint, aStitchInfo); |
237 | 0 | IntPoint b1 = AdjustForStitch(b0 + IntPoint(1, 1), aStitchInfo); |
238 | 0 |
|
239 | 0 | uint8_t i = mLatticeSelector[b0.x & sBM]; |
240 | 0 | uint8_t j = mLatticeSelector[b1.x & sBM]; |
241 | 0 |
|
242 | 0 | const f32x4_t* qua = mGradient[(i + b0.y) & sBM]; |
243 | 0 | const f32x4_t* qub = mGradient[(i + b1.y) & sBM]; |
244 | 0 | const f32x4_t* qva = mGradient[(j + b0.y) & sBM]; |
245 | 0 | const f32x4_t* qvb = mGradient[(j + b1.y) & sBM]; |
246 | 0 |
|
247 | 0 | return BiMix(simd::WSumF32(qua[0], qua[1], r.x, r.y), |
248 | 0 | simd::WSumF32(qva[0], qva[1], r.x - 1.f, r.y), |
249 | 0 | simd::WSumF32(qub[0], qub[1], r.x, r.y - 1.f), |
250 | 0 | simd::WSumF32(qvb[0], qvb[1], r.x - 1.f, r.y - 1.f), |
251 | 0 | SCurve(r)); |
252 | 0 | } Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::Noise2(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::Noise2(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::Noise2(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::Noise2(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Noise2(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Noise2(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Noise2(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::StitchInfo const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Noise2(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::StitchInfo const&) const |
253 | | |
254 | | template<typename f32x4_t, typename i32x4_t, typename u8x16_t> |
255 | | static inline i32x4_t |
256 | | ColorToBGRA(f32x4_t aUnscaledUnpreFloat) |
257 | 0 | { |
258 | 0 | // Color is an unpremultiplied float vector where 1.0f means white. We will |
259 | 0 | // convert it into an integer vector where 255 means white. |
260 | 0 | f32x4_t alpha = simd::SplatF32<3>(aUnscaledUnpreFloat); |
261 | 0 | f32x4_t scaledUnpreFloat = simd::MulF32(aUnscaledUnpreFloat, simd::FromF32<f32x4_t>(255)); |
262 | 0 | i32x4_t scaledUnpreInt = simd::F32ToI32(scaledUnpreFloat); |
263 | 0 |
|
264 | 0 | // Multiply all channels with alpha. |
265 | 0 | i32x4_t scaledPreInt = simd::F32ToI32(simd::MulF32(scaledUnpreFloat, alpha)); |
266 | 0 |
|
267 | 0 | // Use the premultiplied color channels and the unpremultiplied alpha channel. |
268 | 0 | i32x4_t alphaMask = simd::From32<i32x4_t>(0, 0, 0, -1); |
269 | 0 | return simd::Pick(alphaMask, scaledPreInt, scaledUnpreInt); |
270 | 0 | } Unexecuted instantiation: FilterProcessingSSE2.cpp:long long __vector(2) mozilla::gfx::ColorToBGRA<float __vector(4), long long __vector(2), long long __vector(2)>(float __vector(4)) Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::simd::Scalari32x4_t mozilla::gfx::ColorToBGRA<mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>(mozilla::gfx::simd::Scalarf32x4_t) |
271 | | |
272 | | template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t> |
273 | | i32x4_t |
274 | | SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::Turbulence(const Point &aPoint) const |
275 | 0 | { |
276 | 0 | StitchInfo stitchInfo = mStitchInfo; |
277 | 0 | f32x4_t sum = simd::FromF32<f32x4_t>(0); |
278 | 0 | Point vec(aPoint.x * mBaseFrequency.width, aPoint.y * mBaseFrequency.height); |
279 | 0 | f32x4_t ratio = simd::FromF32<f32x4_t>(1); |
280 | 0 |
|
281 | 0 | for (int octave = 0; octave < mNumOctaves; octave++) { |
282 | 0 | f32x4_t thisOctave = Noise2(vec, stitchInfo); |
283 | 0 | if (Type == TURBULENCE_TYPE_TURBULENCE) { |
284 | 0 | thisOctave = simd::AbsF32(thisOctave); |
285 | 0 | } |
286 | 0 | sum = simd::AddF32(sum, simd::DivF32(thisOctave, ratio)); |
287 | 0 | vec = vec * 2; |
288 | 0 | ratio = simd::MulF32(ratio, simd::FromF32<f32x4_t>(2)); |
289 | 0 |
|
290 | 0 | if (Stitch) { |
291 | 0 | stitchInfo.width *= 2; |
292 | 0 | stitchInfo.wrapX *= 2; |
293 | 0 | stitchInfo.height *= 2; |
294 | 0 | stitchInfo.wrapY *= 2; |
295 | 0 | } |
296 | 0 | } |
297 | 0 |
|
298 | 0 | if (Type == TURBULENCE_TYPE_FRACTAL_NOISE) { |
299 | 0 | sum = simd::DivF32(simd::AddF32(sum, simd::FromF32<f32x4_t>(1)), simd::FromF32<f32x4_t>(2)); |
300 | 0 | } |
301 | 0 | return ColorToBGRA<f32x4_t,i32x4_t,u8x16_t>(sum); |
302 | 0 | } Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::Turbulence(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::Turbulence(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::Turbulence(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::Turbulence(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Turbulence(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Turbulence(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Turbulence(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Turbulence(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const |
303 | | |
304 | | static inline Float |
305 | | MakeNonNegative(Float aValue, Float aIncrementSize) |
306 | 0 | { |
307 | 0 | if (aIncrementSize == 0) { |
308 | 0 | return 0; |
309 | 0 | } |
310 | 0 | if (aValue >= 0) { |
311 | 0 | return aValue; |
312 | 0 | } |
313 | 0 | return aValue + ceilf(-aValue / aIncrementSize) * aIncrementSize; |
314 | 0 | } Unexecuted instantiation: FilterProcessingSSE2.cpp:mozilla::gfx::MakeNonNegative(float, float) Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::MakeNonNegative(float, float) |
315 | | |
316 | | static inline Float |
317 | | FiniteDivide(Float aValue, Float aDivisor) |
318 | 0 | { |
319 | 0 | if (aDivisor == 0) { |
320 | 0 | return 0; |
321 | 0 | } |
322 | 0 | return aValue / aDivisor; |
323 | 0 | } Unexecuted instantiation: FilterProcessingSSE2.cpp:mozilla::gfx::FiniteDivide(float, float) Unexecuted instantiation: Unified_cpp_gfx_2d1.cpp:mozilla::gfx::FiniteDivide(float, float) |
324 | | |
325 | | template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t> |
326 | | Point |
327 | | SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::EquivalentNonNegativeOffset(const Point &aOffset) const |
328 | 0 | { |
329 | 0 | Size basePeriod = Stitch ? Size(mStitchInfo.width, mStitchInfo.height) : |
330 | 0 | Size(sBSize, sBSize); |
331 | 0 | Size repeatingSize(FiniteDivide(basePeriod.width, mBaseFrequency.width), |
332 | 0 | FiniteDivide(basePeriod.height, mBaseFrequency.height)); |
333 | 0 | return Point(MakeNonNegative(aOffset.x, repeatingSize.width), |
334 | 0 | MakeNonNegative(aOffset.y, repeatingSize.height)); |
335 | 0 | } Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::EquivalentNonNegativeOffset(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::EquivalentNonNegativeOffset(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::EquivalentNonNegativeOffset(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::EquivalentNonNegativeOffset(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::EquivalentNonNegativeOffset(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::EquivalentNonNegativeOffset(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::EquivalentNonNegativeOffset(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::EquivalentNonNegativeOffset(mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const |
336 | | |
337 | | template<TurbulenceType Type, bool Stitch, typename f32x4_t, typename i32x4_t, typename u8x16_t> |
338 | | already_AddRefed<DataSourceSurface> |
339 | | SVGTurbulenceRenderer<Type,Stitch,f32x4_t,i32x4_t,u8x16_t>::Render(const IntSize &aSize, const Point &aOffset) const |
340 | 0 | { |
341 | 0 | RefPtr<DataSourceSurface> target = |
342 | 0 | Factory::CreateDataSourceSurface(aSize, SurfaceFormat::B8G8R8A8); |
343 | 0 | if (!target) { |
344 | 0 | return nullptr; |
345 | 0 | } |
346 | 0 | |
347 | 0 | DataSourceSurface::ScopedMap map(target, DataSourceSurface::READ_WRITE); |
348 | 0 | uint8_t* targetData = map.GetData(); |
349 | 0 | uint32_t stride = map.GetStride(); |
350 | 0 |
|
351 | 0 | Point startOffset = EquivalentNonNegativeOffset(aOffset); |
352 | 0 |
|
353 | 0 | for (int32_t y = 0; y < aSize.height; y++) { |
354 | 0 | for (int32_t x = 0; x < aSize.width; x += 4) { |
355 | 0 | int32_t targIndex = y * stride + x * 4; |
356 | 0 | i32x4_t a = Turbulence(startOffset + Point(x, y)); |
357 | 0 | i32x4_t b = Turbulence(startOffset + Point(x + 1, y)); |
358 | 0 | i32x4_t c = Turbulence(startOffset + Point(x + 2, y)); |
359 | 0 | i32x4_t d = Turbulence(startOffset + Point(x + 3, y)); |
360 | 0 | u8x16_t result1234 = simd::PackAndSaturate32To8(a, b, c, d); |
361 | 0 | simd::Store8(&targetData[targIndex], result1234); |
362 | 0 | } |
363 | 0 | } |
364 | 0 |
|
365 | 0 | return target.forget(); |
366 | 0 | } Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, float __vector(4), long long __vector(2), long long __vector(2)>::Render(mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, float __vector(4), long long __vector(2), long long __vector(2)>::Render(mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, float __vector(4), long long __vector(2), long long __vector(2)>::Render(mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, float __vector(4), long long __vector(2), long long __vector(2)>::Render(mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Render(mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)0, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Render(mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, true, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Render(mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const Unexecuted instantiation: mozilla::gfx::SVGTurbulenceRenderer<(mozilla::gfx::TurbulenceType)1, false, mozilla::gfx::simd::Scalarf32x4_t, mozilla::gfx::simd::Scalari32x4_t, mozilla::gfx::simd::Scalaru8x16_t>::Render(mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float> const&) const |
367 | | |
368 | | } // namespace gfx |
369 | | } // namespace mozilla |