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

Side by Side Diff: tests/SwizzlerTest.cpp

Issue 1626463002: Refactor swizzle names and types. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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
« src/opts/SkSwizzler_opts.h ('K') | « src/opts/SkSwizzler_opts.h ('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 2015 Google Inc. 2 * Copyright 2015 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 "SkSwizzler.h" 8 #include "SkSwizzler.h"
9 #include "Test.h" 9 #include "Test.h"
10 #include "SkOpts.h" 10 #include "SkOpts.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 } 126 }
127 } 127 }
128 128
129 DEF_TEST(SwizzleOpts, r) { 129 DEF_TEST(SwizzleOpts, r) {
130 uint32_t dst, src; 130 uint32_t dst, src;
131 131
132 // forall c, c*255 == c, c*0 == 0 132 // forall c, c*255 == c, c*0 == 0
133 for (int c = 0; c <= 255; c++) { 133 for (int c = 0; c <= 255; c++) {
134 src = (255<<24) | c; 134 src = (255<<24) | c;
135 SkOpts::premul_xxxa(&dst, &src, 1); 135 SkOpts::RGBA_to_rgbA(&dst, &src, 1);
136 REPORTER_ASSERT(r, dst == src); 136 REPORTER_ASSERT(r, dst == src);
137 SkOpts::premul_swaprb_xxxa(&dst, &src, 1); 137 SkOpts::RGBA_to_bgrA(&dst, &src, 1);
138 REPORTER_ASSERT(r, dst == (uint32_t)((255<<24) | (c<<16))); 138 REPORTER_ASSERT(r, dst == (uint32_t)((255<<24) | (c<<16)));
139 139
140 src = (0<<24) | c; 140 src = (0<<24) | c;
141 SkOpts::premul_xxxa(&dst, &src, 1); 141 SkOpts::RGBA_to_rgbA(&dst, &src, 1);
142 REPORTER_ASSERT(r, dst == 0); 142 REPORTER_ASSERT(r, dst == 0);
143 SkOpts::premul_swaprb_xxxa(&dst, &src, 1); 143 SkOpts::RGBA_to_bgrA(&dst, &src, 1);
144 REPORTER_ASSERT(r, dst == 0); 144 REPORTER_ASSERT(r, dst == 0);
145 } 145 }
146 146
147 // check a totally arbitrary color 147 // check a totally arbitrary color
148 src = 0xFACEB004; 148 src = 0xFACEB004;
149 SkOpts::premul_xxxa(&dst, &src, 1); 149 SkOpts::RGBA_to_rgbA(&dst, &src, 1);
150 REPORTER_ASSERT(r, dst == 0xFACAAD04); 150 REPORTER_ASSERT(r, dst == 0xFACAAD04);
151 151
152 // swap red and blue 152 // swap red and blue
153 SkOpts::swaprb_xxxa(&dst, &src, 1); 153 SkOpts::RGBA_to_BGRA(&dst, &src, 1);
154 REPORTER_ASSERT(r, dst == 0xFA04B0CE); 154 REPORTER_ASSERT(r, dst == 0xFA04B0CE);
155 155
156 // all together now 156 // all together now
157 SkOpts::premul_swaprb_xxxa(&dst, &src, 1); 157 SkOpts::RGBA_to_bgrA(&dst, &src, 1);
158 REPORTER_ASSERT(r, dst == 0xFA04ADCA); 158 REPORTER_ASSERT(r, dst == 0xFA04ADCA);
159 } 159 }
OLDNEW
« src/opts/SkSwizzler_opts.h ('K') | « src/opts/SkSwizzler_opts.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698