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

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

Issue 769953002: Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/SkTableColorFilter.cpp ('k') | src/effects/SkTestImageFilters.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 /* 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 76
77 SkFlattenable* SkTableMaskFilter::CreateProc(SkReadBuffer& buffer) { 77 SkFlattenable* SkTableMaskFilter::CreateProc(SkReadBuffer& buffer) {
78 uint8_t table[256]; 78 uint8_t table[256];
79 if (!buffer.readByteArray(table, 256)) { 79 if (!buffer.readByteArray(table, 256)) {
80 return NULL; 80 return NULL;
81 } 81 }
82 return Create(table); 82 return Create(table);
83 } 83 }
84 84
85 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
86 SkTableMaskFilter::SkTableMaskFilter(SkReadBuffer& rb) : INHERITED(rb) {
87 SkASSERT(256 == rb.getArrayCount());
88 rb.readByteArray(fTable, 256);
89 }
90 #endif
91
92 /////////////////////////////////////////////////////////////////////////////// 85 ///////////////////////////////////////////////////////////////////////////////
93 86
94 void SkTableMaskFilter::MakeGammaTable(uint8_t table[256], SkScalar gamma) { 87 void SkTableMaskFilter::MakeGammaTable(uint8_t table[256], SkScalar gamma) {
95 const float dx = 1 / 255.0f; 88 const float dx = 1 / 255.0f;
96 const float g = SkScalarToFloat(gamma); 89 const float g = SkScalarToFloat(gamma);
97 90
98 float x = 0; 91 float x = 0;
99 for (int i = 0; i < 256; i++) { 92 for (int i = 0; i < 256; i++) {
100 // float ee = powf(x, g) * 255; 93 // float ee = powf(x, g) * 255;
101 table[i] = SkPin32(sk_float_round2int(powf(x, g) * 255), 0, 255); 94 table[i] = SkPin32(sk_float_round2int(powf(x, g) * 255), 0, 255);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 136
144 str->append("table: "); 137 str->append("table: ");
145 for (int i = 0; i < 255; ++i) { 138 for (int i = 0; i < 255; ++i) {
146 str->appendf("%d, ", fTable[i]); 139 str->appendf("%d, ", fTable[i]);
147 } 140 }
148 str->appendf("%d", fTable[255]); 141 str->appendf("%d", fTable[255]);
149 142
150 str->append(")"); 143 str->append(")");
151 } 144 }
152 #endif 145 #endif
OLDNEW
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/effects/SkTestImageFilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698