Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcdfff57 authored by Chris Craik's avatar Chris Craik Committed by Android Git Automerger
Browse files

am f999879c: Merge "Account for text alignment in Op bounds calculation" into jb-mr2-dev

* commit 'f999879c':
  Account for text alignment in Op bounds calculation
parents 581488fc f999879c
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -1140,9 +1140,20 @@ public:
            const float* positions, SkPaint* paint, float length)
            : DrawBoundedOp(paint), mText(text), mBytesCount(bytesCount), mCount(count),
            mX(x), mY(y), mPositions(positions), mLength(length) {
        // duplicates bounds calculation from OpenGLRenderer::drawText, but doesn't alter mX
        SkPaint::FontMetrics metrics;
        paint->getFontMetrics(&metrics, 0.0f);
        mLocalBounds.set(mX, mY + metrics.fTop, mX + length, mY + metrics.fBottom);
        switch (paint->getTextAlign()) {
        case SkPaint::kCenter_Align:
            x -= length / 2.0f;
            break;
        case SkPaint::kRight_Align:
            x -= length;
            break;
        default:
            break;
        }
        mLocalBounds.set(x, mY + metrics.fTop, x + length, mY + metrics.fBottom);
    }

    virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty, uint32_t level,