• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
14 class GrDistanceFieldAdjustTable {
15 public:
16     static const GrDistanceFieldAdjustTable* Get();
17 
~GrDistanceFieldAdjustTable()18     ~GrDistanceFieldAdjustTable() {
19         delete[] fTable;
20         delete[] fGammaCorrectTable;
21     }
22 
getAdjustment(int i,bool useGammaCorrectTable)23     SkScalar getAdjustment(int i, bool useGammaCorrectTable) const {
24         return useGammaCorrectTable ? fGammaCorrectTable[i] : fTable[i];
25     }
26 
27 private:
28     GrDistanceFieldAdjustTable();
29 
30     SkScalar* fTable;
31     SkScalar* fGammaCorrectTable;
32 };
33 
34 #endif
35