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

Commit b146b121 authored by Romain Guy's avatar Romain Guy
Browse files

Fix text shadow rendering issue.

Change-Id: Ic9eb0d38ad684d2f2c95a4f586f865db911cb872
parent 33a8cfb0
Loading
Loading
Loading
Loading
+32 −28
Original line number Diff line number Diff line
@@ -1301,7 +1301,7 @@ void OpenGLRenderer::drawRect(float left, float top, float right, float bottom,

void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
        float x, float y, SkPaint* paint) {
    if (text == NULL || count == 0 || (paint->getAlpha() == 0 && paint->getXfermode() == NULL)) {
    if (text == NULL || count == 0) {
        return;
    }
    if (mSnapshot->isIgnored()) return;
@@ -1365,6 +1365,10 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
        finishDrawTexture();
    }

    if (paint->getAlpha() == 0 && paint->getXfermode() == NULL) {
        return;
    }

    // Pick the appropriate texture filtering
    bool linearFilter = mSnapshot->transform->changesBounds();
    if (pureTranslate && !linearFilter) {
+8 −0
Original line number Diff line number Diff line
@@ -82,6 +82,14 @@ public class TextActivity extends Activity {
            mLargePaint.setAlpha(100);
            canvas.drawText("Hello OpenGL renderer!", 100, 500, mLargePaint);
            mLargePaint.setAlpha(255);
            mLargePaint.setShadowLayer(3.0f, 3.0f, 3.0f, 0xd000ff00);
            mLargePaint.setColor(0x00ffff00);
            canvas.drawText("Hello OpenGL renderer!", 100, 600, mLargePaint);
            mLargePaint.setShadowLayer(3.0f, 3.0f, 3.0f, 0x80000000);
            mLargePaint.setColor(0x4dffffff);
            canvas.drawText("Hello OpenGL renderer!", 100, 650, mLargePaint);
            mLargePaint.setAlpha(255);
            mLargePaint.setColor(0xff000000);
            mLargePaint.clearShadowLayer();
            
            canvas.drawText("Hello OpenGL renderer!", 500, 40, mStrikePaint);