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

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

Issue 1061603002: Code's more readable when SkPMFloat is an Sk4f. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fix neon Created 5 years, 8 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/SkXfermode.cpp ('k') | src/opts/SkNx_neon.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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 #ifdef SK_DEBUG 262 #ifdef SK_DEBUG
263 SkPMFloat pmf(pm); 263 SkPMFloat pmf(pm);
264 SkASSERT(pmf.isValid()); 264 SkASSERT(pmf.isValid());
265 #endif 265 #endif
266 266
267 return pm; 267 return pm;
268 } 268 }
269 269
270 static Sk4f unpremul(const SkPMFloat& pm) { 270 static Sk4f unpremul(const SkPMFloat& pm) {
271 float scale = 255 / pm.a(); // candidate for fast/approx invert? 271 float scale = 255 / pm.a(); // candidate for fast/approx invert?
272 return Sk4f(pm) * Sk4f(scale, scale, scale, 1); 272 return pm * Sk4f(scale, scale, scale, 1);
273 } 273 }
274 274
275 static Sk4f clamp_0_255(const Sk4f& value) { 275 static Sk4f clamp_0_255(const Sk4f& value) {
276 return Sk4f::Max(Sk4f::Min(value, Sk4f(255)), Sk4f(0)); 276 return Sk4f::Max(Sk4f::Min(value, Sk4f(255)), Sk4f(0));
277 } 277 }
278 278
279 void SkColorMatrixFilter::filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const { 279 void SkColorMatrixFilter::filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const {
280 Proc proc = fProc; 280 Proc proc = fProc;
281 if (NULL == proc) { 281 if (NULL == proc) {
282 if (src != dst) { 282 if (src != dst) {
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 str->append("matrix: ("); 577 str->append("matrix: (");
578 for (int i = 0; i < 20; ++i) { 578 for (int i = 0; i < 20; ++i) {
579 str->appendScalar(fMatrix.fMat[i]); 579 str->appendScalar(fMatrix.fMat[i]);
580 if (i < 19) { 580 if (i < 19) {
581 str->append(", "); 581 str->append(", ");
582 } 582 }
583 } 583 }
584 str->append(")"); 584 str->append(")");
585 } 585 }
586 #endif 586 #endif
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/opts/SkNx_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698