| OLD | NEW |
| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SkTableMaskFilter::flatten(SkFlattenableWriteBuffer& wb) const { | 72 void SkTableMaskFilter::flatten(SkFlattenableWriteBuffer& wb) const { |
| 73 this->INHERITED::flatten(wb); | 73 this->INHERITED::flatten(wb); |
| 74 wb.writeByteArray(fTable, 256); | 74 wb.writeByteArray(fTable, 256); |
| 75 } | 75 } |
| 76 | 76 |
| 77 SkTableMaskFilter::SkTableMaskFilter(SkFlattenableReadBuffer& rb) | 77 SkTableMaskFilter::SkTableMaskFilter(SkFlattenableReadBuffer& rb) |
| 78 : INHERITED(rb) { | 78 : INHERITED(rb) { |
| 79 SkASSERT(256 == rb.getArrayCount()); | 79 SkASSERT(256 == rb.getArrayCount()); |
| 80 rb.readByteArray(fTable); | 80 rb.readByteArray(fTable, 256); |
| 81 } | 81 } |
| 82 | 82 |
| 83 /////////////////////////////////////////////////////////////////////////////// | 83 /////////////////////////////////////////////////////////////////////////////// |
| 84 | 84 |
| 85 void SkTableMaskFilter::MakeGammaTable(uint8_t table[256], SkScalar gamma) { | 85 void SkTableMaskFilter::MakeGammaTable(uint8_t table[256], SkScalar gamma) { |
| 86 const float dx = 1 / 255.0f; | 86 const float dx = 1 / 255.0f; |
| 87 const float g = SkScalarToFloat(gamma); | 87 const float g = SkScalarToFloat(gamma); |
| 88 | 88 |
| 89 float x = 0; | 89 float x = 0; |
| 90 for (int i = 0; i < 256; i++) { | 90 for (int i = 0; i < 256; i++) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 str->append("table: "); | 135 str->append("table: "); |
| 136 for (int i = 0; i < 255; ++i) { | 136 for (int i = 0; i < 255; ++i) { |
| 137 str->appendf("%d, ", fTable[i]); | 137 str->appendf("%d, ", fTable[i]); |
| 138 } | 138 } |
| 139 str->appendf("%d", fTable[255]); | 139 str->appendf("%d", fTable[255]); |
| 140 | 140 |
| 141 str->append(")"); | 141 str->append(")"); |
| 142 } | 142 } |
| 143 #endif | 143 #endif |
| OLD | NEW |