979 SkScalar SkPaint::measureText(const void* textData, size_t length,
980 SkRect* bounds, SkScalar zoom) const {
981 const char* text = (const char*)textData;
982 SkASSERT(text != NULL || length == 0);
983
984 SkScalar scale = 0;
985 SkAutoRestorePaintTextSizeAndFrame restore(this);
986
987 if (this->isLinearText()) {
988 scale = fTextSize / kCanonicalTextSizeForPaths;
989
990 ((SkPaint*)this)->setTextSize(SkIntToScalar(kCanonicalTextSizeForPaths));
991 }
992
993 SkMatrix zoomMatrix, *zoomPtr = NULL;
994 if (zoom) {
995 zoomMatrix.setScale(zoom, zoom);
996 zoomPtr = &zoomMatrix;
997 }
998
999 SkAutoGlyphCache autoCache(*this, zoomPtr);
1000 SkGlyphCache* cache = autoCache.getCache();
1001
1002 SkScalar width = 0;
1003
1004 if (length > 0) {
1005 int tempCount;
1006
1007 width = this->measure_text(cache, text, length, &tempCount, bounds); <==========
1008 if (scale) {
1009 width = SkScalarMul(width, scale);
1010 if (bounds) {
1011 bounds->fLeft = SkScalarMul(bounds->fLeft, scale);
1012 bounds->fTop = SkScalarMul(bounds->fTop, scale);
1013 bounds->fRight = SkScalarMul(bounds->fRight, scale);
1014 bounds->fBottom = SkScalarMul(bounds->fBottom, scale);
1015 }
1016 }
1017 }
1018 return width;
1019 }