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

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

Issue 768183002: Revert of 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
85 /////////////////////////////////////////////////////////////////////////////// 92 ///////////////////////////////////////////////////////////////////////////////
86 93
87 void SkTableMaskFilter::MakeGammaTable(uint8_t table[256], SkScalar gamma) { 94 void SkTableMaskFilter::MakeGammaTable(uint8_t table[256], SkScalar gamma) {
88 const float dx = 1 / 255.0f; 95 const float dx = 1 / 255.0f;
89 const float g = SkScalarToFloat(gamma); 96 const float g = SkScalarToFloat(gamma);
90 97
91 float x = 0; 98 float x = 0;
92 for (int i = 0; i < 256; i++) { 99 for (int i = 0; i < 256; i++) {
93 // float ee = powf(x, g) * 255; 100 // float ee = powf(x, g) * 255;
94 table[i] = SkPin32(sk_float_round2int(powf(x, g) * 255), 0, 255); 101 table[i] = SkPin32(sk_float_round2int(powf(x, g) * 255), 0, 255);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 143
137 str->append("table: "); 144 str->append("table: ");
138 for (int i = 0; i < 255; ++i) { 145 for (int i = 0; i < 255; ++i) {
139 str->appendf("%d, ", fTable[i]); 146 str->appendf("%d, ", fTable[i]);
140 } 147 }
141 str->appendf("%d", fTable[255]); 148 str->appendf("%d", fTable[255]);
142 149
143 str->append(")"); 150 str->append(")");
144 } 151 }
145 #endif 152 #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