| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2014 Google Inc. | 2  * Copyright 2014 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 GrStencilAndCoverTextContext_DEFINED | 8 #ifndef GrStencilAndCoverTextContext_DEFINED | 
| 9 #define GrStencilAndCoverTextContext_DEFINED | 9 #define GrStencilAndCoverTextContext_DEFINED | 
| 10 | 10 | 
| 11 #include "GrDrawContext.h" | 11 #include "GrDrawContext.h" | 
| 12 #include "GrStyle.h" | 12 #include "GrStyle.h" | 
| 13 #include "SkDrawFilter.h" | 13 #include "SkDrawFilter.h" | 
|  | 14 #include "SkOpts.h" | 
| 14 #include "SkTextBlob.h" | 15 #include "SkTextBlob.h" | 
| 15 #include "SkTHash.h" | 16 #include "SkTHash.h" | 
| 16 #include "SkTInternalLList.h" | 17 #include "SkTInternalLList.h" | 
| 17 #include "SkTLList.h" | 18 #include "SkTLList.h" | 
| 18 #include "batches/GrDrawPathBatch.h" | 19 #include "batches/GrDrawPathBatch.h" | 
| 19 | 20 | 
| 20 class GrAtlasTextContext; | 21 class GrAtlasTextContext; | 
| 21 class GrTextStrike; | 22 class GrTextStrike; | 
| 22 class GrPath; | 23 class GrPath; | 
| 23 class SkSurfaceProps; | 24 class SkSurfaceProps; | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 113     // Text blobs/caches. | 114     // Text blobs/caches. | 
| 114 | 115 | 
| 115     class TextBlob : public SkTLList<TextRun, 1> { | 116     class TextBlob : public SkTLList<TextRun, 1> { | 
| 116     public: | 117     public: | 
| 117         typedef SkTArray<uint32_t, true> Key; | 118         typedef SkTArray<uint32_t, true> Key; | 
| 118 | 119 | 
| 119         static const Key& GetKey(const TextBlob* blob) { return blob->key(); } | 120         static const Key& GetKey(const TextBlob* blob) { return blob->key(); } | 
| 120 | 121 | 
| 121         static uint32_t Hash(const Key& key) { | 122         static uint32_t Hash(const Key& key) { | 
| 122             SkASSERT(key.count() > 1); // 1-length keys should be using the blob
     -id hash map. | 123             SkASSERT(key.count() > 1); // 1-length keys should be using the blob
     -id hash map. | 
| 123             return SkChecksum::Murmur3(key.begin(), sizeof(uint32_t) * key.count
     ()); | 124             return SkOpts::hash(key.begin(), sizeof(uint32_t) * key.count()); | 
| 124         } | 125         } | 
| 125 | 126 | 
| 126         TextBlob(uint32_t blobId, const SkTextBlob* skBlob, const SkPaint& skPai
     nt) | 127         TextBlob(uint32_t blobId, const SkTextBlob* skBlob, const SkPaint& skPai
     nt) | 
| 127             : fKey(&blobId, 1) { this->init(skBlob, skPaint); } | 128             : fKey(&blobId, 1) { this->init(skBlob, skPaint); } | 
| 128 | 129 | 
| 129         TextBlob(const Key& key, const SkTextBlob* skBlob, const SkPaint& skPain
     t) | 130         TextBlob(const Key& key, const SkTextBlob* skBlob, const SkPaint& skPain
     t) | 
| 130             : fKey(key) { | 131             : fKey(key) { | 
| 131             // 1-length keys are unterstood to be the blob id and must use the o
     ther constructor. | 132             // 1-length keys are unterstood to be the blob id and must use the o
     ther constructor. | 
| 132             SkASSERT(fKey.count() > 1); | 133             SkASSERT(fKey.count() > 1); | 
| 133             this->init(skBlob, skPaint); | 134             this->init(skBlob, skPaint); | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 150     void purgeToFit(const TextBlob&); | 151     void purgeToFit(const TextBlob&); | 
| 151 | 152 | 
| 152     GrAtlasTextContext*                                       fFallbackTextConte
     xt; | 153     GrAtlasTextContext*                                       fFallbackTextConte
     xt; | 
| 153     SkTHashMap<uint32_t, TextBlob*>                           fBlobIdCache; | 154     SkTHashMap<uint32_t, TextBlob*>                           fBlobIdCache; | 
| 154     SkTHashTable<TextBlob*, const TextBlob::Key&, TextBlob>   fBlobKeyCache; | 155     SkTHashTable<TextBlob*, const TextBlob::Key&, TextBlob>   fBlobKeyCache; | 
| 155     SkTInternalLList<TextBlob>                                fLRUList; | 156     SkTInternalLList<TextBlob>                                fLRUList; | 
| 156     size_t                                                    fCacheSize; | 157     size_t                                                    fCacheSize; | 
| 157 }; | 158 }; | 
| 158 | 159 | 
| 159 #endif | 160 #endif | 
| OLD | NEW | 
|---|