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

Side by Side Diff: src/core/SkGlyph.h

Issue 1216983003: Move the GlyphCache to use a hash table instead of doing its own ad-hoc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address mtklein's comments Created 5 years, 5 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
« no previous file with comments | « no previous file | src/core/SkGlyphCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 SkGlyph_DEFINED 8 #ifndef SkGlyph_DEFINED
9 #define SkGlyph_DEFINED 9 #define SkGlyph_DEFINED
10 10
11 #include "SkChecksum.h"
11 #include "SkTypes.h" 12 #include "SkTypes.h"
12 #include "SkFixed.h" 13 #include "SkFixed.h"
13 #include "SkMask.h" 14 #include "SkMask.h"
14 15
15 class SkPath; 16 class SkPath;
16 class SkGlyphCache; 17 class SkGlyphCache;
17 18
18 // needs to be != to any valid SkMask::Format 19 // needs to be != to any valid SkMask::Format
19 #define MASK_FORMAT_UNKNOWN (0xFF) 20 #define MASK_FORMAT_UNKNOWN (0xFF)
20 #define MASK_FORMAT_JUST_ADVANCE MASK_FORMAT_UNKNOWN 21 #define MASK_FORMAT_JUST_ADVANCE MASK_FORMAT_UNKNOWN
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 size_t computeImageSize() const; 108 size_t computeImageSize() const;
108 109
109 /** Call this to set all of the metrics fields to 0 (e.g. if the scaler 110 /** Call this to set all of the metrics fields to 0 (e.g. if the scaler
110 encounters an error measuring a glyph). Note: this does not alter the 111 encounters an error measuring a glyph). Note: this does not alter the
111 fImage, fPath, fID, fMaskFormat fields. 112 fImage, fPath, fID, fMaskFormat fields.
112 */ 113 */
113 void zeroMetrics(); 114 void zeroMetrics();
114 115
115 void toMask(SkMask* mask) const; 116 void toMask(SkMask* mask) const;
116 117
118 class HashTraits {
119 public:
120 static uint32_t GetKey(const SkGlyph& glyph) {
121 return glyph.fID;
122 }
123 static uint32_t Hash(uint32_t glyphId) {
124 return SkChecksum::CheapMix(glyphId);
125 }
126 };
127
117 private: 128 private:
118 // TODO(herb) remove friend statement after SkGlyphCache cleanup. 129 // TODO(herb) remove friend statement after SkGlyphCache cleanup.
119 friend class SkGlyphCache; 130 friend class SkGlyphCache;
120 131
121 void initCommon(uint32_t id) { 132 void initCommon(uint32_t id) {
122 fID = id; 133 fID = id;
123 fImage = NULL; 134 fImage = NULL;
124 fPath = NULL; 135 fPath = NULL;
125 fMaskFormat = MASK_FORMAT_UNKNOWN; 136 fMaskFormat = MASK_FORMAT_UNKNOWN;
126 fForceBW = 0; 137 fForceBW = 0;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 177
167 // FIXME - This is needed because the Android frame work directly 178 // FIXME - This is needed because the Android frame work directly
168 // accesses fID. Remove when fID accesses are cleaned up. 179 // accesses fID. Remove when fID accesses are cleaned up.
169 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 180 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
170 public: 181 public:
171 #endif 182 #endif
172 uint32_t fID; 183 uint32_t fID;
173 }; 184 };
174 185
175 #endif 186 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkGlyphCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698