aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-01-13 16:33:36 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-01-13 16:33:36 +0000
commitd3b13bd5af686278a6d2586a5d6304cb9fba70b7 (patch)
tree542e45e6929f0f3661600a712688351482b090da
parent55b8e8c81aaa6515fa66be58f11ab6a7ca7f1fae (diff)
initialize SkGlyph::fMaskFormat to avoid valgrind warnings
rebaseline gradients now that we dither our 32bit src git-svn-id: http://skia.googlecode.com/svn/trunk@692 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/core/SkScalerContext.h36
1 files changed, 19 insertions, 17 deletions
diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h
index 9617c57231..0c93e2e535 100644
--- a/include/core/SkScalerContext.h
+++ b/include/core/SkScalerContext.h
@@ -29,7 +29,8 @@ class SkPathEffect;
class SkRasterizer;
// needs to be != to any valid SkMask::Format
-#define MASK_FORMAT_JUST_ADVANCE (0xFF)
+#define MASK_FORMAT_UNKNOWN (0xFF)
+#define MASK_FORMAT_JUST_ADVANCE MASK_FORMAT_UNKNOWN
#define kMaxGlyphWidth (1<<13)
@@ -49,6 +50,7 @@ struct SkGlyph {
fID = id;
fImage = NULL;
fPath = NULL;
+ fMaskFormat = MASK_FORMAT_UNKNOWN;
#ifdef SK_GPU_AWARE_GLYPHCACHE
fGLCacheOffset = SKGLYPH_GLCACHEOFFSET_INVALID;
fGLStrikePtr = NULL;
@@ -66,15 +68,15 @@ struct SkGlyph {
}
return rb;
}
-
+
bool isJustAdvance() const {
return MASK_FORMAT_JUST_ADVANCE == fMaskFormat;
}
-
+
bool isFullMetrics() const {
return MASK_FORMAT_JUST_ADVANCE != fMaskFormat;
}
-
+
uint16_t getGlyphID() const {
return ID2Code(fID);
}
@@ -84,27 +86,27 @@ struct SkGlyph {
SkASSERT(code >= baseGlyphCount);
return code - baseGlyphCount;
}
-
+
unsigned getSubX() const {
return ID2SubX(fID);
}
-
+
SkFixed getSubXFixed() const {
return SubToFixed(ID2SubX(fID));
}
-
+
SkFixed getSubYFixed() const {
return SubToFixed(ID2SubY(fID));
}
-
+
size_t computeImageSize() const;
-
+
/** Call this to set all of the metrics fields to 0 (e.g. if the scaler
encounters an error measuring a glyph). Note: this does not alter the
fImage, fPath, fID, fMaskFormat fields.
*/
void zeroMetrics();
-
+
enum {
kSubBits = 2,
kSubMask = ((1 << kSubBits) - 1),
@@ -118,28 +120,28 @@ struct SkGlyph {
static unsigned ID2Code(uint32_t id) {
return id & kCodeMask;
}
-
+
static unsigned ID2SubX(uint32_t id) {
return id >> (kSubShift + kSubShiftX);
}
-
+
static unsigned ID2SubY(uint32_t id) {
return (id >> (kSubShift + kSubShiftY)) & kSubMask;
}
-
+
static unsigned FixedToSub(SkFixed n) {
return (n >> (16 - kSubBits)) & kSubMask;
}
-
+
static SkFixed SubToFixed(unsigned sub) {
SkASSERT(sub <= kSubMask);
return sub << (16 - kSubBits);
}
-
+
static uint32_t MakeID(unsigned code) {
return code;
}
-
+
static uint32_t MakeID(unsigned code, SkFixed x, SkFixed y) {
SkASSERT(code <= kCodeMask);
x = FixedToSub(x);
@@ -148,7 +150,7 @@ struct SkGlyph {
(y << (kSubShift + kSubShiftY)) |
code;
}
-
+
void toMask(SkMask* mask) const;
/** Given a glyph which is has a mask format of LCD or VerticalLCD, take