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

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

Issue 1314583003: Replace SkPin32 with SkTPin and remove. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add comment. 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 "SkTableMaskFilter.h" 10 #include "SkTableMaskFilter.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 /////////////////////////////////////////////////////////////////////////////// 85 ///////////////////////////////////////////////////////////////////////////////
86 86
87 void SkTableMaskFilter::MakeGammaTable(uint8_t table[256], SkScalar gamma) { 87 void SkTableMaskFilter::MakeGammaTable(uint8_t table[256], SkScalar gamma) {
88 const float dx = 1 / 255.0f; 88 const float dx = 1 / 255.0f;
89 const float g = SkScalarToFloat(gamma); 89 const float g = SkScalarToFloat(gamma);
90 90
91 float x = 0; 91 float x = 0;
92 for (int i = 0; i < 256; i++) { 92 for (int i = 0; i < 256; i++) {
93 // float ee = powf(x, g) * 255; 93 // float ee = powf(x, g) * 255;
94 table[i] = SkPin32(sk_float_round2int(powf(x, g) * 255), 0, 255); 94 table[i] = SkTPin(sk_float_round2int(powf(x, g) * 255), 0, 255);
95 x += dx; 95 x += dx;
96 } 96 }
97 } 97 }
98 98
99 void SkTableMaskFilter::MakeClipTable(uint8_t table[256], uint8_t min, 99 void SkTableMaskFilter::MakeClipTable(uint8_t table[256], uint8_t min,
100 uint8_t max) { 100 uint8_t max) {
101 if (0 == max) { 101 if (0 == max) {
102 max = 1; 102 max = 1;
103 } 103 }
104 if (min >= max) { 104 if (min >= max) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 str->append("table: "); 137 str->append("table: ");
138 for (int i = 0; i < 255; ++i) { 138 for (int i = 0; i < 255; ++i) {
139 str->appendf("%d, ", fTable[i]); 139 str->appendf("%d, ", fTable[i]);
140 } 140 }
141 str->appendf("%d", fTable[255]); 141 str->appendf("%d", fTable[255]);
142 142
143 str->append(")"); 143 str->append(")");
144 } 144 }
145 #endif 145 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | src/effects/gradients/SkRadialGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698