aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGlyph.h
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2015-02-24 06:09:41 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-24 06:09:41 -0800
commite59bbf1cd5dcce66181083821c43a157998bc78b (patch)
tree4d6b2d9433bf259c20f98c21dbc69dfc38be1a14 /src/core/SkGlyph.h
parent1297ecfd1d1efaeee41153e491b160228ba4345a (diff)
Revert of Make fID and MixedID calculations private (patchset #5 id:80001 of https://codereview.chromium.org/939123002/)
Reason for revert: This actually *does* change the public API - fID is now private, and it was being used on Android. See https://android-build.storage.googleapis.com/builds/git_master-skia-linux-volantis-userdebug/1751533/5242b865d3e9bebc650c9b326dfa9d68c8bd1f59562bf32b85301fb984dc8b26/logs/build.log?Signature=Q0el9M4kTu1KQ8u02KX9TH1Pa22y9BkDK1IW%2B9OeJJNfrDEVzLXAz0XQ%2BHHQM8xVjft06jZJva1V8InZmgjcOk6PdZQbQW6XwwsHLKsbpbAE48iTWH3AlJAAoTtj9cifzgeHW8g80IcVxwHXmINRER%2BLPz3eHGisgfTTFUoWYCc%3D&GoogleAccessId=701025073339-mqn0q2nvir9iurm6q5d00tdv7blbgvjr%40developer.gserviceaccount.com&Expires=1424786471 : In file included from frameworks/base/libs/hwui/tests/../font/Font.cpp:26:0: external/skia/src/core/SkGlyph.h: In member function 'android::uirenderer::CachedGlyphInfo* android::uirenderer::Font::cacheGlyph(const SkPaint*, glyph_t, bool)': external/skia/src/core/SkGlyph.h:157:17: error: 'uint32_t SkGlyph::fID' is private uint32_t fID; ^ frameworks/base/libs/hwui/tests/../font/Font.cpp:482:39: error: within this context newGlyph->mGlyphIndex = skiaGlyph.fID; We need to update Android in order to hide fID. Original issue's description: > BUG=skia: > > (mtklein from here on) > No public API changes. > TBR=reed@google.com > > Committed: https://skia.googlesource.com/skia/+/f8d24e2c0c7b44b7ccf20e40890514db4cde7b15 TBR=mtklein@google.com,herb@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/951353002
Diffstat (limited to 'src/core/SkGlyph.h')
-rw-r--r--src/core/SkGlyph.h58
1 files changed, 21 insertions, 37 deletions
diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h
index 4a9acbfe75..9abefa84c7 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 @@ class SkGlyphCache;
#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 @@ class SkGlyph {
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 @@ class SkGlyph {
*/
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 @@ class SkGlyph {
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