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

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

Issue 1301413006: SkNx_shuffle (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: dup Created 5 years, 3 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/effects/SkColorMatrixFilter.cpp ('k') | src/opts/SkXfermode_opts.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SkColorCubeFilter_opts_DEFINED 5 #ifndef SkColorCubeFilter_opts_DEFINED
6 #define SkColorCubeFilter_opts_DEFINED 6 #define SkColorCubeFilter_opts_DEFINED
7 7
8 #include "SkColor.h" 8 #include "SkColor.h"
9 #include "SkNx.h" 9 #include "SkNx.h"
10 #include "SkUnPreMultiply.h" 10 #include "SkUnPreMultiply.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 sum = sum + Sk4f::FromBytes((const uint8_t*)&lutColor10) * g1b0; 64 sum = sum + Sk4f::FromBytes((const uint8_t*)&lutColor10) * g1b0;
65 sum = sum + Sk4f::FromBytes((const uint8_t*)&lutColor11) * g1b1; 65 sum = sum + Sk4f::FromBytes((const uint8_t*)&lutColor11) * g1b1;
66 color = color + sum * Sk4f((float)colorToFactors[x][r]); 66 color = color + sum * Sk4f((float)colorToFactors[x][r]);
67 } 67 }
68 if (a != 255) { 68 if (a != 255) {
69 color = color * Sk4f(a * (1.0f/255)); 69 color = color * Sk4f(a * (1.0f/255));
70 } 70 }
71 71
72 // color is BGRA (SkColor order), dst is SkPMColor order, so may need to swap R+B. 72 // color is BGRA (SkColor order), dst is SkPMColor order, so may need to swap R+B.
73 #if defined(SK_PMCOLOR_IS_RGBA) 73 #if defined(SK_PMCOLOR_IS_RGBA)
74 color = Sk4f(color.kth<2>(), color.kth<1>(), color.kth<0>(), color.kth<3 >()); 74 color = SkNx_shuffle<2,1,0,3>(color);
75 #endif 75 #endif
76 uint8_t* dstBytes = (uint8_t*)(dst+i); 76 uint8_t* dstBytes = (uint8_t*)(dst+i);
77 color.toBytes(dstBytes); 77 color.toBytes(dstBytes);
78 dstBytes[SK_A32_SHIFT/8] = a; 78 dstBytes[SK_A32_SHIFT/8] = a;
79 } 79 }
80 } 80 }
81 81
82 } // namespace SK_OPTS NS 82 } // namespace SK_OPTS NS
83 83
84 #endif // SkColorCubeFilter_opts_DEFINED 84 #endif // SkColorCubeFilter_opts_DEFINED
OLDNEW
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/opts/SkXfermode_opts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698