OLD | NEW |
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 GrAtlasTextContext_DEFINED | 8 #ifndef GrAtlasTextContext_DEFINED |
9 #define GrAtlasTextContext_DEFINED | 9 #define GrAtlasTextContext_DEFINED |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 const char text[], size_t byteL
ength, | 160 const char text[], size_t byteL
ength, |
161 const SkScalar pos[], int scala
rsPerPosition, | 161 const SkScalar pos[], int scala
rsPerPosition, |
162 const SkPoint& offset, | 162 const SkPoint& offset, |
163 const SkIRect& regionClipBounds
); | 163 const SkIRect& regionClipBounds
); |
164 | 164 |
165 // Distance field text needs this table to compute a value for use in the fr
agment shader. | 165 // Distance field text needs this table to compute a value for use in the fr
agment shader. |
166 // Because the GrAtlasTextContext can go out of scope before the final flush
, this needs to be | 166 // Because the GrAtlasTextContext can go out of scope before the final flush
, this needs to be |
167 // refcnted and malloced | 167 // refcnted and malloced |
168 struct DistanceAdjustTable : public SkNVRefCnt<DistanceAdjustTable> { | 168 struct DistanceAdjustTable : public SkNVRefCnt<DistanceAdjustTable> { |
169 DistanceAdjustTable() { this->buildDistanceAdjustTable(); } | 169 DistanceAdjustTable() { this->buildDistanceAdjustTable(); } |
170 ~DistanceAdjustTable() { SkDELETE_ARRAY(fTable); } | 170 ~DistanceAdjustTable() { delete[] fTable; } |
171 | 171 |
172 const SkScalar& operator[] (int i) const { | 172 const SkScalar& operator[] (int i) const { |
173 return fTable[i]; | 173 return fTable[i]; |
174 } | 174 } |
175 | 175 |
176 private: | 176 private: |
177 void buildDistanceAdjustTable(); | 177 void buildDistanceAdjustTable(); |
178 | 178 |
179 SkScalar* fTable; | 179 SkScalar* fTable; |
180 }; | 180 }; |
181 | 181 |
182 GrBatchTextStrike* fCurrStrike; | 182 GrBatchTextStrike* fCurrStrike; |
183 GrTextBlobCache* fCache; | 183 GrTextBlobCache* fCache; |
184 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable; | 184 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable; |
185 | 185 |
186 friend class GrTextBlobCache; | 186 friend class GrTextBlobCache; |
187 friend class TextBatch; | 187 friend class TextBatch; |
188 | 188 |
189 #ifdef GR_TEST_UTILS | 189 #ifdef GR_TEST_UTILS |
190 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); | 190 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); |
191 #endif | 191 #endif |
192 | 192 |
193 typedef GrTextContext INHERITED; | 193 typedef GrTextContext INHERITED; |
194 }; | 194 }; |
195 | 195 |
196 #endif | 196 #endif |
OLD | NEW |