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