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

Side by Side Diff: src/opts/SkXfermode_opts.h

Issue 1650653002: SkNx Load/store: take any pointer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify call sites Created 4 years, 10 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/opts/SkNx_sse.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 #ifndef Sk4pxXfermode_DEFINED 8 #ifndef Sk4pxXfermode_DEFINED
9 #define Sk4pxXfermode_DEFINED 9 #define Sk4pxXfermode_DEFINED
10 10
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 s = Load(src), 278 s = Load(src),
279 b = Xfermode()(d, s); 279 b = Xfermode()(d, s);
280 if (aa) { 280 if (aa) {
281 Sk4f a = Sk4f(*aa) * Sk4f(1.0f/255); 281 Sk4f a = Sk4f(*aa) * Sk4f(1.0f/255);
282 b = b*a + d*(Sk4f(1)-a); 282 b = b*a + d*(Sk4f(1)-a);
283 } 283 }
284 return Round(b); 284 return Round(b);
285 } 285 }
286 286
287 static Sk4f Load(SkPMColor c) { 287 static Sk4f Load(SkPMColor c) {
288 return SkNx_cast<float>(Sk4b::Load((uint8_t*)&c)) * Sk4f(1.0f/255); 288 return SkNx_cast<float>(Sk4b::Load(&c)) * Sk4f(1.0f/255);
289 } 289 }
290 290
291 static SkPMColor Round(const Sk4f& f) { 291 static SkPMColor Round(const Sk4f& f) {
292 SkPMColor c; 292 SkPMColor c;
293 SkNx_cast<uint8_t>(f * Sk4f(255) + Sk4f(0.5f)).store((uint8_t*)&c); 293 SkNx_cast<uint8_t>(f * Sk4f(255) + Sk4f(0.5f)).store(&c);
294 return c; 294 return c;
295 } 295 }
296 296
297 typedef SkProcCoeffXfermode INHERITED; 297 typedef SkProcCoeffXfermode INHERITED;
298 }; 298 };
299 299
300 } // namespace 300 } // namespace
301 301
302 namespace SK_OPTS_NS { 302 namespace SK_OPTS_NS {
303 303
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 #undef CASE 337 #undef CASE
338 338
339 default: break; 339 default: break;
340 } 340 }
341 return nullptr; 341 return nullptr;
342 } 342 }
343 343
344 } // namespace SK_OPTS_NS 344 } // namespace SK_OPTS_NS
345 345
346 #endif//Sk4pxXfermode_DEFINED 346 #endif//Sk4pxXfermode_DEFINED
OLDNEW
« no previous file with comments | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698