2 * Copyright 2015 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef sktext_gpu_DistanceFieldAdjustTable_DEFINED
9 #define sktext_gpu_DistanceFieldAdjustTable_DEFINED
11 #include "include/core/SkScalar.h"
13 namespace sktext::gpu {
15 // Distance field text needs this table to compute a value for use in the fragment shader.
16 class DistanceFieldAdjustTable {
18 static const DistanceFieldAdjustTable* Get();
20 ~DistanceFieldAdjustTable() {
22 delete[] fGammaCorrectTable;
25 SkScalar getAdjustment(int i, bool useGammaCorrectTable) const {
26 return useGammaCorrectTable ? fGammaCorrectTable[i] : fTable[i];
30 DistanceFieldAdjustTable();
33 SkScalar* fGammaCorrectTable;
36 } // namespace sktext::gpu