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

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

Issue 1721223002: simplify/unify xferproc api (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/core/SkSpriteBlitter4f.cpp ('k') | src/core/SkXfermode4f.cpp » ('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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkXfermode.h" 8 #include "SkXfermode.h"
9 #include "SkXfermode_proccoeff.h" 9 #include "SkXfermode_proccoeff.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 x.store(pm4.fVec); 921 x.store(pm4.fVec);
922 return pm4; 922 return pm4;
923 } 923 }
924 924
925 static Sk4f as_4f(const SkPM4f& pm4) { 925 static Sk4f as_4f(const SkPM4f& pm4) {
926 return Sk4f::Load(pm4.fVec); 926 return Sk4f::Load(pm4.fVec);
927 } 927 }
928 928
929 static void assert_unit(const SkPM4f& r) { 929 static void assert_unit(const SkPM4f& r) {
930 #ifdef SK_DEBUG 930 #ifdef SK_DEBUG
931 const float min = 0; 931 const float eps = 0.00001f;
932 const float max = 1; 932 const float min = 0 - eps;
933 const float max = 1 + eps;
933 for (int i = 0; i < 4; ++i) { 934 for (int i = 0; i < 4; ++i) {
934 SkASSERT(r.fVec[i] >= min && r.fVec[i] <= max); 935 SkASSERT(r.fVec[i] >= min && r.fVec[i] <= max);
935 } 936 }
936 #endif 937 #endif
937 } 938 }
938 939
939 template <Sk4f (blend)(const Sk4f&, const Sk4f&)> SkPM4f proc_4f(const SkPM4f& s , const SkPM4f& d) { 940 template <Sk4f (blend)(const Sk4f&, const Sk4f&)> SkPM4f proc_4f(const SkPM4f& s , const SkPM4f& d) {
940 assert_unit(s); 941 assert_unit(s);
941 assert_unit(d); 942 assert_unit(d);
942 SkPM4f r = as_pm4f(blend(as_4f(s), as_4f(d))); 943 SkPM4f r = as_pm4f(blend(as_4f(s), as_4f(d)));
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 if (!xfer) { 1410 if (!xfer) {
1410 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; 1411 return SkXfermode::kOpaque_SrcColorOpacity == opacityType;
1411 } 1412 }
1412 1413
1413 return xfer->isOpaque(opacityType); 1414 return xfer->isOpaque(opacityType);
1414 } 1415 }
1415 1416
1416 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1417 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1417 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1418 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1418 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1419 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkSpriteBlitter4f.cpp ('k') | src/core/SkXfermode4f.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698