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

Side by Side Diff: src/core/SkXfermode.cpp

Issue 18112016: ARM Skia NEON patches - 07 - Equation simplification (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove 'sa' and 'da' from the function signature. Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkXfermode.h" 10 #include "SkXfermode.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 int sa = SkGetPackedA32(src); 393 int sa = SkGetPackedA32(src);
394 int da = SkGetPackedA32(dst); 394 int da = SkGetPackedA32(dst);
395 int a = srcover_byte(sa, da); 395 int a = srcover_byte(sa, da);
396 int r = difference_byte(SkGetPackedR32(src), SkGetPackedR32(dst), sa, da); 396 int r = difference_byte(SkGetPackedR32(src), SkGetPackedR32(dst), sa, da);
397 int g = difference_byte(SkGetPackedG32(src), SkGetPackedG32(dst), sa, da); 397 int g = difference_byte(SkGetPackedG32(src), SkGetPackedG32(dst), sa, da);
398 int b = difference_byte(SkGetPackedB32(src), SkGetPackedB32(dst), sa, da); 398 int b = difference_byte(SkGetPackedB32(src), SkGetPackedB32(dst), sa, da);
399 return SkPackARGB32(a, r, g, b); 399 return SkPackARGB32(a, r, g, b);
400 } 400 }
401 401
402 // kExclusion_Mode 402 // kExclusion_Mode
403 static inline int exclusion_byte(int sc, int dc, int sa, int da) { 403 static inline int exclusion_byte(int sc, int dc, int, int) {
404 // this equations is wacky, wait for SVG to confirm it 404 // this equations is wacky, wait for SVG to confirm it
405 int r = sc * da + dc * sa - 2 * sc * dc + sc * (255 - da) + dc * (255 - sa); 405 //int r = sc * da + dc * sa - 2 * sc * dc + sc * (255 - da) + dc * (255 - sa );
406
407 // The above equation can be simplified as follows
408 int r = 255*(sc + dc) - 2 * sc * dc;
406 return clamp_div255round(r); 409 return clamp_div255round(r);
407 } 410 }
408 static SkPMColor exclusion_modeproc(SkPMColor src, SkPMColor dst) { 411 static SkPMColor exclusion_modeproc(SkPMColor src, SkPMColor dst) {
409 int sa = SkGetPackedA32(src); 412 int sa = SkGetPackedA32(src);
410 int da = SkGetPackedA32(dst); 413 int da = SkGetPackedA32(dst);
411 int a = srcover_byte(sa, da); 414 int a = srcover_byte(sa, da);
412 int r = exclusion_byte(SkGetPackedR32(src), SkGetPackedR32(dst), sa, da); 415 int r = exclusion_byte(SkGetPackedR32(src), SkGetPackedR32(dst), sa, da);
413 int g = exclusion_byte(SkGetPackedG32(src), SkGetPackedG32(dst), sa, da); 416 int g = exclusion_byte(SkGetPackedG32(src), SkGetPackedG32(dst), sa, da);
414 int b = exclusion_byte(SkGetPackedB32(src), SkGetPackedB32(dst), sa, da); 417 int b = exclusion_byte(SkGetPackedB32(src), SkGetPackedB32(dst), sa, da);
415 return SkPackARGB32(a, r, g, b); 418 return SkPackARGB32(a, r, g, b);
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 return proc16; 1971 return proc16;
1969 } 1972 }
1970 1973
1971 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1974 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1972 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1975 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1973 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode) 1976 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode)
1974 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) 1977 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode)
1975 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) 1978 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode)
1976 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) 1979 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode)
1977 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1980 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698