OSDN Git Service

Reorder the drawing of underline/stroke and text
authorSeigo Nonaka <nona@google.com>
Mon, 21 May 2018 21:56:40 +0000 (14:56 -0700)
committerSeigo Nonaka <nona@google.com>
Mon, 21 May 2018 21:56:40 +0000 (14:56 -0700)
The underline and stroke should be top of the text.
This regression happens on O-MR1 and the root cause is still unknown,
but the drawning underline/stroke should do before drawing text.

Bug: 79906191
Test: atest CtsWidgetTestCases:EditTextTest
    CtsWidgetTestCases:TextViewFadingEdgeTest
    FrameworksCoreTests:TextViewFallbackLineSpacingTest
    FrameworksCoreTests:TextViewTest FrameworksCoreTests:TypefaceTest
    CtsGraphicsTestCases:TypefaceTest CtsWidgetTestCases:TextViewTest
    CtsTextTestCases FrameworksCoreTests:android.text
    CtsWidgetTestCases:TextViewPrecomputedTextTest

Change-Id: Idc2f99b9c0fa125af331e496da8daa326d14bfac

core/java/android/text/TextLine.java

index 64365fa..b6f9f94 100644 (file)
@@ -824,6 +824,9 @@ public class TextLine {
                 wp.setColor(previousColor);
             }
 
+            drawTextRun(c, wp, start, end, contextStart, contextEnd, runIsRtl,
+                    leftX, y + wp.baselineShift);
+
             if (numDecorations != 0) {
                 for (int i = 0; i < numDecorations; i++) {
                     final DecorationInfo info = decorations.get(i);
@@ -866,8 +869,6 @@ public class TextLine {
                 }
             }
 
-            drawTextRun(c, wp, start, end, contextStart, contextEnd, runIsRtl,
-                    leftX, y + wp.baselineShift);
         }
 
         return runIsRtl ? -totalWidth : totalWidth;