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

Commit 909cbaf8 authored by Romain Guy's avatar Romain Guy
Browse files

Don't draw TextView's alpha layers when not needed.

Change-Id: Iedf42cbc62d727f18500c78fcccf2d081a761fec
parent 5d794412
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -37,6 +37,10 @@ public class ViewConfiguration {
     * @hide
     */
    public static final float ALPHA_THRESHOLD = 0.5f / PANEL_BIT_DEPTH;
    /**
     * @hide
     */
    public static final float ALPHA_THRESHOLD_INT = 0x7f / PANEL_BIT_DEPTH;

    /**
     * Defines the width of the horizontal scrollbar and the height of the vertical scrollbar in
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.widget;

import android.view.ViewConfiguration;
import com.android.internal.util.FastMath;
import com.android.internal.widget.EditableInputConnection;

@@ -3954,6 +3955,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

    @Override
    protected void onDraw(Canvas canvas) {
        if (mCurrentAlpha <= ViewConfiguration.ALPHA_THRESHOLD_INT) return;

        restartMarqueeIfNeeded();

        // Draw the background for this view
@@ -7047,6 +7050,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

    @Override
    protected float getLeftFadingEdgeStrength() {
        if (mCurrentAlpha <= ViewConfiguration.ALPHA_THRESHOLD_INT) return 0.0f;
        if (mEllipsize == TextUtils.TruncateAt.MARQUEE) {
            if (mMarquee != null && !mMarquee.isStopped()) {
                final Marquee marquee = mMarquee;
@@ -7073,6 +7077,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

    @Override
    protected float getRightFadingEdgeStrength() {
        if (mCurrentAlpha <= ViewConfiguration.ALPHA_THRESHOLD_INT) return 0.0f;
        if (mEllipsize == TextUtils.TruncateAt.MARQUEE) {
            if (mMarquee != null && !mMarquee.isStopped()) {
                final Marquee marquee = mMarquee;
+1 −0
Original line number Diff line number Diff line
@@ -455,6 +455,7 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
#endif

        // Clear the FBO
        bounds.snapToPixelBoundaries();
        glScissor(0.0f, 0.0f, bounds.getWidth(), bounds.getHeight());
        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        glClear(GL_COLOR_BUFFER_BIT);