のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

SkPictureRecord

この辺とおるのかな?

external/skia/src/core/SkPictureRecord.cpp

    564 void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
    565                          const SkPoint pos[], const SkPaint& paint) {
    566     size_t points = paint.countText(text, byteLength);
    567     if (0 == points)
    568         return;
    569 
    570     bool canUseDrawH = true;
    571     SkScalar minY = pos[0].fY;
    572     SkScalar maxY = pos[0].fY;
    573     // check if the caller really should have used drawPosTextH()
    574     {
    575         const SkScalar firstY = pos[0].fY;
    576         for (size_t index = 1; index < points; index++) {
    577             if (pos[index].fY != firstY) {
    578                 canUseDrawH = false;
    579                 if (pos[index].fY < minY) {
    580                     minY = pos[index].fY;
    581                 } else if (pos[index].fY > maxY) {
    582                     maxY = pos[index].fY;
    583                 }
    584             }
    585         }
    586     }
    587 
    588     bool fastBounds = !paint.isVerticalText() && paint.canComputeFastBounds();
    589     bool fast = canUseDrawH && fastBounds;
    590 
    591     if (fast) {
    592         addDraw(DRAW_POS_TEXT_H_TOP_BOTTOM);
    593     } else if (canUseDrawH) {
    594         addDraw(DRAW_POS_TEXT_H);
    595     } else if (fastBounds) {
    596         addDraw(DRAW_POS_TEXT_TOP_BOTTOM);
    597     } else {
    598         addDraw(DRAW_POS_TEXT);
    599     }
    600     const SkFlatData* flatPaintData = addPaint(paint);
    601     SkASSERT(flatPaintData);
    602     addText(text, byteLength);
    603     addInt(points);
    604 
    605 #ifdef SK_DEBUG_SIZE
    606     size_t start = fWriter.size();
    607 #endif
    608     if (canUseDrawH) {
    609         if (fast) {
    610             addFontMetricsTopBottom(paint, *flatPaintData, pos[0].fY, pos[0].fY);
    611         }
    612         addScalar(pos[0].fY);
    613         SkScalar* xptr = (SkScalar*)fWriter.reserve(points * sizeof(SkScalar));
    614         for (size_t index = 0; index < points; index++)
    615             *xptr++ = pos[index].fX;
    616     }
    617     else {
    618         fWriter.writeMul4(pos, points * sizeof(SkPoint));
    619         if (fastBounds) {
    620             addFontMetricsTopBottom(paint, *flatPaintData, minY, maxY);
    621         }
    622     }
    623 #ifdef SK_DEBUG_SIZE
    624     fPointBytes += fWriter.size() - start;
    625     fPointWrites += points;
    626 #endif
    627     validate();
    628 }