Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: tests/SkBlend_optsTest.cpp

Issue 2002423002: [GN] Add support for disabling opts via SK_BUILD_NO_OPTS define. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkOpts.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include <string> 8 #include <string>
9 #include <tuple> 9 #include <tuple>
10 #include <vector> 10 #include <vector>
(...skipping 17 matching lines...) Expand all
28 extern void trivial_srcover_srgb_srgb( 28 extern void trivial_srcover_srgb_srgb(
29 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); 29 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
30 30
31 extern void best_non_simd_srcover_srgb_srgb( 31 extern void best_non_simd_srcover_srgb_srgb(
32 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); 32 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
33 33
34 extern void srcover_srgb_srgb( 34 extern void srcover_srgb_srgb(
35 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); 35 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
36 } 36 }
37 37
38 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) 38 #if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS)
39 namespace sk_sse41 { 39 namespace sk_sse41 {
40 extern void srcover_srgb_srgb( 40 extern void srcover_srgb_srgb(
41 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); 41 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
42 } 42 }
43 #endif 43 #endif
44 44
45 static SkString missmatch_message(std::string resourceName, std::string name, in t x, int y, 45 static SkString missmatch_message(std::string resourceName, std::string name, in t x, int y,
46 uint32_t src, uint32_t good, uint32_t bad) { 46 uint32_t src, uint32_t good, uint32_t bad) {
47 return SkStringPrintf( 47 return SkStringPrintf(
48 "%s - %s missmatch at %d, %d src: %08x good: %08x bad: %08x", 48 "%s - %s missmatch at %d, %d src: %08x good: %08x bad: %08x",
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 src += width; 97 src += width;
98 } 98 }
99 } 99 }
100 100
101 DEF_TEST(SkBlend_optsCheck, reporter) { 101 DEF_TEST(SkBlend_optsCheck, reporter) {
102 std::vector<Spec> specs = { 102 std::vector<Spec> specs = {
103 Spec{sk_default::trivial_srcover_srgb_srgb, "trivial"}, 103 Spec{sk_default::trivial_srcover_srgb_srgb, "trivial"},
104 Spec{sk_default::best_non_simd_srcover_srgb_srgb, "best_non_simd"}, 104 Spec{sk_default::best_non_simd_srcover_srgb_srgb, "best_non_simd"},
105 Spec{sk_default::srcover_srgb_srgb, "default"}, 105 Spec{sk_default::srcover_srgb_srgb, "default"},
106 }; 106 };
107 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) 107 #if defined(SK_CPU_X86) && !defined(SK_BUILD_NO_OPTS)
108 if (SkCpu::Supports(SkCpu::SSE41)) { 108 if (SkCpu::Supports(SkCpu::SSE41)) {
109 specs.push_back(Spec{sk_sse41::srcover_srgb_srgb, "sse41", }); 109 specs.push_back(Spec{sk_sse41::srcover_srgb_srgb, "sse41", });
110 } 110 }
111 #endif 111 #endif
112 112
113 std::vector<std::string> testResources = { 113 std::vector<std::string> testResources = {
114 "yellow_rose", "baby_tux", "plane", "mandrill_512", "iconstrip" 114 "yellow_rose", "baby_tux", "plane", "mandrill_512", "iconstrip"
115 }; 115 };
116 116
117 for (auto& spec : specs) { 117 for (auto& spec : specs) {
118 for (auto& resourceName : testResources) { 118 for (auto& resourceName : testResources) {
119 test_blender(spec, resourceName, reporter); 119 test_blender(spec, resourceName, reporter);
120 } 120 }
121 } 121 }
122 } 122 }
123 123
124 124
125 125
126 DEF_TEST(SkBlend_optsSqrtCheck, reporter) { 126 DEF_TEST(SkBlend_optsSqrtCheck, reporter) {
127 for (int c = 0; c < 256; c++) { 127 for (int c = 0; c < 256; c++) {
128 Sk4f i{(float)c}; 128 Sk4f i{(float)c};
129 Sk4f ii = i * i; 129 Sk4f ii = i * i;
130 Sk4f s = ii.sqrt() + 0.5f; 130 Sk4f s = ii.sqrt() + 0.5f;
131 Sk4f sf = s.floor(); 131 Sk4f sf = s.floor();
132 REPORTER_ASSERT_MESSAGE( 132 REPORTER_ASSERT_MESSAGE(
133 reporter, i[0] == sf[0], SkStringPrintf("i: %f, s: %f", i[0], sf[0]) ); 133 reporter, i[0] == sf[0], SkStringPrintf("i: %f, s: %f", i[0], sf[0]) );
134 } 134 }
135 } 135 }
OLDNEW
« no previous file with comments | « src/core/SkOpts.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698