のねのBlog

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

DisplayList

DisplayListRenderer::drawTextの流れ


/frameworks/base/libs/hwui/DisplayListRenderer.cpp

   422 status_t DisplayListRenderer::drawText(const char* text, int bytesCount, int count,
    423         float x, float y, const float* positions, SkPaint* paint,
    424         float totalAdvance, const Rect& bounds, DrawOpMode drawOpMode) {
    425 
    426     if (!text || count <= 0) return DrawGlInfo::kStatusDone;
    427 
    428     text = refText(text, bytesCount);
    429     positions = refBuffer<float>(positions, count * 2);
    430     paint = refPaint(paint);
    431 
    432     DrawOp* op = new (alloc()) DrawTextOp(text, bytesCount, count,
    433             x, y, positions, paint, totalAdvance, bounds);
    434     addDrawOp(op);
    435     return DrawGlInfo::kStatusDone;
    436 }
   1463     virtual status_t multiDraw(OpenGLRenderer& renderer, Rect& dirty,
   1464             const Vector<OpStatePair>& ops, const Rect& bounds) {
   1465         status_t status = DrawGlInfo::kStatusDone;
   1466         for (unsigned int i = 0; i < ops.size(); i++) {
   1467             const DeferredDisplayState& state = *(ops[i].state);
   1468             DrawOpMode drawOpMode = (i == ops.size() - 1) ? kDrawOpMode_Flush : kDrawOpMode_Defer;
   1469             renderer.restoreDisplayState(state, true); // restore all but the clip
   1470 
   1471             DrawTextOp& op = *((DrawTextOp*)ops[i].op);
   1472             // quickReject() will not occure in drawText() so we can use mLocalBounds
   1473             // directly, we do not need to account for shadow by calling getLocalBounds()
   1474             status |= renderer.drawText(op.mText, op.mBytesCount, op.mCount, op.mX, op.mY,
   1475                     op.mPositions, op.getPaint(renderer), op.mTotalAdvance, op.mLocalBounds,
   1476                     drawOpMode);
   1477         }
   1478         return status;
   1479     }