のねのBlog

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

renderText

    570 static void renderText(OpenGLRenderer* renderer, const jchar* text, int count,
    571         jfloat x, jfloat y, int flags, SkPaint* paint) {
    572     sp<TextLayoutValue> value = TextLayoutEngine::getInstance().getValue(paint,
    573             text, 0, count, count, flags);
    574     if (value == NULL) {
    575         return;
    576     }
    577     const jchar* glyphs = value->getGlyphs();
    578     size_t glyphsCount = value->getGlyphsCount();
    579     jfloat totalAdvance = value->getTotalAdvance();
    580     const float* positions = value->getPos();
    581     int bytesCount = glyphsCount * sizeof(jchar);
    582     renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, x, y,
    583             positions, paint, totalAdvance);
    584 }
    424 status_t DisplayListRenderer::drawText(const char* text, int bytesCount, int count,
    425         float x, float y, const float* positions, SkPaint* paint,
    426         float length, DrawOpMode drawOpMode) {
    427 
    428     if (!text || count <= 0) return DrawGlInfo::kStatusDone;
    429 
    430     if (length < 0.0f) length = paint->measureText(text, bytesCount);
    431 
    432     text = refText(text, bytesCount);
    433     positions = refBuffer<float>(positions, count * 2);
    434     paint = refPaint(paint);
    435 
    436     DrawOp* op = new (alloc()) DrawTextOp(text, bytesCount, count, x, y, positions, paint, length);
    437     addDrawOp(op);
    438     return DrawGlInfo::kStatusDone;
    439 }