| Index: src/core/SkPaint.cpp
|
| diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
|
| index c3f217cefc60e5501e08a88755b5f537dbcb956c..c76ba9c4d2f9064c0624b989ac90361ed0bf69a5 100644
|
| --- a/src/core/SkPaint.cpp
|
| +++ b/src/core/SkPaint.cpp
|
| @@ -48,6 +48,13 @@
|
| #define GEN_ID_INC_EVAL(expression)
|
| #endif
|
|
|
| +#define setFontMetricsBitSet(__fObject, __bitSet) \
|
| +{ \
|
| + if(__fObject != NULL) { \
|
| + __fObject->fFontMetricsFlag |= __bitSet; \
|
| + } \
|
| +}
|
| +
|
| SkPaint::SkPaint() {
|
| // since we may have padding, we zero everything so that our memcmp() call
|
| // in operator== will work correctly.
|
| @@ -1285,17 +1292,20 @@ SkScalar SkPaint::getFontMetrics(FontMetrics* metrics, SkScalar zoom) const {
|
| }
|
|
|
| paint.descriptorProc(NULL, zoomPtr, FontMetricsDescProc, metrics, true);
|
| + metrics->fFontMetricsFlag = 0;
|
|
|
| if (scale) {
|
| - metrics->fTop = SkScalarMul(metrics->fTop, scale);
|
| - metrics->fAscent = SkScalarMul(metrics->fAscent, scale);
|
| - metrics->fDescent = SkScalarMul(metrics->fDescent, scale);
|
| - metrics->fBottom = SkScalarMul(metrics->fBottom, scale);
|
| - metrics->fLeading = SkScalarMul(metrics->fLeading, scale);
|
| - metrics->fAvgCharWidth = SkScalarMul(metrics->fAvgCharWidth, scale);
|
| - metrics->fXMin = SkScalarMul(metrics->fXMin, scale);
|
| - metrics->fXMax = SkScalarMul(metrics->fXMax, scale);
|
| - metrics->fXHeight = SkScalarMul(metrics->fXHeight, scale);
|
| + if( (metrics->fTop = SkScalarMul(metrics->fTop, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_Top); };
|
| + if( (metrics->fAscent = SkScalarMul(metrics->fAscent, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_Ascent); };
|
| + if( (metrics->fDescent = SkScalarMul(metrics->fDescent, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_Descent); };
|
| + if( (metrics->fBottom = SkScalarMul(metrics->fBottom, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_Bottom); };
|
| + if( (metrics->fLeading = SkScalarMul(metrics->fLeading, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_Leading); };
|
| + if( (metrics->fAvgCharWidth = SkScalarMul(metrics->fAvgCharWidth, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_AvgCharWidth); };
|
| + if( (metrics->fXMin = SkScalarMul(metrics->fXMin, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_XMin); };
|
| + if( (metrics->fXMax = SkScalarMul(metrics->fXMax, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_XMax); };
|
| + if( (metrics->fXHeight = SkScalarMul(metrics->fXHeight, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_XHeight); };
|
| + if( (metrics->fUnderlineThickness = SkScalarMul(metrics->fUnderlineThickness, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_UnderlineThickness); };
|
| + if( (metrics->fUnderlinePosition = SkScalarMul(metrics->fUnderlinePosition, scale)) ) { setFontMetricsBitSet(metrics, kFontMetrics_UnderlinePosition); };
|
| }
|
| return metrics->fDescent - metrics->fAscent + metrics->fLeading;
|
| }
|
| @@ -2257,6 +2267,14 @@ const SkRect& SkPaint::doComputeFastBounds(const SkRect& origSrc,
|
| return *storage;
|
| }
|
|
|
| +bool SkPaint::isFontMetricsBitSet(FontMetrics * fObject, FontMetricsBitSet bitSet) const
|
| +{
|
| + if(fObject != NULL) {
|
| + return SkToBool(fObject->fFontMetricsFlag & bitSet);
|
| + }
|
| + return false;
|
| +}
|
| +
|
| #ifdef SK_DEVELOPER
|
| void SkPaint::toString(SkString* str) const {
|
| str->append("<dl><dt>SkPaint:</dt><dd><dl>");
|
|
|