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

Unified Diff: src/core/SkGlyph.h

Issue 951353002: Revert of Make fID and MixedID calculations private (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkGlyphCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGlyph.h
diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h
index 4a9acbfe75bc6dcd9d2d48c4ccd2aa739ec46b7c..9abefa84c7578f450cce93460a109e95e3f0bca4 100644
--- a/src/core/SkGlyph.h
+++ b/src/core/SkGlyph.h
@@ -13,7 +13,6 @@
#include "SkMask.h"
class SkPath;
-class SkGlyphCache;
// needs to be != to any valid SkMask::Format
#define MASK_FORMAT_UNKNOWN (0xFF)
@@ -21,23 +20,12 @@
#define kMaxGlyphWidth (1<<13)
-class SkGlyph {
- enum {
- kSubBits = 2,
- kSubMask = ((1 << kSubBits) - 1),
- kSubShift = 24, // must be large enough for glyphs and unichars
- kCodeMask = ((1 << kSubShift) - 1),
- // relative offsets for X and Y subpixel bits
- kSubShiftX = kSubBits,
- kSubShiftY = 0
- };
-
- public:
- static const SkFixed kSubpixelRound = SK_FixedHalf >> SkGlyph::kSubBits;
+struct SkGlyph {
void* fImage;
SkPath* fPath;
SkFixed fAdvanceX, fAdvanceY;
+ uint32_t fID;
uint16_t fWidth, fHeight;
int16_t fTop, fLeft;
@@ -45,12 +33,12 @@
int8_t fRsbDelta, fLsbDelta; // used by auto-kerning
int8_t fForceBW;
- void initWithGlyphID(uint32_t glyph_id) {
- this->initCommon(MakeID(glyph_id));
- }
-
- void initGlyphIdFrom(const SkGlyph& glyph) {
- this->initCommon(glyph.fID);
+ void init(uint32_t id) {
+ fID = id;
+ fImage = NULL;
+ fPath = NULL;
+ fMaskFormat = MASK_FORMAT_UNKNOWN;
+ fForceBW = 0;
}
/**
@@ -106,22 +94,18 @@
*/
void zeroMetrics();
+ enum {
+ kSubBits = 2,
+ kSubMask = ((1 << kSubBits) - 1),
+ kSubShift = 24, // must be large enough for glyphs and unichars
+ kCodeMask = ((1 << kSubShift) - 1),
+ // relative offsets for X and Y subpixel bits
+ kSubShiftX = kSubBits,
+ kSubShiftY = 0
+ };
- void toMask(SkMask* mask) const;
-
- private:
- // TODO(herb) remove friend statement after SkGlyphCache cleanup.
- friend class SkGlyphCache;
-
- void initCommon(uint32_t id) {
- fID = id;
- fImage = NULL;
- fPath = NULL;
- fMaskFormat = MASK_FORMAT_UNKNOWN;
- fForceBW = 0;
- }
static unsigned ID2Code(uint32_t id) {
- return (id & kCodeMask);
+ return id & kCodeMask;
}
static unsigned ID2SubX(uint32_t id) {
@@ -150,11 +134,11 @@
x = FixedToSub(x);
y = FixedToSub(y);
return (x << (kSubShift + kSubShiftX)) |
- (y << (kSubShift + kSubShiftY)) |
- code;
+ (y << (kSubShift + kSubShiftY)) |
+ code;
}
- uint32_t fID;
+ void toMask(SkMask* mask) const;
};
#endif
« no previous file with comments | « src/core/SkDraw.cpp ('k') | src/core/SkGlyphCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698