1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef GrDistanceFieldAdjustTable_DEFINED
9#define GrDistanceFieldAdjustTable_DEFINED
10
11#include "include/core/SkScalar.h"
12
13// Distance field text needs this table to compute a value for use in the fragment shader.
14class GrDistanceFieldAdjustTable {
15public:
16 static const GrDistanceFieldAdjustTable* Get();
17
18 ~GrDistanceFieldAdjustTable() {
19 delete[] fTable;
20 delete[] fGammaCorrectTable;
21 }
22
23 SkScalar getAdjustment(int i, bool useGammaCorrectTable) const {
24 return useGammaCorrectTable ? fGammaCorrectTable[i] : fTable[i];
25 }
26
27private:
28 GrDistanceFieldAdjustTable();
29
30 SkScalar* fTable;
31 SkScalar* fGammaCorrectTable;
32};
33
34#endif
35