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 #include "GrTextBlobCache.h" | 8 #include "GrTextBlobCache.h" |
9 | 9 |
10 static const int kVerticesPerGlyph = 4; | 10 static const int kVerticesPerGlyph = 4; |
(...skipping 18 matching lines...) Expand all Loading... |
29 cacheBlob->fVertices = sizeof(BitmapTextBlob) + reinterpret_cast<unsigned ch
ar*>(cacheBlob); | 29 cacheBlob->fVertices = sizeof(BitmapTextBlob) + reinterpret_cast<unsigned ch
ar*>(cacheBlob); |
30 cacheBlob->fGlyphs = reinterpret_cast<GrGlyph**>(cacheBlob->fVertices + vert
icesCount); | 30 cacheBlob->fGlyphs = reinterpret_cast<GrGlyph**>(cacheBlob->fVertices + vert
icesCount); |
31 cacheBlob->fRuns = reinterpret_cast<BitmapTextBlob::Run*>(cacheBlob->fGlyphs
+ glyphCount); | 31 cacheBlob->fRuns = reinterpret_cast<BitmapTextBlob::Run*>(cacheBlob->fGlyphs
+ glyphCount); |
32 | 32 |
33 // Initialize runs | 33 // Initialize runs |
34 for (int i = 0; i < runCount; i++) { | 34 for (int i = 0; i < runCount; i++) { |
35 SkNEW_PLACEMENT(&cacheBlob->fRuns[i], BitmapTextBlob::Run); | 35 SkNEW_PLACEMENT(&cacheBlob->fRuns[i], BitmapTextBlob::Run); |
36 } | 36 } |
37 cacheBlob->fRunCount = runCount; | 37 cacheBlob->fRunCount = runCount; |
38 cacheBlob->fPool = &fPool; | 38 cacheBlob->fPool = &fPool; |
39 | |
40 #ifdef SK_DEBUG | |
41 cacheBlob->fTotalXError = 0; | |
42 cacheBlob->fTotalYError = 0; | |
43 #endif | |
44 return cacheBlob; | 39 return cacheBlob; |
45 } | 40 } |
46 | 41 |
47 void GrTextBlobCache::freeAll() { | 42 void GrTextBlobCache::freeAll() { |
48 SkTDynamicHash<BitmapTextBlob, BitmapTextBlob::Key>::Iter iter(&fCache); | 43 SkTDynamicHash<BitmapTextBlob, BitmapTextBlob::Key>::Iter iter(&fCache); |
49 while (!iter.done()) { | 44 while (!iter.done()) { |
50 (&(*iter))->unref(); | 45 (&(*iter))->unref(); |
51 ++iter; | 46 ++iter; |
52 } | 47 } |
53 fCache.rewind(); | 48 fCache.rewind(); |
54 } | 49 } |
OLD | NEW |