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

Side by Side Diff: src/effects/SkColorMatrixFilter.cpp

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/core/SkNx.h ('k') | src/opts/SkColorCubeFilter_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 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkColorMatrixFilter.h" 8 #include "SkColorMatrixFilter.h"
9 #include "SkColorMatrix.h" 9 #include "SkColorMatrix.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 dst[i] = matrix_translate_pmcolor; 295 dst[i] = matrix_translate_pmcolor;
296 continue; 296 continue;
297 } 297 }
298 298
299 Sk4f srcf = Sk4f::FromBytes((const uint8_t*)&src_c) * Sk4f(1.0f/255) ; 299 Sk4f srcf = Sk4f::FromBytes((const uint8_t*)&src_c) * Sk4f(1.0f/255) ;
300 300
301 if (0xFF != SkGetPackedA32(src_c)) { 301 if (0xFF != SkGetPackedA32(src_c)) {
302 srcf = unpremul(srcf); 302 srcf = unpremul(srcf);
303 } 303 }
304 304
305 Sk4f r4 = Sk4f(srcf.kth<SK_R32_SHIFT/8>()); 305 Sk4f r4 = SkNx_dup<SK_R32_SHIFT/8>(srcf);
306 Sk4f g4 = Sk4f(srcf.kth<SK_G32_SHIFT/8>()); 306 Sk4f g4 = SkNx_dup<SK_G32_SHIFT/8>(srcf);
307 Sk4f b4 = Sk4f(srcf.kth<SK_B32_SHIFT/8>()); 307 Sk4f b4 = SkNx_dup<SK_B32_SHIFT/8>(srcf);
308 Sk4f a4 = Sk4f(srcf.kth<SK_A32_SHIFT/8>()); 308 Sk4f a4 = SkNx_dup<SK_A32_SHIFT/8>(srcf);
309 309
310 // apply matrix 310 // apply matrix
311 Sk4f dst4 = c0 * r4 + c1 * g4 + c2 * b4 + c3 * a4 + c4; 311 Sk4f dst4 = c0 * r4 + c1 * g4 + c2 * b4 + c3 * a4 + c4;
312 312
313 // clamp, re-premul, and write 313 // clamp, re-premul, and write
314 dst[i] = round(premul(clamp_0_1(dst4))); 314 dst[i] = round(premul(clamp_0_1(dst4)));
315 } 315 }
316 } else { 316 } else {
317 const State& state = fState; 317 const State& state = fState;
318 int32_t result[4]; 318 int32_t result[4];
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 str->append("matrix: ("); 560 str->append("matrix: (");
561 for (int i = 0; i < 20; ++i) { 561 for (int i = 0; i < 20; ++i) {
562 str->appendScalar(fMatrix.fMat[i]); 562 str->appendScalar(fMatrix.fMat[i]);
563 if (i < 19) { 563 if (i < 19) {
564 str->append(", "); 564 str->append(", ");
565 } 565 }
566 } 566 }
567 str->append(")"); 567 str->append(")");
568 } 568 }
569 #endif 569 #endif
OLDNEW
« no previous file with comments | « src/core/SkNx.h ('k') | src/opts/SkColorCubeFilter_opts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698