#include "src/core/SkOpts.h"
#include "tests/Test.h"
#include <algorithm>
#include <array>
#include <cstddef>
#include "src/opts/SkRasterPipeline_opts.h"
Go to the source code of this file.
|
template<size_t N> |
static std::array< int32_t, N > | make_masks (int bits) |
|
| DEF_TEST (SkRasterPipelineOpts_Any, r) |
|
| DEF_TEST (SkRasterPipelineOpts_All, r) |
|
| DEF_TEST (SkRasterPipelineOpts_Sin, r) |
|
| DEF_TEST (SkRasterPipelineOpts_Cos, r) |
|
| DEF_TEST (SkRasterPipelineOpts_Tan, r) |
|
| DEF_TEST (SkRasterPipelineOpts_Asin, r) |
|
| DEF_TEST (SkRasterPipelineOpts_Acos, r) |
|
| DEF_TEST (SkRasterPipelineOpts_Atan, r) |
|
| DEF_TEST (SkRasterPipelineOpts_Atan2, r) |
|
| DEF_TEST (SkRasterPipelineOpts_Log2, r) |
|
| DEF_TEST (SkRasterPipelineOpts_Pow2, r) |
|
|
constexpr auto | F_ = SK_OPTS_NS::F_ |
|
◆ SK_OPTS_NS
#define SK_OPTS_NS RPOptsTest |
◆ I32
◆ DEF_TEST() [1/11]
DEF_TEST |
( |
SkRasterPipelineOpts_Acos |
, |
|
|
r |
|
|
) |
| |
Definition at line 132 of file SkRasterPipelineOptsTest.cpp.
132 {
134 for (
float x = -1;
x <= 1;
x += 1.0f/64) {
136 F expected =
F_(acosf(
x));
138
140 }
141}
static constexpr float kTolerance
#define REPORTER_ASSERT(r, cond,...)
◆ DEF_TEST() [2/11]
DEF_TEST |
( |
SkRasterPipelineOpts_All |
, |
|
|
r |
|
|
) |
| |
Definition at line 64 of file SkRasterPipelineOptsTest.cpp.
64 {
65 static constexpr size_t N =
sizeof(
I32) /
sizeof(int32_t);
66
68
69 std::array<int32_t, N> masks = make_masks<N>(
value);
70 I32 i = sk_unaligned_load<I32>(masks.data());
71
72
74 [](int32_t
m) { return m != 0; }));
75 }
76}
◆ DEF_TEST() [3/11]
DEF_TEST |
( |
SkRasterPipelineOpts_Any |
, |
|
|
r |
|
|
) |
| |
Definition at line 50 of file SkRasterPipelineOptsTest.cpp.
50 {
51 static constexpr size_t N =
sizeof(
I32) /
sizeof(int32_t);
52
54
55 std::array<int32_t, N> masks = make_masks<N>(
value);
56 I32 i = sk_unaligned_load<I32>(masks.data());
57
58
60 [](int32_t
m) { return m != 0; }));
61 }
62}
◆ DEF_TEST() [4/11]
DEF_TEST |
( |
SkRasterPipelineOpts_Asin |
, |
|
|
r |
|
|
) |
| |
◆ DEF_TEST() [5/11]
DEF_TEST |
( |
SkRasterPipelineOpts_Atan |
, |
|
|
r |
|
|
) |
| |
◆ DEF_TEST() [6/11]
DEF_TEST |
( |
SkRasterPipelineOpts_Atan2 |
, |
|
|
r |
|
|
) |
| |
Definition at line 154 of file SkRasterPipelineOptsTest.cpp.
154 {
156 for (
float y = -3.0f;
y <= 3.0f;
y += 0.1f) {
157 for (
float x = -3.0f;
x <= 3.0f;
x += 0.1f) {
159 F expected =
F_(std::atan2(
y,
x));
161
163 }
164 }
165}
◆ DEF_TEST() [7/11]
DEF_TEST |
( |
SkRasterPipelineOpts_Cos |
, |
|
|
r |
|
|
) |
| |
Definition at line 90 of file SkRasterPipelineOptsTest.cpp.
90 {
93 for (float rad = -5*Pi; rad <= 5*Pi; rad += 0.1f) {
95 F expected =
F_(std::cos(rad));
97
99 }
100}
◆ DEF_TEST() [8/11]
DEF_TEST |
( |
SkRasterPipelineOpts_Log2 |
, |
|
|
r |
|
|
) |
| |
◆ DEF_TEST() [9/11]
DEF_TEST |
( |
SkRasterPipelineOpts_Pow2 |
, |
|
|
r |
|
|
) |
| |
◆ DEF_TEST() [10/11]
DEF_TEST |
( |
SkRasterPipelineOpts_Sin |
, |
|
|
r |
|
|
) |
| |
Definition at line 78 of file SkRasterPipelineOptsTest.cpp.
78 {
81 for (float rad = -5*Pi; rad <= 5*Pi; rad += 0.1f) {
83 F expected =
F_(std::sin(rad));
85
87 }
88}
◆ DEF_TEST() [11/11]
DEF_TEST |
( |
SkRasterPipelineOpts_Tan |
, |
|
|
r |
|
|
) |
| |
Definition at line 102 of file SkRasterPipelineOptsTest.cpp.
102 {
103
104
108
109
110 for (float period : {0.0f, -3*Pi, 3*Pi}) {
113 F expected =
F_(std::tan(rad));
115
117 }
118 }
119}
static constexpr double kEpsilon
◆ make_masks()
template<size_t N>
static std::array< int32_t, N > make_masks |
( |
int |
bits | ) |
|
|
static |
Definition at line 39 of file SkRasterPipelineOptsTest.cpp.
39 {
40
41 std::array<int32_t, N> masks;
42 for (
size_t idx = 0; idx <
N; ++idx) {
43 masks[idx] = (
bits & 1) ? ~0 : 0;
45 }
47 return masks;
48}
◆ F_
constexpr auto F_ = SK_OPTS_NS::F_ |
|
constexpr |