Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: src/gpu/text/GrDistanceFieldAdjustTable.h

Issue 1885613002: sRGB support for distance field text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Break long line Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrDistanceFieldAdjustTable_DEFINED 8 #ifndef GrDistanceFieldAdjustTable_DEFINED
9 #define GrDistanceFieldAdjustTable_DEFINED 9 #define GrDistanceFieldAdjustTable_DEFINED
10 10
11 #include "SkRefCnt.h" 11 #include "SkRefCnt.h"
12 #include "SkScalar.h" 12 #include "SkScalar.h"
13 13
14 // Distance field text needs this table to compute a value for use in the fragme nt shader. 14 // Distance field text needs this table to compute a value for use in the fragme nt shader.
15 // Because the GrAtlasTextContext can go out of scope before the final flush, th is needs to be 15 // Because the GrAtlasTextContext can go out of scope before the final flush, th is needs to be
16 // refcnted and malloced 16 // refcnted and malloced
17 struct GrDistanceFieldAdjustTable : public SkNVRefCnt<GrDistanceFieldAdjustTable > { 17 struct GrDistanceFieldAdjustTable : public SkNVRefCnt<GrDistanceFieldAdjustTable > {
18 GrDistanceFieldAdjustTable() { this->buildDistanceAdjustTable(); } 18 GrDistanceFieldAdjustTable() { this->buildDistanceAdjustTables(); }
19 ~GrDistanceFieldAdjustTable() { delete[] fTable; } 19 ~GrDistanceFieldAdjustTable() {
20 delete[] fTable;
21 delete[] fSRGBTable;
22 }
20 23
21 const SkScalar& operator[] (int i) const { 24 const SkScalar& getAdjustment(int i, bool useSRGBTable) const {
22 return fTable[i]; 25 return useSRGBTable ? fSRGBTable[i] : fTable[i];
23 } 26 }
24 27
25 private: 28 private:
26 void buildDistanceAdjustTable(); 29 void buildDistanceAdjustTables();
27 30
28 SkScalar* fTable; 31 SkScalar* fTable;
32 SkScalar* fSRGBTable;
29 }; 33 };
30 34
31 #endif 35 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698